Пример #1
0
 /**
  * 获取房源精选排名
  *
  * @param int $brokerId
  * @param array $houseIds
  * @return array
  */
 public static function getHouseQueueLocation($brokerId, $houseIds)
 {
     $result = array_fill_keys($houseIds, 1);
     $brokerChoicePlanList = Model_Plan_EsfAjkPropSpread::getBrokerChoicePlanInfoByHouseId($brokerId, $houseIds);
     $_cache = array();
     foreach ($brokerChoicePlanList as $choicePlan) {
         if ($choicePlan['status'] != Model_Plan_EsfAjkPropSpread::ONQUEUE) {
             continue;
         }
         if ($choicePlan['model'] == Model_Plan_EsfAjkPropSpread::BLOCK_CHOICE) {
             /** 获取坑位中的计划信息 */
             $cacheKey = sprintf('%s_%d_%d_%d', 'block', $choicePlan['areacode'], $choicePlan['smallprice'], $choicePlan['bigprice']);
             if (!isset($_cache[$cacheKey])) {
                 $_cache[$cacheKey] = Model_Plan_EsfAjkPropSpread::getPropQueueSpreadByBlockBucket($choicePlan['areacode'], $choicePlan['smallprice'], $choicePlan['bigprice']);
             }
         } else {
             /** 获取坑位中的计划信息 */
             $cacheKey = sprintf('%d_%d_%d', $choicePlan['commId'], $choicePlan['smallprice'], $choicePlan['bigprice']);
             if (!isset($_cache[$cacheKey])) {
                 $_cache[$cacheKey] = Model_Plan_EsfAjkPropSpread::getPropQueueSpreadByBucket($choicePlan['commId'], $choicePlan['smallprice'], $choicePlan['bigprice']);
             }
         }
         $bucketQueueList = $_cache[$cacheKey];
         if (empty($bucketQueueList)) {
             continue;
         }
         /** 精选计划的排名 */
         foreach ($bucketQueueList as $index => $planInfo) {
             $result[$choicePlan['propId']] = $index + 1;
             if ($planInfo['propId'] == $choicePlan['propId']) {
                 break;
             }
         }
     }
     return $result;
 }