Esempio n. 1
0
 /**
  * @param AJKRequest $request
  * @param array $out
  * @throws Exception
  */
 public static function initEnv($request, &$out)
 {
     $out['debug'] = isset($_GET['debug']) ? true : false;
     $out['cityId'] = $request->getBrokerCityId();
     $out['ajkBrokerId'] = $request->getBrokerId();
     // 获取好租brokerId
     $out['hzBrokerId'] = Model_Broker_HzMapping::get_hz_broker_id($out['ajkBrokerId']);
     // 获取账户余额
     /*$balance = Bll_Broker_HzBroker::getAccountInfo($out['ajkBrokerId'], 'balance');
       if (!$balance['status'])
           throw new Exception_BllErrorException($balance['msg']);
       $out['validMoney'] = $balance['msg'] ? round($balance['msg'] / 100, 2) : 0;
       */
     // 是否精选
     $out['isChoiceCity'] = Bll_City::isChoiceCity($out['cityId'], Const_Site::HAOZU);
     $out['isBidCity'] = false;
     $out['isShowCaseCity'] = Bll_City::isShowCaseCity($out['cityId'], Const_Site::HAOZU);
     $out['bidTip'] = '精选';
     // 获取经纪人信息
     if (!($out['brokerInfo'] = Model_Broker_HzUsersSearch::getUserInfoByUserId($out['hzBrokerId']))) {
         throw new Exception('获取好租经纪人信息失败:hzBrokerId [' . $out['hzBrokerId'] . ']');
     }
     // 身份是否通过
     $out['isPassVerify'] = Bll_Broker_HzBroker::isPassVerify($out['brokerInfo']['profileVerify']);
     // 获取该经纪人房源
     $out['props'] = Bll_House_HzHouse::getValidPropsByBrokerIdEx($out['ajkBrokerId'], $out['cityId']);
     // 获取改经纪人所有房源质量
     //$out['propsQuality'] = Model_Stats_HzPropQuality::getPropsquality(array_keys($out['props']));
     $out['propsQuality'] = static::getHzPropsQuality($out['props']);
     if (count($out['props']) > 0) {
         foreach ($out['props'] as $proId => $prop) {
             $out['props'][$proId]['proId'] = $proId;
             // 获取剩余时间
             $out['props'][$proId]['leftDays'] = Bll_House_HzHouse::getLeftDays($prop['created']);
             // 是否手机房源
             $out['props'][$proId]['isMobileProp'] = Bll_House_HzHouse::isMobileProp($prop['from'] ? $prop['from'] : '');
         }
     }
     // 获取经纪人主推房源
     $out['mainSpreadProIds'] = array();
     $mainSpreads = Model_Broker_AdPropsShowRent::getInstance()->getBrokerAdPropInfo($out['ajkBrokerId']);
     if ($mainSpreads) {
         foreach ($mainSpreads as $v) {
             $out['mainSpreadProIds'][$v->propId] = $v->propId;
         }
     }
 }
Esempio n. 2
0
 private static function preparePropInfo(&$out)
 {
     // 获取房源
     $propResult = Bll_House_HzHouse::getPropInfo($out['proId'], $out['cityId'], 3);
     if (!$propResult['status']) {
         throw new Exception($propResult['msg']);
     }
     $propInfo = $propResult['msg'];
     // 检查并拼接违规信息
     $illegalInfo = Bll_HzProp::checkAndGetPropsIllegalInfos(array($out['proId'] => $propInfo));
     $propInfo = $illegalInfo[$out['proId']];
     // 获取剩余时间
     $propInfo['leftDays'] = Bll_House_HzHouse::getLeftDays($propInfo['created']);
     // 获取房源图片数
     $imageInfo = Bll_House_HzHouse::getPropImages($out['proId']);
     $propInfo['imageInfo'] = $imageInfo;
     // 房源默认图片 (默认优先封面图 -》 第一张室内图 -》 房型)
     //$propInfo['propDefaultImg'] = Bll_House_HzHouse::getPropDefaultImgWithUrl($out['proId']);
     $propInfo['propDefaultImg'] = self::getThumbImg($imageInfo);
     // 获取房源可优化项
     $propInfo['canImproveItems'] = self::getPropCanImproveItems($propInfo, $imageInfo);
     // 是否手机发房
     $propInfo['isMobile'] = isset($propInfo['from']) ? Bll_House_HzHouse::isMobileProp($propInfo['from']) : false;
     // 此房源全部点击数据
     $propInfo['propAllClick'] = Model_Stats_PropClick::getPropAllClicks($out['proId'], $out['hzBrokerId'], $out['cityId']);
     // 此房源全部曝光数据
     $propInfo['propAllShow'] = Bll_House_HzHouse::getPropShow($out['proId'], $out['cityId']);
     // 此房源质量
     $propQuality = Model_Stats_HzPropQuality::getPropsquality($out['proId']);
     $propInfo['propsQuality'] = $propQuality ? $propQuality[$out['proId']] : array();
     // 根据blockid 获取对应code
     $areaInfo = Model_City_HzArea::getAreaById($propInfo['blockid']);
     $propInfo['typeCode'] = $areaInfo['typeCode'];
     return $propInfo;
 }