예제 #1
0
 public function handle_request_combo()
 {
     $brokerId = $this->brokerId;
     $cityId = $this->cityId;
     $hzBrokerId = Bll_HzBroker::get_brokerid_by_ajk_brokerid($brokerId);
     //获取所有有效房源
     $props = Bll_House_HzHouse::getValidPropsByBrokerId($hzBrokerId, $cityId);
     $propertyList = array();
     if (!empty($props)) {
         //获取套餐推广房源列表
         $comboList = Bll_Combo_HouseRelation::getHouseRelations($brokerId, Bll_Combo_HouseRelation::SITE_TYPE_HZ, 1);
         //所有有效房源-套餐推广房源 = 套餐未推广房源
         if (!empty($comboList)) {
             foreach ($comboList as $row) {
                 unset($props[$row['houseId']]);
             }
         }
         if (!empty($props)) {
             // 批量获取房源的默认图片
             $defaultImages = Model_Image_HzImage::getDefaultImagesByHouseIds(array_keys($props));
             if (!empty($defaultImages)) {
                 foreach ($defaultImages as $defaultImage) {
                     $props[$defaultImage['proid']]['imgUrl'] = $defaultImage->imageUrl();
                 }
             }
             foreach ($props as $list) {
                 $row = array();
                 $row['id'] = $row['propId'] = $list['propId'];
                 $row['title'] = $list['title'];
                 $row['imgUrl'] = $list['imgUrl'] ?: '';
                 $row['commId'] = $list['commid'];
                 $row['commName'] = $list['commname'];
                 $row['roomNum'] = $list['roomnum'];
                 $row['hallNum'] = $list['hallnum'];
                 $row['toiletNum'] = $list['toilnetnum'];
                 $row['area'] = round($list['areanum']);
                 $row['price'] = round($list['pricenum']);
                 $row['priceUnit'] = '元/月';
                 $row['todayClicks'] = $row['totalClicks'] = $row['isBid'] = $row['isChoice'] = 0;
                 $row['isVisible'] = (int) ($list['status'] != 6);
                 $row['isMoreImg'] = (int) $list['quality'];
                 $row['isPhonePub'] = (int) (isset($list['from']) && $list['from'] == 'mobile-ajk-broker');
                 $isEntrust = Bll_Zufang_Choice::isCommissionHouse($list['propId'], $brokerId, Model_House_Commission::TYPE_RENT);
                 $row['isEntrust'] = $isEntrust ? 1 : 0;
                 $row['createTime'] = date('Y-m-d H:i:s', $list['created']);
                 $propertyList[] = $row;
             }
         }
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('propertyList' => $propertyList));
 }
