public function handle_request_internal() { $brokerId = $this->_params['brokerId']; $propId = $this->_params['propId']; //检查经纪人是否存在 $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId); if (!$brokerInfo) { throw new Exception_Broker_NotFound('BrokerId: ' . $brokerId); } // 判断城市是否开通竞价业务 $cityId = $brokerInfo->cityId; if (!Bll_City::isBidCity($cityId)) { throw new Exception_City_NotBidCity('CityId: ' . $cityId); } //房子的竞价计划 $bidPlan = Model_Plan_EsfAjkPropSpread::getBidPlanInfoByHouseid($propId); if (empty($bidPlan)) { //房源信息 $propInfo = Bll_House_EsfHouse::getHouseBaseInfo($propId, $brokerInfo->cityId); if (!$propInfo[0]->isHighQulity) { throw new Exception_Property_NotMultiImages("Anjuke propId: {$propId}"); } throw new Exception_BidPlan_NotFound('PropId: ' . $propId); } //房源总点击 $bidClickInfo = Model_Plan_HpProStatsDay::getPropClicks($propId, $brokerInfo->cityId); $data = array(); $data['totalClicks'] = $bidClickInfo[$propId]['totalClicks']; //房源竞价总点击 $data['todayClicks'] = Model_plan_HpProStatsDay::getPropClickByDate($propId, $cityId, date('Ymd')); //今日点击 $data['planId'] = $bidPlan->id; $priceInfo = Model_House_EsfPrice::get_price($cityId, $bidPlan->propriceint); $data['minClickPrice'] = $priceInfo['vPrice']; //最小出价 $data['minClickPriceUnit'] = '元'; //最小出价 //推广中 排队中 if ($bidPlan->status == Model_Plan_EsfAjkPropSpread::ONLINE || $bidPlan->status == Model_Plan_EsfAjkPropSpread::ONQUEUE) { $data['planStatus'] = 1; // 推广中 or 排队中 $data['budget'] = $bidPlan->budget / 100; //预算 $data['budgetUnit'] = '元'; $consume = Model_plan_HpProStatsDay::getPlanAmounts($bidPlan->id, $cityId); $data['budgetRemain'] = ($bidPlan->budget - $consume) / 100; $data['budgetRemainUnit'] = '元'; $data['clickPrice'] = $bidPlan->offer / 100; //出价 $data['clickPriceUnit'] = '元'; $data['rankMsg'] = '排队中'; if ($bidPlan->status == Model_Plan_EsfAjkPropSpread::ONLINE) { //排名 $data['rank'] = $this->getPpcSaleRankBll($propId, $bidPlan->commId, $bidPlan->smallprice, $bidPlan->bigprice, $bidPlan->commsHpratioA, 3); $data['rankMsg'] = '推广中'; } } else { $data['planStatus'] = 2; //已暂停 $data['budget'] = 0; $data['budgetUnit'] = '元'; $data['budgetRemain'] = 0; $data['budgetRemainUnit'] = '元'; $data['clickPrice'] = 0; $data['clickPriceUnit'] = '元'; $data['rankMsg'] = '已暂停'; } return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => $data); }