Esempio n. 1
0
 /**
  * 金铺-精选房源设置页面
  *
  * @param int $brokerId
  * @param int $cityId
  * @param int $houseId
  * @param array $params
  *
  * @return array
  */
 public static function esf_setting($brokerId, $cityId, $houseId, $userId, $params = array())
 {
     $pageAttribute = array();
     //获取精选推广预算
     $brokerInfo = Bll_BrokerBaseBll::get_instance()->get_broker_info($brokerId);
     $brokerCompanyId = $brokerInfo['BaseInfo']['COMPANYID'];
     $choiceSet = APF::get_instance()->get_config('choice_set');
     //根据经纪人公司不同有不同的预算
     if (isset($choiceSet[$brokerCompanyId]) && !empty($choiceSet[$brokerCompanyId])) {
         $pageAttribute['min_budget'] = $choiceSet[$brokerCompanyId]['ajk']['ESF_CHOICE_MIN_BUDGET'];
         $pageAttribute['max_budget'] = $choiceSet[$brokerCompanyId]['ajk']['ESF_CHOICE_MAX_BUDGET'];
     } else {
         $pageAttribute['min_budget'] = $choiceSet['default']['ajk']['ESF_CHOICE_MIN_BUDGET'];
         $pageAttribute['max_budget'] = $choiceSet['default']['ajk']['ESF_CHOICE_MAX_BUDGET'];
     }
     self::setChoiceNum($cityId);
     //判断当前经纪人已经精选推广的房源数
     if (isset($params['act']) && isset($params['rebid'])) {
         if (self::checkEsfBidChoiceFull($brokerId, $cityId, 1)) {
             //检查二手房精选是否达到最大
             return array('err_no' => self::BID_FAIL_OTHER, 'err_msg' => '最多精选推广' . self::$all_esf_plan_num . '套房源');
         }
     } else {
         if (self::checkEsfBidChoiceFull($brokerId, $cityId)) {
             return array('err_no' => self::BID_FAIL_OTHER, 'err_msg' => '最多精选推广' . self::$all_esf_plan_num . '套房源');
         }
     }
     /** 经纪人重新推广房源 */
     if (isset($params['act']) && isset($params['rebid'])) {
         //在精选管理页就已经设置时候是重新推广
         $planInfo = Model_Plan_EsfAjkPropSpread::getChoicePlanInfoByHouseid($houseId);
         if ($planInfo->status == Model_Plan_EsfAjkPropSpread::ONLINE || $planInfo->status == Model_Plan_EsfAjkPropSpread::ONQUEUE) {
             return array('err_no' => self::BID_FAIL_OTHER, 'err_msg' => '房源已经精选');
         }
         $pageAttribute['plan_id'] = $params['plan_id'];
         $pageAttribute['rebid'] = true;
     }
     $balance = self::get_broker_balance_by_broker_id($brokerId);
     //获取经纪人账户余额
     $pageAttribute['balance'] = $balance;
     if ($balance > 0) {
         $balance = sprintf('%.2f', $balance / 100);
     }
     $pageAttribute['balance_fmt'] = $balance;
     //获取房源信息
     $pageAttribute['housesInfo'] = Bll_House_EsfHouse::getHouseBaseInfo($houseId, $cityId);
     if (empty($pageAttribute['housesInfo'])) {
         return array('err_no' => self::BID_FAIL_OTHER, 'err_msg' => '房源不存在!');
     }
     $houseInfo = $pageAttribute['housesInfo'][0];
     if ($houseInfo->userId != $userId) {
         return array('err_no' => self::BID_FAIL_QUALITY_OR_NEW, 'err_msg' => '房源不属于当前操作人');
     }
     if ($houseInfo->isVisible != 1) {
         return array('err_no' => self::BID_FAIL_QUALITY_OR_NEW, 'err_msg' => '房源是违规房源,不可以参加精选房源推广');
     }
     if ($houseInfo->isHighQulity == 0) {
         return array('err_no' => self::BID_FAIL_QUALITY_OR_NEW, 'err_msg' => '多图、新发15天房源才能参与精选推广');
     }
     if (date('Ymd', strtotime('-15 days')) > date('Ymd', $houseInfo->postDate)) {
         return array('err_no' => self::BID_FAIL_QUALITY_OR_NEW, 'err_msg' => '多图、新发15天房源才能参与精选推广');
     }
     /** 判断是否是精选开放城市 */
     if (!Bll_City::isChoiceIndependentCity($cityId, Const_Site::ANJUKE)) {
         /** 判断是在套餐推广中 */
         $houseState = Bll_Combo_HouseRelation::getOnlineRelationByHouseId($houseId, Bll_Combo_HouseRelation::SITE_TYPE_AJK);
         if (empty($houseState)) {
             return array('err_no' => self::BID_FAIL_QUALITY_OR_NEW, 'err_msg' => '该房源不在推广中');
         }
     }
     //判断是否已在竞价计划中
     $planInfo = Model_Plan_EsfAjkPropSpread::getChoicePlanInfoByHouseid($houseId);
     if (!empty($planInfo) && !isset($params['act']) && !isset($params['rebid'])) {
         return array('err_no' => self::BID_FAIL_OTHER, 'err_msg' => '房源已经精选');
     }
     $pageAttribute['title'] = sprintf("%s,%d室%d厅%d卫,%d平,%.2f万", $houseInfo->commName, $houseInfo->roomNum, $houseInfo->hallNum, $houseInfo->toiletNum, intval($houseInfo->areaNum), $houseInfo->proPrice);
     $pageAttribute['community_name'] = $houseInfo->commName;
     $housePrice = intval($houseInfo->proPrice * 10000);
     //获取坑位信息
     $bucketInfo = Bll_Choice_EsfBidBucket::get_bucket_info($houseInfo->commId, $cityId, $housePrice);
     //获取坑位信息
     if (empty($bucketInfo)) {
         Bll_Choice_EsfBidBucket::init_bucket_info($houseInfo->commId, $cityId, $housePrice);
         $bucketInfo = Bll_Choice_EsfBidBucket::get_bucket_info($houseInfo->commId, $cityId, $housePrice);
     }
     if ($bucketInfo['usedNum'] < $bucketInfo['maxOnlineNum']) {
         $pageAttribute['hidden']['show'] = 1;
     }
     $pageAttribute['bucket_total'] = $bucketInfo['totalNum'];
     $pageAttribute['bucket_used'] = $bucketInfo['usedNum'];
     $pageAttribute['bucket_used_num'] = $bucketInfo['usedNum'];
     $pageAttribute['bucket_total_num'] = $bucketInfo['totalNum'];
     $pageAttribute['bucket_max_online_num'] = $bucketInfo['maxOnlineNum'];
     $priceInfo = Model_House_EsfPrice::get_price_by_id($bucketInfo['priceId']);
     $pageAttribute['price_title'] = sprintf("%d-%d万", intval($priceInfo['minPrice'] / 10000), intval($priceInfo['maxPrice'] / 10000));
     //价格
     $clickPrice = Bll_Service_Choice::ajkClickPrice(array('brokerId' => $brokerId, 'cityId' => $cityId, 'price' => $housePrice, 'commId' => $houseInfo->commId));
     if ($clickPrice['status'] == 'error') {
         return array('err_no' => self::BID_FAIL_OTHER, 'err_msg' => '服务器繁忙,请重试(code: -' . __LINE__ . ')');
     }
     if ($clickPrice['realTradeAmount'] != $clickPrice['shouldTradeAmount']) {
         $pageAttribute['favorable'] = true;
         $pageAttribute['price'] = round($clickPrice['realTradeAmount'] / 100, 2);
         $pageAttribute['origin_price'] = round($clickPrice['shouldTradeAmount'] / 100, 2);
         $pageAttribute['favorable_end_time'] = date('Y-m-d', strtotime($clickPrice['rebateEndTime']));
     } else {
         $pageAttribute['favorable'] = false;
         $pageAttribute['price'] = round($clickPrice['realTradeAmount'] / 100, 2);
     }
     $clickAndBudget = Bll_Choice_EsfBidBucket::getBucketAverageClickBudget($houseInfo->commId, $cityId, $housePrice);
     //获取坑位的平均点击的预算
     if (!empty($clickAndBudget)) {
         $pageAttribute['averageClick'] = $clickAndBudget['averageClick'];
         $pageAttribute['averageBudget'] = $clickAndBudget['averageBudget'] / 100;
     }
     /**重组板块精选url**/
     $bidPlanList = Bll_Plan_Bid_AjkPlan::getBrokerValidPlanListByhouseId($houseId, $brokerId, $cityId, true);
     //板块加价格
     $bidPlanList = $bidPlanList[0];
     if (isset($bidPlanList)) {
         $blockInfo['bidStatus'] = $bidPlanList['status'];
         if ($bidPlanList['status'] == 1) {
             $bidUrl = '/ajkbroker/user/choice/manage/ajk/#' . $houseId;
         } elseif ($bidPlanList['status'] == 11) {
             $bidUrl = '/ajkbroker/user/choice/manage/ajk/#' . $houseId;
         } else {
             if ($bidPlanList['status'] != 2) {
                 $bidUrl = "/ajkbroker/user/choice/blockset/ajk/" . $houseInfo['proId'] . '/?act=1&rebid=1&plan_id=' . $bidPlanList['id'];
             }
         }
     } else {
         $bidUrl = "/ajkbroker/user/choice/blockset/ajk/" . $houseInfo['proId'];
     }
     $pageAttribute['bidUrl'] = $bidUrl;
     return $pageAttribute;
 }
