/** * * 根据经纪人查询套餐房源的标签(优、良、中、待评) * 根据房源的rank大段 * @param $brokerId * @param $siteType * @return array * $result['list'][proid]['rankStar'] 大段 * $result['list'][proid]['rankStarName'] 大段名称 * $result['count'][0][rankStar] 各大段的数量标记 * $result['count'][0][rankStarName] 各大段的数量名称 * $result['count'][0][rankStarNum] 各大段的数量 */ public static function getBrokerComboProRank($brokerId, $siteType, $cityId = '') { //标签返回值 $result = array(); switch ($siteType) { case 'ajk': //二手房 //分类计算标签数量 $rankTips = array(0 => '待评', 1 => '中等', 2 => '良好', 3 => '优质'); //获取经纪人套餐房源 $comboList = Bll_Combo_HouseRelation::getHouseRelations($brokerId, Bll_Combo_HouseRelation::SITE_TYPE_AJK, 1); $houseIds = array(); foreach ($comboList as $combo) { $houseIds[$combo['houseId']] = $combo['houseId']; } if (empty($houseIds)) { return $result; } $houseInfo = array(); foreach ($comboList as $combo) { $houseInfo['houseIdList'][] = $combo['houseId']; $tmp = array('proId' => $combo['houseId'], 'postDate' => strtotime($combo['created']), 'cityId' => $combo['cityId']); $houseInfo['comboSpreadHouseList'][$combo['houseId']] = $tmp; } if (empty($houseInfo)) { return $result; } $housePostDate = array(); $housePostDateTmp = Bll_House_EsfHouse::getHouseInfo($houseInfo['houseIdList'], $cityId); foreach ($housePostDateTmp as $k => $v) { $housePostDate[$v['proId']] = $v; } foreach ($houseInfo['comboSpreadHouseList'] as $k => &$v) { $v['postDate'] = $housePostDate[$k]['postDate']; } //获取房源的标签 $houseSollyResultList = Bll_House_EsfHouse::getHouseRankEx($houseInfo); $houseRank = array(); foreach ($houseSollyResultList as $houseSollyResult) { $houseRank[$houseSollyResult['propId']] = $houseSollyResult['rankStar']; } //标签数量计算 foreach ($houseIds as $houseId) { if (isset($rankTips[$houseRank[$houseId]])) { $rankStar = $houseRank[$houseId]; } else { $rankStar = 0; } //数据列表 $result['list'][$houseId]['rankStar'] = $rankStar; $result['list'][$houseId]['rankStarName'] = $rankTips[$rankStar]; //统计数据 $result['count'][$rankStar]['rankStar'] = $rankStar; $result['count'][$rankStar]['rankStarName'] = $rankTips[$rankStar]; if (isset($result['count'][$rankStar]['rankStarNum'])) { $result['count'][$rankStar]['rankStarNum'] += 1; } else { $result['count'][$rankStar]['rankStarNum'] = 1; } } break; case 'hz': //租房 //分类计算标签数量 $rankTips = array(0 => '待评', 1 => '中等', 2 => '良好', 3 => '优质'); //获取经纪人套餐房源 $comboList = Bll_Combo_HouseRelation::getHouseRelations($brokerId, Bll_Combo_HouseRelation::SITE_TYPE_HZ, 1); $houseIds = array(); foreach ($comboList as $combo) { $houseIds[$combo['houseId']] = $combo['houseId']; } if (empty($houseIds)) { return $result; } //获取房源的标签 //$houseSollyResultList = Model_Stats_HzPropQuality::getPropsqualityv2($houseIds); $houseInfo = array(); $tmp = array(); foreach ($comboList as $v) { $tmp['propId'] = $v['houseId']; $tmp['cityid'] = $v['cityId']; $tmp['created'] = strtotime($v['created']); $houseInfo[$v['houseId']] = $tmp; $tmp = array(); } $housePostDate = array(); $housePostDateTmp = Bll_House_HzHouse::getValidPropsByBrokerIdEx($brokerId, $cityId); foreach ($housePostDateTmp as $k => $v) { $housePostDate[$v['proid']] = $v; } foreach ($houseInfo as $k => &$v) { $v['created'] = $housePostDate[$k]['created']; } $houseSollyResultListTmp = Bll_Broker_Combo_ManageHz::getHzPropsQuality($houseInfo); foreach ($houseSollyResultListTmp as $v) { $tmp['cityId'] = $v['cityId']; $tmp['proId'] = $v['proId']; $tmp['rank'] = $v['rank']; $houseSollyResultList[] = $tmp; } $houseRank = array(); foreach ($houseSollyResultList as $houseSollyResult) { $houseRank[$houseSollyResult['proId']] = $houseSollyResult['rank']; } //标签数量计算 foreach ($houseIds as $houseId) { if (isset($rankTips[$houseRank[$houseId]])) { if ($houseRank[$houseId] == 1) { $rankStar = 3; //优 } elseif ($houseRank[$houseId] == 2) { $rankStar = 2; //良 } elseif ($houseRank[$houseId] == 3) { $rankStar = 1; //中 } else { $rankStar = 0; //优 } } else { $rankStar = 0; } //数据列表 $result['list'][$houseId]['rankStar'] = $rankStar; $result['list'][$houseId]['rankStarName'] = $rankTips[$rankStar]; //统计数据 $result['count'][$rankStar]['rankStar'] = $rankStar; $result['count'][$rankStar]['rankStarName'] = $rankTips[$rankStar]; if (isset($result['count'][$rankStar]['rankStarNum'])) { $result['count'][$rankStar]['rankStarNum'] += 1; } else { $result['count'][$rankStar]['rankStarNum'] = 1; } } break; case 'jp': //金铺 $exquisite = array(1 => '精品', 2 => '非精品'); //获取经纪人套餐房源 $comboList = Bll_Combo_HouseRelation::getHouseRelations($brokerId, Bll_Combo_HouseRelation::SITE_TYPE_JP, 1); $houseIds = array(); foreach ($comboList as $combo) { $houseIds[$combo['houseId']] = $combo['houseId']; } if (empty($houseIds)) { return $result; } //获取房源的标签 $jpOfficeRent = Model_House_JpOfficeRent::getPropInfoByIds($houseIds); $jpOfficeSale = Model_House_JpOfficeSale::getPropInfoByIds($houseIds); $jpShopRent = Model_House_JpShopRent::getPropInfoByIds($houseIds); $jpShopSale = Model_House_JpShopSale::getPropInfoByIds($houseIds); $houseSollyResultList = array_merge($jpOfficeRent, $jpOfficeSale, $jpShopRent, $jpShopSale); $houseExquisite = array(); foreach ($houseSollyResultList as $houseSollyResult) { $houseExquisite[$houseSollyResult['id']] = $houseSollyResult['isExquisite']; } //标签数量计算 foreach ($houseIds as $houseId) { if (isset($exquisite[$houseExquisite[$houseId]])) { $exquisiteStar = $houseExquisite[$houseId]; } else { $exquisiteStar = 2; } //数据列表 $result['list'][$houseId]['exquisiteStar'] = $exquisiteStar; $result['list'][$houseId]['exquisiteStarName'] = $exquisite[$exquisiteStar]; //统计数据 $result['count'][$exquisiteStar]['exquisiteStar'] = $exquisiteStar; $result['count'][$exquisiteStar]['exquisiteStarName'] = $exquisite[$exquisiteStar]; if (isset($result['count'][$exquisiteStar]['exquisiteStarNum'])) { $result['count'][$exquisiteStar]['exquisiteStarNum'] += 1; } else { $result['count'][$exquisiteStar]['exquisiteStarNum'] = 1; } } break; default: break; } return $result; }
public function getHouseSollyResultEx($houseInfo) { $houseSollyResultList = Bll_House_EsfHouse::getHouseRankEx($houseInfo); $rankTips = array('待评', '中等', '良好', '优质'); $rtn = array(); foreach ($houseSollyResultList as $houseSollyResult) { if (isset($rankTips[$houseSollyResult['rankStar']])) { $rtn[$houseSollyResult['propId']] = $rankTips[$houseSollyResult['rankStar']]; } } return $rtn; }