Beispiel #1
0
 public function handle_request_internal()
 {
     /*
     @params planId :计划id
     @params resType :默认为0,0表示不取计划房源信息,1为取房源信息
     @params from :来源
     @success return 该计划id的信息
     */
     if (!isset($this->_params['brokerId'])) {
         return Util_MobileAPI::error(Const_APIStatus::E_PLAN_PARAM_BROKERID_MISS);
     }
     $brokerId = $this->_params['brokerId'];
     //根据安居客经纪人ID获取好租经纪人ID
     $brokerId_hz = Bll_HzBroker::get_brokerid_by_ajk_brokerid($brokerId);
     if ($brokerId_hz) {
         $broker_info = Dao_Broker_HzPlan::get_hzbroker_info($brokerId_hz);
         if (!Bll_City::isBidCity($broker_info['cityid'])) {
             return array('status' => 'ok', 'data' => array('propertyList' => array()));
         }
     }
     if (Bll_Broker_HzBroker::isComboBroker($brokerId)) {
         //获取套餐推广房源列表
         $comboList = Bll_Combo_HouseRelation::getHouseRelations($brokerId, Bll_Combo_HouseRelation::SITE_TYPE_HZ, 1);
         if (!empty($comboList)) {
             foreach ($comboList as $combo) {
                 $comboIds[$combo['houseId']] = 1;
             }
             //获取竞价房源 去除竞价房源
             $validBidPlans = Model_Plan_HzPlanBasic::getBidPlansByBrokerId($brokerId_hz);
             $planIds = array();
             if (!empty($validBidPlans)) {
                 foreach ($validBidPlans as $plan) {
                     if ($plan['flag'] == 1 && $plan['status'] != Const_HzPlan::DELETE) {
                         $planIds[] = $plan['id'];
                     }
                 }
                 if (!empty($planIds)) {
                     $bidPlannings = Model_Plan_HzPlanning::getPlanningByPlanIds($planIds);
                 }
                 if (!empty($bidPlannings)) {
                     foreach ($bidPlannings as $bid) {
                         unset($comboIds[$bid['proid']]);
                     }
                 }
             }
             //$propertyList = Model_House_HzProp::getPropsByPropIds(array_keys($comboIds));
             $propertyList = Dao_Broker_HzProp::get_prop(array_keys($comboIds));
             if (!empty($propertyList)) {
                 foreach ($propertyList as $key => $list) {
                     if ($list['content_basic']['quality'] != 1) {
                         unset($propertyList[$key]);
                     }
                 }
             }
             $result = $propertyList;
         } else {
             $result = array();
         }
         //去除竞价房源和非多图房源
     } else {
         $result = Bll_HzBidPlan::get_canbid_props($brokerId_hz);
     }
     $return = array();
     $return["status"] = "ok";
     $return["data"]['propertyList'] = array();
     if (!empty($result)) {
         $proprow = array();
         foreach ($result as $propertyList) {
             $proprow["id"] = $propertyList['proid'];
             $proprow["title"] = $propertyList['content_basic']['title'];
             $proprow["commId"] = $propertyList['content_basic']['commid'];
             $proprow["commName"] = $propertyList['content_basic']['commname'];
             $proprow["roomNum"] = $propertyList['content_basic']['roomnum'];
             $proprow["hallNum"] = $propertyList['content_basic']['hallnum'];
             $proprow["toiletNum"] = $propertyList['content_basic']['toilnetnum'];
             $proprow["area"] = round($propertyList['content_basic']['areanum']);
             $proprow["price"] = round($propertyList['content_basic']['pricenum']);
             $proprow["isMoreImg"] = $propertyList['content_basic']['quality'] ? 1 : 0;
             $proprow["priceUnit"] = "元";
             $return["data"]['propertyList'][] = $proprow;
             unset($proprow);
         }
         unset($result);
     }
     return $return;
 }