コード例 #1
0
 public function handle_request_internal()
 {
     $request = APF::get_instance()->get_request();
     $houseIds = $request->get_parameter('propIds');
     /**
      * type: today, all
      */
     $type = $request->get_parameter('type');
     /**
      * plan_type: bid, fix
      */
     $planType = $request->get_parameter('plan_type');
     $rtn = array_fill_keys($houseIds, 0);
     if (strcasecmp($planType, 'fix') === 0) {
         /**
          * 定价房源点击量
          */
         if (strcasecmp($type, 'today') == 0 && !empty($houseIds)) {
             /**
              * 房源今日点击量
              */
             $date = date('Ymd');
             // $houseClickInfoList = Bll_Ppc_ServiceAPI::getHouseClickInfo($houseIds, strtotime(date('Y-m-d 00:00:00')), time(), static::$intBrokerID);
             $houseClickInfoList = Bll_Ppc_ServiceAPI::getHouseClickInfoNew(static::$intBrokerID, $houseIds, $date, $date);
             foreach ($houseClickInfoList as $houseClickInfo) {
                 $rtn[$houseClickInfo['propId']] += max(0, $houseClickInfo['clickNum']);
             }
             /**
              * 精选点击
              */
             $choiceClickList = Bll_Plan_Bid_AjkPlan::getHouseBidClick($houseIds, static::$intBrokerCityID, date('Ymd'));
             foreach ($choiceClickList as $houseId => $clickCount) {
                 $rtn[$houseId] += $clickCount;
             }
         } else {
             /**
              * 房源累计点击量
              */
             $fixPlanIdList = Bll_Plan_Fix_AjkPlan::getBrokerPlanList(static::$intBrokerID);
             if (empty($fixPlanIdList)) {
                 $rtn = array();
             } else {
                 $fixPlanId = $fixPlanIdList[0]['id'];
                 $houseClickInfoList = Bll_Ppc_ServiceAPI::propFixClickNum(static::$intBrokerID, $houseIds, $fixPlanId);
                 foreach ($houseClickInfoList as $houseClickInfo) {
                     $rtn[$houseClickInfo['propId']] = max(0, $houseClickInfo['clickNum']);
                 }
             }
             $houseChoiceClickList = Model_Choice_PropClickCount::getChoiceClickInfo(static::$intBrokerID, static::$intBrokerCityID, $houseIds);
             foreach ($houseChoiceClickList as $houseChoiceClick) {
                 $rtn[$houseChoiceClick['propId']] += $houseChoiceClick['count'];
             }
         }
     } else {
         /**
          * 竞价今日点击量
          */
         $rtn = Bll_Plan_Bid_AjkPlan::getHouseBidClick($houseIds, static::$intBrokerCityID, date('Ymd'));
     }
     echo json_encode($rtn, JSON_FORCE_OBJECT);
     return false;
 }