Example #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;
         }
     }
 }
 public function initComboZfProData($proInfos, $propMianNew, $combolist)
 {
     $data = $orderProId = array();
     $tD = date('Ymd');
     foreach ($proInfos as $proInVal) {
         $pro = array();
         $orderProId[] = $proInVal->proid;
         $pro['id'] = $proInVal->proid;
         $pro['name'] = $propMianNew[$proInVal->proid]['contentBasic']['title'];
         $pro['commName'] = Util_String::truncate($proInVal->commname, 20, '');
         $pro['area'] = $propMianNew[$proInVal->proid]['contentBasic']['areanum'];
         $roomStr = '';
         if ($propMianNew[$proInVal->proid]['contentBasic']['roomnum']) {
             $roomStr .= $propMianNew[$proInVal->proid]['contentBasic']['roomnum'] . '室';
         }
         if ($propMianNew[$proInVal->proid]['contentBasic']['hallnum']) {
             $roomStr .= $propMianNew[$proInVal->proid]['contentBasic']['hallnum'] . '厅';
         }
         $pro['houseType'] = $roomStr;
         $pro['floor'] = intval($propMianNew[$proInVal->proid]['contentBasic']['floor']);
         $pro['floorAll'] = intval($propMianNew[$proInVal->proid]['contentBasic']['totalfloor']);
         $pro['price'] = $proInVal->pricenum;
         $pro['day'] = Bll_House_HzHouse::getLeftDays($proInVal->created);
         if ($pro['day']) {
             $pro['day'] .= '天';
         } else {
             $pro['day'] = '<1天';
         }
         /*
         $createDay = date('Ymd',$proInVal->created);
         if ($tD == $createDay) {
             $pro['day'] = '新发';
         } else {
             $timeFixstr = strtotime($createDay) + 86400;
             $leftDays = 90 - floor((time() - $timeFixstr) / 86400);
             $leftDays = $leftDays > 0 ? $leftDays : 0;
             $pro['day'] = $leftDays . '天';
         }
         */
         foreach ($combolist as $val) {
             if ($val['houseId'] == $proInVal->proid) {
                 $pro['status'] = $val['state'];
             }
         }
         if (!$pro['status']) {
             $pro['status'] = 2;
         }
         $pro['rentType'] = $propMianNew[$proInVal->proid]['contentBasic']['renttype'] == 1 ? 0 : 1;
         //出租方式,0整租,1合租
         $data[] = $pro;
     }
     //根据最新发布时间排序
     array_multisort($orderProId, SORT_DESC, $data);
     return $data;
 }
Example #3
0
 /**
  * 返回必须参数(参数拼接)
  * @param $val
  * @param $propMainNew //租房扩展信息
  * @return array
  */
 public static function getZfShowInfo($val, $propMainNew)
 {
     $pro = array();
     $pro['id'] = $val['proid'];
     $pro['name'] = $propMainNew[$val['proid']]['contentBasic']['title'];
     $pro['commName'] = $val['commname'];
     $pro['area'] = $propMainNew[$val['proid']]['contentBasic']['areanum'];
     $pro['roomNum'] = $propMainNew[$val['proid']]['contentBasic']['roomnum'];
     //室
     $pro['hallNum'] = $propMainNew[$val['proid']]['contentBasic']['hallnum'];
     //厅
     $pro['toiletNum'] = $propMainNew[$val['proid']]['contentBasic']['toilnetnum'];
     //卫
     $pro['floor'] = intval($propMainNew[$val['proid']]['contentBasic']['floor']);
     $pro['floorAll'] = intval($propMainNew[$val['proid']]['contentBasic']['totalfloor']);
     $pro['price'] = $val['pricenum'];
     $pro['day'] = Bll_House_HzHouse::getLeftDays($val['created']);
     if ($pro['day']) {
         $pro['day'] .= '天';
     } else {
         $pro['day'] = '<1天';
     }
     return $pro;
 }
