public function get_all() { $url = HOST . '/classes/CouponType'; $json = $this->avoslibrary->get($url); checkResponseError($json); $results = resultsWithJson($json); return $results; }
private function isCouponFavorited($uid = '', $couponId = '') { $value = array('people' => avosPointer('_User', $uid), 'coupon' => avosPointer('Coupon', $couponId)); $json = $this->kq->retrieveObjects('FavoritedCoupon', json_encode($value)); $results = resultsWithJson($json); if (empty($results)) { return false; } else { return true; } }
/** * * 返回总店的所有分店信息 * param: parentId */ public function shopbranches_get() { $url = HOST . "/classes/Shop?"; $parentId = $this->get('parentId'); if (empty($parentId)) { outputError(-1, '没有总店信息'); } $where = array('parent' => avosPointer('Shop', $parentId)); $url .= 'where=' . json_encode($where); $json = $this->kq->get($url); $error = checkResponseError($json); if (!empty($error)) { return $error; } $results = resultsWithJson($json); foreach ($results as $result) { $array[] = array_slice_keys($result, array('title', 'objectId', 'phone', 'address', 'openTime', 'location')); } if (!isLocalhost()) { $this->output->cache(CacheTime); } return $this->output_results($array); }
/** * 返回判断field是否有xxvalue * @param unknown_type $className * @param unknown_type $field * @param id $value */ function isFieldHasValue($className, $field, $value) { $where = array($field => $value); $json = $this->retrieveObjects($className, json_encode($where)); $results = resultsWithJson($json); if (empty($results)) { return false; } else { return true; } }