예제 #2
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $cityId = $this->_params['cityId'];
     // 获取未推广房源列表
     $hzBrokerId = Bll_HzBroker::get_brokerid_by_ajk_brokerid($brokerId);
     //APP套餐城市调错API了 需要做一下套餐城市的兼容处理
     $isComboBroker = Bll_Broker_HzBroker::isComboBroker($brokerId);
     if (!$isComboBroker) {
         $props = Bll_HzFixPlan::get_outline_list($hzBrokerId, $cityId, 1);
         $propIds = array();
         $propertyList = array();
         foreach ($props as $prop) {
             $propId = $prop['proid'];
             $propIds[] = $propId;
             $row = array();
             $row['propId'] = $row['id'] = $propId;
             $row['title'] = $prop['content_basic']['title'];
             $row['imgUrl'] = '';
             $row['commId'] = $prop['content_basic']['commid'];
             $row['commName'] = $prop['content_basic']['commname'];
             $row['roomNum'] = $prop['content_basic']['roomnum'];
             $row['hallNum'] = $prop['content_basic']['hallnum'];
             $row['toiletNum'] = $prop['content_basic']['toilnetnum'];
             $row['area'] = round($prop['content_basic']['areanum']);
             $row['price'] = round($prop['content_basic']['pricenum']);
             $row['priceUnit'] = '元/月';
             $row['isBid'] = 0;
             $row['isChoice'] = 0;
             $row['isVisible'] = intval($prop['content_basic']['status'] != 6);
             $row['isMoreImg'] = intval($prop['content_basic']['quality']);
             $row['isPhonePub'] = intval(isset($prop['content_basic']['from']) && $prop['content_basic']['from'] == 'mobile-ajk-broker');
             $row['publishDays'] = floor((time() - $prop['content_basic']['created']) / 86400);
             $row['publishDaysMsg'] = $row['publishDays'] > 0 ? "{$row['publishDays']}天前发布" : '今天发布';
             $row['createTime'] = date('Y-m-d H:i:s', $prop['content_basic']['created']);
             $row['updateTime'] = date('Y-m-d H:i:s', $prop['content_basic']['updated']);
             //增加委托房源标签
             $isEntrust = Bll_Zufang_Choice::isCommissionHouse($propId, $brokerId, Model_House_Commission::TYPE_RENT);
             $row['isEntrust'] = $isEntrust ? 1 : 0;
             $propertyList[$propId] = $row;
         }
         if ($propIds) {
             // 批量获取房源的默认图片
             $defaultImages = Model_Image_HzImage::getDefaultImagesByHouseIds($propIds);
             foreach ($defaultImages as $defaultImage) {
                 $propertyList[$defaultImage['proid']]['imgUrl'] = $defaultImage->imageUrl();
             }
         }
         $result = array();
         $result['status'] = Const_APIStatus::RETURN_CODE_OK;
         $result['data']['propertyList'] = array_values($propertyList);
         return $result;
     } else {
         //获取所有有效房源
         $props = Bll_House_HzHouse::getValidPropsByBrokerId($hzBrokerId, $cityId);
         $propertyList = array();
         if (!empty($props)) {
             //获取套餐推广房源列表
             $comboList = Bll_Combo_HouseRelation::getHouseRelations($brokerId, Bll_Combo_HouseRelation::SITE_TYPE_HZ, 1);
             //所有有效房源-套餐推广房源 = 套餐未推广房源
             if (!empty($comboList)) {
                 foreach ($comboList as $row) {
                     unset($props[$row['houseId']]);
                 }
             }
             if (!empty($props)) {
                 // 批量获取房源的默认图片
                 $defaultImages = Model_Image_HzImage::getDefaultImagesByHouseIds(array_keys($props));
                 if (!empty($defaultImages)) {
                     foreach ($defaultImages as $defaultImage) {
                         $props[$defaultImage['proid']]['imgUrl'] = $defaultImage->imageUrl();
                     }
                 }
                 foreach ($props as $list) {
                     $row = array();
                     $row['id'] = $row['propId'] = $list['propId'];
                     $row['title'] = $list['title'];
                     $row['imgUrl'] = $list['imgUrl'] ?: '';
                     $row['commId'] = $list['commid'];
                     $row['commName'] = $list['commname'];
                     $row['roomNum'] = $list['roomnum'];
                     $row['hallNum'] = $list['hallnum'];
                     $row['toiletNum'] = $list['toilnetnum'];
                     $row['area'] = round($list['areanum']);
                     $row['price'] = round($list['pricenum']);
                     $row['priceUnit'] = '元/月';
                     $row['todayClicks'] = $row['totalClicks'] = $row['isBid'] = $row['isChoice'] = 0;
                     $row['isVisible'] = (int) ($list['status'] != 6);
                     $row['isMoreImg'] = (int) $list['quality'];
                     $row['isPhonePub'] = (int) (isset($list['from']) && $list['from'] == 'mobile-ajk-broker');
                     $isEntrust = Bll_Zufang_Choice::isCommissionHouse($list['propId'], $brokerId, Model_House_Commission::TYPE_RENT);
                     $row['isEntrust'] = $isEntrust ? 1 : 0;
                     $row['createTime'] = date('Y-m-d H:i:s', $list['created']);
                     $propertyList[] = $row;
                 }
             }
         }
         return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('propertyList' => $propertyList));
     }
 }