Example #4
0
 /**
  * 拼接租房最后房源数据
  * @param $proInfos 房源信息
  * @param $proClickInfo 房源点击量信息
  * @param $adProInfos 房源主推信息
  * @param $propMianNew 房源主表信息
  */
 private function initZfProData($proInfos, $proClickInfo, $adProInfos, $propMianNew)
 {
     $data = $orderProId = array();
     $tD = date('Ymd');
     foreach ($proInfos as $proInVal) {
         $pro = array();
         $orderProId[] = $proInVal->proid;
         $pro['id'] = $proInVal->proid;
         $pro['name'] = $propMianNew[$proInVal->proid]['contentBasic']['title'];
         $pro['commName'] = Util_String::truncate($proInVal->commname, 20, '');
         $pro['area'] = $propMianNew[$proInVal->proid]['contentBasic']['areanum'];
         $roomStr = '';
         if ($propMianNew[$proInVal->proid]['contentBasic']['roomnum']) {
             $roomStr .= $propMianNew[$proInVal->proid]['contentBasic']['roomnum'] . '室';
         }
         if ($propMianNew[$proInVal->proid]['contentBasic']['hallnum']) {
             $roomStr .= $propMianNew[$proInVal->proid]['contentBasic']['hallnum'] . '厅';
         }
         $pro['houseType'] = $roomStr;
         $pro['floor'] = intval($propMianNew[$proInVal->proid]['contentBasic']['floor']);
         $pro['floorAll'] = intval($propMianNew[$proInVal->proid]['contentBasic']['totalfloor']);
         $pro['price'] = $proInVal->pricenum * 100;
         $pro['day'] = Bll_House_HzHouse::getLeftDays($proInVal->created);
         if ($pro['day']) {
             $pro['day'] .= '天';
         } else {
             $pro['day'] = '<1天';
         }
         /*
         $createDay = date('Ymd',$proInVal->created);
         if ($tD == $createDay) {
             $pro['day'] = '新发';
         } else {
             $timeFixstr = strtotime($createDay) + 86400;
             $leftDays = 90 - floor((time() - $timeFixstr) / 86400);
             $leftDays = $leftDays > 0 ? $leftDays : 0;
             $pro['day'] = $leftDays . '天';
         }
         */
         $pro['clickNum'] = intval($proClickInfo[$proInVal->proid]);
         $pro['isChoose'] = $adProInfos[$proInVal->proid] ? 1 : 0;
         $pro['rentType'] = $propMianNew[$proInVal->proid]['contentBasic']['renttype'] == 1 ? 0 : 1;
         //出租方式,0整租,1合租
         $data[] = $pro;
     }
     //根据最新发布时间排序
     array_multisort($orderProId, SORT_DESC, $data);
     $this->outData($data, 1);
 }
Example #5
0
 /**
  * 通过房源id直接拿到房源主表信息和房源分表信息,以及页面展示的扩展信息
  * 供展示,不用于更新
  * @param $propId
  */
 public static function getHouseExtInfo($houseInfo)
 {
     $baseInfo = $houseInfo['base'];
     if (!$baseInfo) {
         return false;
     }
     $houseInfo = $houseInfo['info'];
     if (!$houseInfo) {
         return false;
     }
     $houseInfo['houseTypeDesc'] = self::$arrHouseTypeDes['full'][$baseInfo['houseType']];
     $houseInfo['houseTypeDescShort'] = self::$arrHouseTypeDes['short'][$baseInfo['houseType']];
     $houseInfo['houseTypeUrl'] = self::$arrHouseTypeDes['urlCombo'][$baseInfo['houseType']];
     $houseInfo['urlEdit'] = BLL_Plan_JpPlanUrl::build_house_edit_url($baseInfo['houseType'], $baseInfo['id']);
     //$houseInfo['urlRedoHp'] = BLL_Plan_JpPlanUrl::build_haopan_new_url($houseInfo['id']);
     $houseInfo['urlHouse'] = BLL_Plan_JpPlanUrl::build_index_v2($baseInfo['cityId'], $baseInfo['houseType']) . $baseInfo['id'];
     // 楼层信息
     $houseInfo['floorInfo'] = self::getHouseFloorInfo($houseInfo, $baseInfo['houseType']);
     // 租金信息
     $houseInfo['priceInfo'] = self::getHousePriceInfo($houseInfo, $baseInfo['houseType']);
     // 过期时间
     $houseInfo['leftDays'] = Bll_House_HzHouse::getLeftDays(strtotime($baseInfo['createTime']));
     $houseInfo['viewURL'] = "http://my." . APF::get_instance()->get_config('base_domain') . '/ajkbroker/user/house/propview/jp/' . $houseInfo['id'];
     return array('base' => $baseInfo, 'info' => $houseInfo, 'houseType' => $baseInfo['houseType']);
 }
