/** * 获取精选状态和精选推荐 * @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; }
/** * 初始化标签房源 * @param $groupCommunityPriceSegmentList * @param $bucketInfoList * @return array */ private function initBrokerMarkHouse($groupCommunityPriceSegmentList, $bucketInfoList) { $result = array(); $brokerInfo = self::$BrokerInfo; $cstBrokerCompanyId = $brokerInfo['BaseInfo']['CST_BROKER_COMPANY_ID']; foreach ($groupCommunityPriceSegmentList as $key => $propIds) { if ($bucketInfoList[$key] == false) { continue; } list($communityId, $priceId) = explode('_', $key); $markList = Bll_Stats_BrokerMark::getLastRowByCommIdAndSpId($communityId, $priceId); if (empty($markList)) { continue; } $markListByType = array(); foreach ($markList as $mark) { $markListByType[$mark['type']] = $mark; } $zheKou = ''; //优先说明 3=低价 2=促销 1=推荐 低价>促销(折扣)>推荐(主营、热门、抢置顶) if (isset($markListByType[1]) && $markListByType[1]['type'] == 1) { $type = $markListByType[1]['type']; $rcReason = $markListByType[1]['recReason']; $createTime = $markListByType[1]['createTime']; } if (isset($markListByType[2]) && $markListByType[2]['type'] == 2) { $type = $markListByType[2]['type']; $rcReason = $markListByType[2]['recReason']; $zheKou = $markListByType[2]['zhekou']; $createTime = $markListByType[2]['createTime']; } if (isset($markListByType[3]) && $markListByType[3]['type'] == 3) { $type = $markListByType[3]['type']; $rcReason = $markListByType[3]['recReason']; $createTime = $markListByType[3]['createTime']; } //推荐房源 type=1 if ($type == 1) { //推荐理由包涵主营的需要判断该经纪人的主营业务 if ($rcReason == 1 || $rcReason == 4 || $rcReason == 5 || $rcReason == 7) { $mendianId = explode(',', $markListByType[1]['mendianId']); if (!in_array($cstBrokerCompanyId, $mendianId)) { continue; } } } foreach ($propIds as $houseId) { $result[$houseId] = array('id' => $houseId, 'type' => $type, 'rc_reason' => $rcReason, 'zhekou' => $zheKou, 'createTime' => $createTime); } } return $result; }