Esempio n. 2
0
 public static function extendChoiceInfo($fixHouseList, $choiceHouseList, $cityId)
 {
     $priceSegmentList = Model_House_EsfPrice::getAllPriceInterval($cityId, Model_House_EsfPrice::TRADE_TYPE_SALE);
     // TODO 附加精选相关的信息 精选链接 精选提示
     foreach ($fixHouseList as $houseId => &$houseInfo) {
         $houseInfo['choiceNotice'] = '';
         if (isset($choiceHouseList[$houseId])) {
             $houseInfo['bidStatus'] = $choiceHouseList[$houseId]['status'];
             if ($choiceHouseList[$houseId]['status'] == 1) {
                 $houseInfo['bidUrl'] = '/ajkbroker/user/choice/manage/ajk/#' . $houseId;
                 $houseInfo['choiceNotice'] = '已精选';
                 continue;
             } elseif ($choiceHouseList[$houseId]['status'] == 11) {
                 $houseInfo['bidUrl'] = '/ajkbroker/user/choice/manage/ajk/#' . $houseId;
                 $houseInfo['choiceNotice'] = '排队中';
                 continue;
             } else {
                 if ($choiceHouseList[$houseId]['status'] != 2) {
                     $houseInfo['bidUrl'] = "/ajkbroker/user/choice/set/ajk/" . $houseInfo['proId'] . '/?act=1&rebid=1&plan_id=' . $choiceHouseList[$houseId]['id'];
                 }
                 $houseInfo['choiceNotice'] = $houseInfo['expiredDay'] >= 75 ? '可精选' : '';
             }
         }
         if (!$houseInfo['isHighQulity']) {
             continue;
         }
         if ($houseInfo['expiredDay'] < 75) {
             continue;
         }
         $houseInfo['choiceNotice'] = '可精选';
         foreach ($priceSegmentList as $priceSegment) {
             $housePrice = $houseInfo['proPrice'] * 10000;
             if ($priceSegment['minPrice'] < $housePrice && $housePrice <= $priceSegment['maxPrice']) {
                 $houseInfo['proPriceId'] = $priceSegment['id'];
                 break;
             }
         }
         $bucketInfo = Bll_Choice_EsfBidBucket::getBucketInfo($houseInfo['commId'], $houseInfo['cityId'], $houseInfo['proPriceId']);
         // $bucketInfo = Bll_Choice_EsfBidBucket::get_bucket_info($houseInfo['commId'], $houseInfo['cityId'], $houseInfo['proPriceInt']);
         if (false === $bucketInfo || empty($bucketInfo)) {
             continue;
         }
         if ($bucketInfo['usedNum'] == $bucketInfo['totalNum']) {
             $houseInfo['choiceNotice'] = '已排满';
         } elseif ($bucketInfo['usedNum'] < $bucketInfo['totalNum'] && $bucketInfo['usedNum'] >= $bucketInfo['maxOnlineNum']) {
             $houseInfo['choiceNotice'] = '可排队';
         } else {
             $houseInfo['choiceNotice'] = '可精选';
         }
     }
     return $fixHouseList;
 }
