public static function getBucketInfo($blockId, $priceId) { $bucketInfo = Model_Choice_HzBidBucket::get_bucket_info($blockId, $priceId); if (empty($bucketInfo)) { return self::init_bucket_info($blockId, $priceId); } return $bucketInfo; }
/** * @param $ajkPropSpread * @param int $doBucket 0-不处理,1-坑位数加一,-1-坑位数减一 * @return bool * 精选计算排名 */ public function choiceComputeRank($blockId, $priceId) { //获取坑位表信息 $bucketInfo = Model_Choice_HzBidBucket::get_bucket_info($blockId, $priceId); if (empty($bucketInfo)) { return array('未知的坑位表信息,blockId:' . $blockId . ' priceId:' . $priceId); } //获取坑里面的推广、排队的计划 $bidPlanInfo = Model_Plan_HzPlanBasic::getChoiceQueuePlanByBucket($blockId, $priceId, array(Const_HzPlan::SPREAD, Const_HzPlan::WAITING)); if (empty($bidPlanInfo)) { return array('未获取到同板块、价格段的房源。blockId:' . $blockId . ' priceId:' . $priceId); } $tmpRemark = array(); //遍历坑里面的数据,计算排名 foreach ($bidPlanInfo as $key => $list) { $broker = Model_Broker_MainBusiness::getMainBusinessByHzBrokerId($list['user_id'], false); if ($key < $bucketInfo['maxOnlineNum']) { //预期推广中的数据 if ($list['status'] == Const_HzPlan::WAITING) { //更新租房排队中的计划为推广中 Model_Plan_HzPlanBasic::updatePlanStatus($list['id'], Const_HzPlan::SPREAD); //更新租房排队中的计划为推广中 Model_Plan_HzPlanning::updatePlanningByPlanId($list['id'], Const_HzPlan::SPREAD, Const_HzPlan::BID_TYPE); //查询精选关系表信息(获取到房源id) $bidPlanProInfo = Model_Plan_HzPlanning::getPlanByPlanId($list['id']); if (!empty($bidPlanProInfo)) { //更新房源状态 Dao_Broker_HzProp::change_prop_status($bidPlanProInfo['proid'], Const_HzStatus::ONLINE); } //通知solr队列上 Dao_Broker_HzProp::into_prop_lucene($bidPlanProInfo['proid'], $bidPlanProInfo['city_id'], 1); //记录房源日志 Model_Log_HouseLogNew::create(array('houseId' => $bidPlanProInfo['proid'], 'planId' => $bidPlanProInfo['plan_id'], 'brokerId' => $broker['ajkBrokerid'], 'cityId' => $bidPlanProInfo['city_id'], 'type' => 14, 'changeType' => '40' . self::$qInfo['actionId'], 'remark' => '计划' . self::$qInfo['planId'] . self::$actionStr[self::$qInfo['actionId']] . ';重新计算价格段内排名,精选推广', 'operatorId' => self::$qInfo['operationId'], 'siteType' => 2), date('Ymd'))->save(); $tmpRemark[] = 'planId:' . $bidPlanProInfo['plan_id'] . '变更为推广'; } } /* else { //预期排队的数据 if ($list['status'] == Const_HzPlan::SPREAD) { //更新租房排队中的计划为推广中 Model_Plan_HzPlanBasic::updatePlanStatus($list['id'], Const_HzPlan::WAITING); //更新租房排队中的计划为推广中 Model_Plan_HzPlanning::updatePlanningByPlanId($list['id'], Const_HzPlan::WAITING, Const_HzPlan::BID_TYPE); //查询精选关系表信息(获取到房源id) $bidPlanProInfo = Model_Plan_HzPlanning::getPlanByPlanId($list['id']); if (!empty($bidPlanProInfo)) { //查询定价的信息,定价推广中的话,房源状态更新为1 $fixPlanProInfo = Model_Plan_HzPlanning::getBrokerPro($bidPlanProInfo['proid'], Const_HzPlan::SPREAD_TYPE); if (isset($fixPlanProInfo[0]['is_valid']) && $fixPlanProInfo[0]['is_valid'] == Const_HzPlan::SPREAD) { $proStatus = Const_HzStatus::ONLINE; //推广 //更新房源状态 Dao_Broker_HzProp::change_prop_status($bidPlanProInfo['proid'], $proStatus); } } //通知solr队列上 Dao_Broker_HzProp::into_prop_lucene($bidPlanProInfo['proid'], $bidPlanProInfo['city_id'], $proStatus); //记录房源日志 Model_Log_HouseLogNew::create(array( 'houseId' => $bidPlanProInfo['proid'], 'planId' => $bidPlanProInfo['plan_id'], 'brokerId' => $broker['ajkBrokerid'], 'cityId' => $bidPlanProInfo['city_id'], 'type' => 13, //13-精选排队中,14-精选推广,15-取消精选推广,16-取消精选排队 'changeType' => '40' . self::$qInfo['actionId'], 'remark' => '计划' . self::$qInfo['planId'] . self::$actionStr[self::$qInfo['actionId']] . ';重新计算价格段内排名,精选排队中', 'operatorId' => self::$qInfo['operationId'], 'siteType' => 2, ), date('Ymd'))->save(); $tmpRemark[] = 'planId:' . $bidPlanProInfo['plan_id'] . '变更为排队中'; } } */ } if (empty($tmpRemark)) { $tmpRemark[] = '未找到需要变更的计划'; } return $tmpRemark; }
/** * 精选房子计算:默认(0)/可推广(1)/可排队(2)/已排满(3) * @param $proInfos * @param $cityId * @return array */ public static function getPropChoiceStatus($proInfos, $cityId) { if (empty($proInfos)) { return array(); } $priceIds = Model_House_HzPriceChoice::getAllPriceByCityId($cityId); if (empty($priceIds)) { return array(); } $result = array(); $choiceStatus = array(); foreach ($proInfos as $propInfo) { // 取价格段id $priceNum = isset($propInfo['priceNum']) ? $propInfo['priceNum'] : $propInfo['pricenum']; $propInfo['priceId'] = 0; foreach ($priceIds as $priceInfo) { if ($priceInfo['lower'] < $priceNum && $priceInfo['upper'] >= $priceNum) { $propInfo['priceId'] = $priceInfo['id']; break; } } $propInfo['blockId'] = isset($propInfo['blockId']) ? $propInfo['blockId'] : $propInfo['blockid']; // 获取精选状态 if ($bidBucket = Model_Choice_HzBidBucket::get_bucket_info($propInfo['blockId'], $propInfo['priceId'])) { if ($bidBucket['usedNum'] < $bidBucket['maxOnlineNum']) { $choiceStatus['choiceStatus'] = 1; $choiceStatus['choiceMsg'] = '可推广'; } elseif ($bidBucket['usedNum'] < $bidBucket['totalNum']) { $choiceStatus['choiceStatus'] = 2; $choiceStatus['choiceMsg'] = '可排队'; } else { $choiceStatus['choiceStatus'] = 3; $choiceStatus['choiceMsg'] = '已排满'; } } else { $choiceStatus['choiceStatus'] = 1; $choiceStatus['choiceMsg'] = '可推广'; } $result[$propInfo['proId']] = $choiceStatus; } return $result; }