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; }
public static function prepareOutList(&$out) { $illegalList = array(); $out['outList'] = $out['props']; // 过滤套餐推广 if (count($out['comboList']) > 0) { foreach ($out['comboList'] as $combo) { if (in_array($combo['houseId'], array_keys($out['props']))) { unset($out['outList'][$combo['houseId']]); } } } // 过滤竞价 已经是精选了,以下逻辑可删除 /*** * if (isset($out['bidProIds']) && count($out['bidProIds']) > 0) { * if (in_array($combo['houseId'], array_values($out['bidProIds']))) { * unset($out['outList'][$combo['houseId']]); * } * } */ // 获取如是违规房源 拼接违规原因 $out['outList'] = Bll_HzProp::checkAndGetPropsIllegalInfos($out['outList']); // 创建时间倒叙 usort($out['outList'], function ($a, $b) { return $a['created'] < $b['created'] ? 1 : -1; }); if (count($out['outList']) < 1) { return; } foreach ($out['outList'] as $k => $v) { if ($v['status'] != 6) { continue; } $illegalList[] = $v; unset($out['outList'][$k]); } $out['outList'] = array_merge($illegalList, $out['outList']); }
/** * 组装未推广列表 取出所有-有效定价房源 * @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; }