Esempio n. 3
0
 /**
  * 获取二手房的坑位信息
  *
  * @param array $params
  * @return array
  */
 private function do_bucket_info_ajk($params)
 {
     $request = APF::get_instance()->get_request();
     $cityId = $request->getBrokerCityId();
     $pageAttribute['housesInfo'] = Bll_House_EsfHouse::getHouseBaseInfo($params['prop_id'], $cityId);
     if (empty($pageAttribute['housesInfo'])) {
         return array('error_code' => -1, 'error_message' => '房源不存在!');
     }
     $propInfo = $pageAttribute['housesInfo'][0];
     $housePrice = intval($propInfo->proPrice * 10000);
     $commId = $propInfo->commId;
     $bucketInfo = Bll_Choice_EsfBidBucket::get_bucket_info($commId, $cityId, $housePrice);
     if (false === $bucketInfo) {
         return array('error' => -1, 'msg' => '板块价格段不存在。', 'price' => $housePrice);
     }
     if (empty($bucketInfo)) {
         return array('error' => -1, 'msg' => '当前板块没有展示位。', 'commId' => $commId);
     }
     return array('error' => 0, 'bucket' => $bucketInfo);
 }
Esempio n. 4
0
 /**
  * 获取精选状态和精选推荐
  * @param $priceSegmentList
  * @param $propSpreadInfo
  * @param $prop
  * @param int $cityIsChoice
  * @param int $cityIsChoiceIndependent
  * @return array
  */
 public static function getEsfChoiceStatusAndRecommend($priceSegmentList, $propSpreadInfo, $prop, $cityIsChoice = 0, $cityIsChoiceIndependent = 0)
 {
     $proPriceId = 0;
     $result = array('choiceStatus' => 0, 'choiceStatusName' => '', 'choiceRecommend' => 0);
     if (empty($prop) || !$cityIsChoice) {
         return $result;
     }
     //计算expiredDay
     $housePostTime = strtotime(date('Y-m-d 00:00:00', $prop['postDate']));
     $currentTimestamp = strtotime(date('Y-m-d 00:00:00'));
     $expiredDay = max(0, 90 - floor(($currentTimestamp - $housePostTime) / 86400));
     //精选状态: 可精选;可排队;精选中;排队中
     if (!empty($propSpreadInfo)) {
         if ($propSpreadInfo[$prop['proId']]->status == 1) {
             $result['choiceStatus'] = 3;
             $result['choiceStatusName'] = '精选中';
             return $result;
         } elseif ($propSpreadInfo[$prop['proId']]->status == 11) {
             $result['choiceStatus'] = 4;
             $result['choiceStatusName'] = '排队中';
             return $result;
         }
     }
     if ($prop['isHighQulity'] && $expiredDay >= 75) {
         $result['choiceStatus'] = 1;
         $result['choiceStatusName'] = '可精选';
         //修正价格段ID
         foreach ($priceSegmentList as $priceSegment) {
             $propPrice = $prop['proPrice'] * 10000;
             if ($priceSegment['minPrice'] < $propPrice && $propPrice <= $priceSegment['maxPrice']) {
                 $proPriceId = $priceSegment['id'];
                 break;
             }
         }
         $bucketInfo = Bll_Choice_EsfBidBucket::getBucketInfo($prop['commId'], $prop['cityId'], $proPriceId);
         if (false === $bucketInfo || empty($bucketInfo)) {
             return $result;
         }
         if ($bucketInfo['usedNum'] == $bucketInfo['totalNum']) {
             $result['choiceStatus'] = 0;
             $result['choiceStatusName'] = '';
         } elseif ($bucketInfo['usedNum'] < $bucketInfo['totalNum'] && $bucketInfo['usedNum'] >= $bucketInfo['maxOnlineNum']) {
             $result['choiceStatus'] = 2;
             $result['choiceStatusName'] = '可排队';
         }
         //精选推荐:低价>促销(折扣)>推荐(主营、热门、抢置顶);只有可精选,可排队的房源才有精选推荐;
         if (($bucket = $bucketInfo['usedNum'] < $bucketInfo['maxOnlineNum']) == true) {
             $markList = Bll_Stats_BrokerMark::getLastRowByCommIdAndSpId($prop['commId'], $proPriceId);
             if (!empty($markList)) {
                 $markListByType = array();
                 foreach ($markList as $mark) {
                     $markListByType[$mark['type']] = $mark;
                 }
                 if (isset($markListByType[1]) && $markListByType[1]['type'] == 1) {
                     $result['choiceRecommend'] = 1;
                 }
                 if (isset($markListByType[2]) && $markListByType[2]['type'] == 2) {
                     $result['choiceRecommend'] = 2;
                 }
                 if (isset($markListByType[3]) && $markListByType[3]['type'] == 3) {
                     $result['choiceRecommend'] = 3;
                 }
             }
         }
     }
     //如果是待推广房源,并且该城市套餐精选未分离,则不能有‘可精选’’可排队‘,精选推荐也必须为0
     if (empty($propSpreadInfo)) {
         if (!$cityIsChoiceIndependent) {
             $result['choiceRecommend'] = 0;
             if ($result['choiceStatus'] == 1 || $result['choiceStatus'] == 2) {
                 $result['choiceStatus'] = 0;
                 $result['choiceStatusName'] = '';
             }
         }
     }
     return $result;
 }