Example #6
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;
 }
Example #7
0
 /**
  * 组装未推广列表 取出所有-有效定价房源
  * @param $out
  * @return array
  */
 private static function prepareOutList(&$out)
 {
     $outList = array();
     $outPropIds = array();
     $fixProIds = array_keys($out['props']);
     // 取出经纪人所有非删除房源 (分表)
     $allSearchProps = Model_House_HzPropSearch::getPropLists($out['cityId'], array(array('ajkBrokerId', '=', $out['ajkBrokerId']), array('status', '<>', Const_HzStatus::DELETE), array('status', '<>', Const_HzStatus::OFFLINE), array('status', '<>', Const_HzStatus::OUTPORT), array('status', '<>', Const_HzStatus::HIBERNATE), array('status', '<>', Const_HzStatus::REMOVE), array('status', '<>', Const_HzStatus::EXPIRED)), 1000, array('created', 'desc'));
     if (empty($allSearchProps)) {
         return array();
     }
     // 获取城市价格段
     $allPrices = Model_House_HzPriceChoice::getAllPriceByCityId($out['cityId']);
     $out['getQualityProIds'] = array();
     foreach ($allSearchProps as $allSearchProp) {
         $proId = $allSearchProp['proid'];
         $out['getQualityProIds'][] = $proId;
         // 过滤非删除状态定价
         if (in_array($proId, $fixProIds)) {
             continue;
         }
         $outList[$proId] = $allSearchProp;
         // 获取剩余时间
         $outList[$proId]['leftDays'] = Bll_House_HzHouse::getLeftDays($allSearchProp['created']);
         $outPropIds[] = $proId;
     }
     // 获取改经纪人所有房源质量
     $out['propsQuality'] = Model_Stats_HzPropQuality::getPropsquality($out['getQualityProIds']);
     // 获取如是违规房源 拼接违规原因
     $outList = Bll_HzProp::checkAndGetPropsIllegalInfos($outList);
     // 批量获取主表信息
     if (empty($outPropIds)) {
         return array();
     }
     $props = Model_House_HzProp::getPropsByPropIds($outPropIds);
     if (!$props) {
         return array();
     }
     // 房源主分表信息合并
     foreach ($outList as $proId => $outProp) {
         $outList[$proId] = array_merge($outList[$proId], $props[$proId]);
         // 计算点击价格
         if (!empty($allPrices)) {
             foreach ($allPrices as $priceInfo) {
                 if ($priceInfo['lower'] < $outList[$proId]['pricenum'] && $priceInfo['upper'] >= $outList[$proId]['pricenum']) {
                     $outList[$proId]['unitPrice'] = $priceInfo['price'];
                     break;
                 }
             }
         }
     }
     return $outList;
 }
Example #8
0
 /**
  * 获取租房的精选状态(可精选,可排队)
  * @param $list
  * @param $cityId
  * @param int $cityIsChoice
  * @return array
  */
 public static function getZuFangChoiceStatus($list, $cityId, $cityIsChoice = 0)
 {
     $result = array('choiceStatus' => 0, 'choiceStatusName' => '');
     if (empty($list) || empty($cityId) || !$cityIsChoice) {
         return $result;
     }
     $propId = $list['propId'];
     $created = $list['created'];
     $quality = $list['quality'];
     $expiredDay = Bll_House_HzHouse::getLeftDays($created);
     $list['proId'] = !$list['proId'] ? $propId : $list['proId'];
     $choiceStatusArr = self::getPropChoiceStatus(array($list), $cityId);
     if ($quality && $expiredDay >= 75) {
         $choiceStatus = $choiceStatusArr && !empty($choiceStatusArr[$propId]['choiceStatus']) ? $choiceStatusArr[$propId]['choiceStatus'] : '1';
     } else {
         $choiceStatus = 0;
     }
     switch ($choiceStatus) {
         case 1:
             $result['choiceStatus'] = 1;
             $result['choiceStatusName'] = '可精选';
             break;
         case 2:
             $result['choiceStatus'] = 2;
             $result['choiceStatusName'] = '可排队';
             break;
         default:
             $result['choiceStatus'] = 0;
             $result['choiceStatusName'] = '';
     }
     return $result;
 }