Example #1
0
 public static function pets_home(\ApiParam $params)
 {
     $params->query = (string) new \AndQuery(new \Query('cityEnglishName', $params->cityEnglishName), new \Query('imageFlag', '1'), new \OrQuery(new \Query('categoryEnglishName', 'chongwujiaoyi'), new \AndQuery(new \Query('categoryEnglishName', 'qitachongwu'), new \Query('description', '猫'))));
     return Ad::ad_list($params);
 }
Example #2
0
 public static function mobile_ad_list(\ApiParam $params)
 {
     self::mobile_ad_counter($params);
     if ($params->api_key == 'api_mobile_android' && $params->version == '2.0.1') {
         \InstantCounter::count('android_listing');
     }
     if (!$params->exists('activeOnly')) {
         $params->activeOnly = 1;
     }
     //没有参数,则默认返回active ad,保证兼容
     if (!$params->valueFlag) {
         $params->valueFlag = 1;
     }
     //手机客户端需要数据进行显示和编辑
     if (!$params->exists('wanted')) {
         $params->wanted = 0;
     }
     //手机客户端默认返回转让的信息
     if ($params->fields) {
         $params->fields = null;
     }
     //暂时disable 用户选择返回字段
     $params->fields = 'count';
     //广告查看次数
     if ($params->query) {
         $params->query = preg_replace('/cityEnglishName:chengdou/', 'cityEnglishName:chengdu', $params->query);
     }
     //补丁,客户端把成都误写成chengdou
     if ($params->titleKeyword) {
         unset($params['titleKeyword']);
     }
     if ($params->nearby) {
         \InstantCounter::count('listing_nearby_' . $params->api_key);
         $params->nearby = null;
         $ads = Ad::ad_nearby($params);
     } else {
         \InstantCounter::count('listing_other_' . $params->api_key);
         $ads = Ad::ad_list($params);
     }
     $ads = self::convertAdList($ads);
     self::prepare_log_ad_list($params, 'succ');
     return $ads;
 }