Esempio n. 5
0
 public function handle_request_internal()
 {
     /**
      * @var $request AJKRequest
      */
     $request = APF::get_instance()->get_request();
     /**
      * @var $response AJKResponse
      */
     $response = APF::get_instance()->get_response();
     $response->set_content_type('application/json', 'utf-8');
     $houseIds = $request->get_parameter('houseIds');
     if (empty($houseIds)) {
         echo json_encode($this->buildResponse('error', null, '请输入房源ID'));
         return;
     }
     if (!is_array($houseIds)) {
         $houseIds = explode(',', $houseIds);
     }
     $brokerId = static::$intBrokerID;
     $cityId = static::$intBrokerCityID;
     if (!Bll_City::isChoiceCity($cityId)) {
         echo json_encode($this->buildResponse('error', null, '只有精选城市才有这个功能'));
         return;
     }
     /**  获取房源信息 */
     $tempHouseBaseInfoList = Bll_House_EsfHouse::getHouseInfoByHouseIdEx($brokerId, $houseIds, $cityId, array('proId', 'commId', 'proPriceId', 'proPrice', 'isVisible', 'isHighQulity', 'postDate'));
     /** 过滤掉不能精选的房源 */
     $houseBaseInfoList = $this->filterCanChoiceHouseList($tempHouseBaseInfoList);
     if (empty($houseBaseInfoList)) {
         echo json_encode($this->buildResponse('error', null, '没有获取到房源信息'));
         return;
     }
     /** 房源的精选推广状态 */
     $houseChoiceStateList = $this->initHouseChoiceState($houseIds);
     /** 获取城市价格段信息 */
     $priceSegmentList = Model_House_EsfPrice::getAllPriceInterval($cityId, Model_House_EsfPrice::TRADE_TYPE_SALE);
     if (empty($priceSegmentList)) {
         echo json_encode($this->buildResponse('error', null, '获取城市房源价格段信息失败'));
         return;
     }
     /** 修正房源价格段ID, 对房源按小区和价格段ID分组 */
     $groupCommunityPriceSegmentList = $this->groupCommunityPriceSegment($houseBaseInfoList, $priceSegmentList);
     /** 获取坑位信息  */
     $bucketInfoList = array();
     foreach ($groupCommunityPriceSegmentList as $key => $propIds) {
         list($communityId, $priceId) = explode('_', $key);
         $bucketInfo = Bll_Choice_EsfBidBucket::getBucketInfo($communityId, $cityId, $priceId);
         $bucketInfoList[$key] = $bucketInfo['usedNum'] < $bucketInfo['maxOnlineNum'];
     }
     //优先说明  3=低价 2=促销 1=推荐  低价>促销(折扣)>推荐(主营、热门、抢置顶)
     $brokerMarkHouseIds = $this->initBrokerMarkHouse($groupCommunityPriceSegmentList, $bucketInfoList);
     $result = array();
     foreach ($houseIds as $key => $houseId) {
         if (!isset($brokerMarkHouseIds[$houseId])) {
             continue;
         }
         $reasonStr = '';
         // from来源初始化
         $query = array('from' => '');
         if ($brokerMarkHouseIds[$houseId]['type'] == 1) {
             //推荐房源
             $query['from'] = 'recommendsite';
             if (!empty($brokerMarkHouseIds[$houseId]['rc_reason'])) {
                 switch ($brokerMarkHouseIds[$houseId]['rc_reason']) {
                     case 1:
                         $reasonStr = '主营小区';
                         break;
                     case 2:
                         $reasonStr = '热门小区';
                         break;
                     case 3:
                         $reasonStr = '精选即可置顶';
                         break;
                     case 4:
                         $reasonStr = '主营、热门小区';
                         break;
                     case 5:
                         $reasonStr = '主营、精选即可置顶';
                         break;
                     case 6:
                         $reasonStr = '热门、精选即可置顶';
                         break;
                     case 7:
                         $reasonStr = '主营、热门、精选即可置顶';
                         break;
                 }
             }
         } elseif ($brokerMarkHouseIds[$houseId]['type'] == 2) {
             //促销房源
             $query['from'] = 'promotionsite';
             if (!empty($brokerMarkHouseIds[$houseId]['zhekou'])) {
                 $zk = $brokerMarkHouseIds[$houseId]['zhekou'] / 10;
                 $reasonStr = '限时降价' . $zk . '折';
             } else {
                 $reasonStr = '限时降价';
             }
         } elseif ($brokerMarkHouseIds[$houseId]['type'] == 3) {
             //低价房源
             $query['from'] = 'lowpricesite';
             $reasonStr = '价格便宜';
         }
         if ($houseChoiceStateList[$houseId] > 0) {
             $query['act'] = 1;
             $query['rebid'] = 1;
             $query['plan_id'] = $houseChoiceStateList[$houseId];
         }
         $result[$key] = array('id' => $houseId, 'url' => sprintf('/ajkbroker/user/choice/set/ajk/%d/?%s', $houseId, http_build_query($query)), 'recommend' => $brokerMarkHouseIds[$houseId]['type']);
         $result[$key]['reason'] = $reasonStr;
     }
     if (count($result) > 15) {
         $resultSlice = array_slice($result, 0, 15);
     } else {
         $resultSlice = $result;
     }
     foreach ($resultSlice as $key => $val) {
         if ($houseChoiceStateList[$val['id']] == -1) {
             unset($resultSlice[$key]);
         }
     }
     $params = array();
     foreach ($resultSlice as $key => $val) {
         if ($brokerMarkHouseIds[$val['id']]['type'] == 1) {
             //推荐房源
             $rcReason = $brokerMarkHouseIds[$val['id']]['rc_reason'];
         } elseif ($brokerMarkHouseIds[$val['id']]['type'] == 2) {
             //促销房源
             $rcReason = '折扣';
         } elseif ($brokerMarkHouseIds[$val['id']]['type'] == 3) {
             //低价房源
             $rcReason = '';
         }
         $params[] = array('brokerId' => $brokerId, 'cityId' => $cityId, 'proId' => $val['id'], 'type' => $val['recommend'], 'rcReason' => $rcReason, 'createTime' => $brokerMarkHouseIds[$val['id']]['createTime']);
     }
     if (!empty($params)) {
         $params = json_encode($params);
         APF::get_instance()->get_nlogger()->log('brokerMark', $params, true);
     }
     echo json_encode($this->buildResponse('ok', array_values($resultSlice), ''));
 }