예제 #3
0
 public function handle_request_combo()
 {
     $brokerId = $this->brokerId;
     $cityId = $this->cityId;
     $hzBrokerId = Bll_HzBroker::get_brokerid_by_ajk_brokerid($brokerId);
     //获取所有有效房源
     $props = Bll_House_HzHouse::getValidPropsByBrokerId($hzBrokerId, $cityId);
     $propertyList = array();
     if (!empty($props)) {
         //获取套餐推广房源列表
         $comboList = Bll_Combo_HouseRelation::getHouseRelations($brokerId, Bll_Combo_HouseRelation::SITE_TYPE_HZ, 1);
         //获取精选房源列表
         $bllChoice = new Bll_Zufang_Choice();
         $choices = $bllChoice->get_active_choice_plans($hzBrokerId, array(1, 13, 2, 3, 7, 8));
         $choicePropIds = array();
         if (!empty($choices)) {
             $keyedPlans = array();
             foreach ($choices as $choice) {
                 $keyedPlans[$choice->id] = $choice;
             }
             // 获取所有的房源和精选的关系
             $choiceRelations = $bllChoice->get_prop(array_keys($keyedPlans));
             foreach ($choiceRelations as $choiceRelation) {
                 $choicePropIds[] = $choiceRelation->proid;
             }
         }
         //所有有效房源-套餐推广房源-精选推广房源 = 待推广房源
         if (!empty($comboList)) {
             foreach ($comboList as $row) {
                 unset($props[$row['houseId']]);
             }
         }
         if (!empty($choicePropIds)) {
             foreach ($choicePropIds as $k => $v) {
                 unset($props[$v]);
             }
         }
         if (!empty($props)) {
             // 批量获取房源的默认图片
             $defaultImages = Model_Image_HzImage::getDefaultImagesByHouseIds(array_keys($props));
             if (!empty($defaultImages)) {
                 foreach ($defaultImages as $defaultImage) {
                     $props[$defaultImage['proid']]['imgUrl'] = $defaultImage->imageUrl();
                 }
             }
             //是否是精选城市,城市是否精选分离
             $cityIsChoice = Bll_City::isChoiceCity($cityId, Const_Site::HAOZU);
             $cityIsChoiceIndependent = Bll_City::isChoiceIndependentCity($cityId, Const_Site::HAOZU);
             foreach ($props as $list) {
                 $row = array();
                 $row['id'] = $row['propId'] = $list['propId'];
                 $row['title'] = $list['title'];
                 $row['imgUrl'] = $list['imgUrl'] ?: '';
                 $row['commId'] = $list['commid'];
                 $row['commName'] = $list['commname'];
                 $row['roomNum'] = $list['roomnum'];
                 $row['hallNum'] = $list['hallnum'];
                 $row['toiletNum'] = $list['toilnetnum'];
                 $row['area'] = round($list['areanum']);
                 $row['price'] = round($list['pricenum']);
                 $row['priceUnit'] = '元/月';
                 $row['todayClicks'] = $row['totalClicks'] = $row['isBid'] = $row['isChoice'] = 0;
                 $row['isVisible'] = (int) ($list['status'] != 6);
                 $row['isMoreImg'] = (int) $list['quality'];
                 $row['isPhonePub'] = (int) (isset($list['from']) && $list['from'] == 'mobile-ajk-broker');
                 $isEntrust = Bll_Zufang_Choice::isCommissionHouse($list['propId'], $brokerId, Model_House_Commission::TYPE_RENT);
                 $row['isEntrust'] = $isEntrust ? 1 : 0;
                 $row['createTime'] = date('Y-m-d H:i:s', $list['created']);
                 //精选状态
                 $choiceStatus = Bll_HzProp::getZuFangChoiceStatus($list, $cityId, $cityIsChoice);
                 if (!$cityIsChoiceIndependent && $choiceStatus['choiceStatus']) {
                     //城市未精选分离
                     $choiceStatus['choiceStatus'] = 0;
                     $choiceStatus['choiceStatusName'] = '';
                 }
                 $row['choiceStatus'] = $choiceStatus['choiceStatus'];
                 $row['choiceStatusName'] = $choiceStatus['choiceStatusName'];
                 $propertyList[] = $row;
             }
         }
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('propertyList' => $propertyList));
 }