Esempio n. 6
0
 public function handle_request_internal()
 {
     /**
      * @var $request AJKRequest
      */
     $request = APF::get_instance()->get_request();
     /**
      * @var $response AJKResponse
      */
     $response = APF::get_instance()->get_response();
     $response->set_content_type('application/json', 'utf-8');
     $houseIds = $request->get_parameter('houseIds');
     if (empty($houseIds)) {
         echo json_encode($this->buildResponse('error', null, '请输入房源ID'));
         return;
     }
     if (!is_array($houseIds)) {
         $houseIds = explode(',', $houseIds);
     }
     $brokerId = static::$intBrokerID;
     $cityId = static::$intBrokerCityID;
     if (!Bll_City::isChoiceCity($cityId)) {
         echo json_encode($this->buildResponse('error', null, '只有精选城市才有这个功能'));
         return;
     }
     /**  获取房源信息 */
     $tempHouseBaseInfoList = Bll_House_EsfHouse::getHouseInfoByHouseIdEx($brokerId, $houseIds, $cityId, array('proId', 'commId', 'proPriceId', 'proPrice', 'isVisible', 'isHighQulity', 'postDate'));
     /** 过滤掉不能精选的房源 */
     $houseBaseInfoList = $this->filterCanChoiceHouseList($tempHouseBaseInfoList);
     if (empty($houseBaseInfoList)) {
         echo json_encode($this->buildResponse('error', null, '没有获取到房源信息'));
         return;
     }
     /** 房源的精选推广状态 */
     $houseChoiceStateList = $this->initHouseChoiceState($houseIds);
     /** 获取城市价格段信息 */
     $priceSegmentList = Model_House_EsfPrice::getAllPriceInterval($cityId, Model_House_EsfPrice::TRADE_TYPE_SALE);
     if (empty($priceSegmentList)) {
         echo json_encode($this->buildResponse('error', null, '获取城市房源价格段信息失败'));
         return;
     }
     /** 修正房源价格段ID, 对房源按小区和价格段ID分组 */
     $groupCommunityPriceSegmentList = $this->groupCommunityPriceSegment($houseBaseInfoList, $priceSegmentList);
     /** 获取坑位休息  */
     $bucketInfoList = array();
     foreach ($groupCommunityPriceSegmentList as $key => $propIds) {
         list($communityId, $priceId) = explode('_', $key);
         $bucketInfo = Bll_Choice_EsfBidBucket::getBucketInfo($communityId, $cityId, $priceId);
         $bucketInfoList[$key] = $bucketInfo['usedNum'] < $bucketInfo['maxOnlineNum'];
     }
     //优先说明,一元精选 > 抢置顶 > 最划算
     /** 一元精选房源 */
     $unitaryHouseIds = $this->initUnitaryHouse($groupCommunityPriceSegmentList, $bucketInfoList);
     /** 抢置顶房源 */
     $topHouseIds = $this->initTopHouse($groupCommunityPriceSegmentList, $bucketInfoList);
     /** 最划算房源 */
     $cheapestHouseIds = $this->initCheapestHouse($groupCommunityPriceSegmentList, $bucketInfoList);
     //合并数据 + 数组的值去重
     $unitaryTopCheapHouseIds = array_unique(array_merge($unitaryHouseIds, $cheapestHouseIds, $topHouseIds));
     $result = array();
     foreach ($unitaryTopCheapHouseIds as $HouseId) {
         if ($houseChoiceStateList[$HouseId] == -1) {
             continue;
         }
         // recommend、from来源初始化
         $query = array('from' => '');
         $recommend = -1;
         if (in_array($HouseId, $unitaryHouseIds)) {
             //一元精选房源
             $query['from'] = 'unitarysite';
             $recommend = 3;
         } elseif (in_array($HouseId, $topHouseIds)) {
             //抢置顶房源
             $query['from'] = 'topsite';
             $recommend = 1;
         } elseif (in_array($HouseId, $cheapestHouseIds)) {
             //最划算房源
             $query['from'] = 'cheapsite';
             $recommend = 2;
         }
         if ($houseChoiceStateList[$HouseId] > 0) {
             $query['act'] = 1;
             $query['rebid'] = 1;
             $query['plan_id'] = $houseChoiceStateList[$HouseId];
         }
         $result[] = array('id' => $HouseId, 'url' => sprintf('/ajkbroker/user/choice/set/ajk/%d/?%s', $HouseId, http_build_query($query)), 'recommend' => $recommend);
     }
     echo json_encode($this->buildResponse('ok', array_values($result), ''));
 }