Example #1
0
 /**
  * 精选计划板块变更
  *
  * @param array $queueInfo
  * @return array
  */
 public static function houseBlockChange($queueInfo)
 {
     $choicePlanInfo = Model_Plan_Jp::getPlanInfoById($queueInfo['planId'], true);
     if (empty($choicePlanInfo)) {
         return self::buildReturn(0, '没有获取到计划');
     }
     if ($choicePlanInfo['status'] != Model_Plan_Jp::ENUM_STATUS_ONLINE && $choicePlanInfo['status'] != Model_Plan_Jp::ENUM_STATUS_CHOICE_HOLD) {
         return self::buildReturn(1, sprintf('计划状态[%d]不处理', $choicePlanInfo['status']));
     }
     /** 获取房源信息 */
     $houseInfo = Model_House_JpHouseIdx::getHouseInfoById($choicePlanInfo['houseId']);
     if (empty($houseInfo)) {
         return self::buildReturn(0, sprintf('没有获取到房源[%d]信息', $choicePlanInfo['houseId']));
     }
     if ($houseInfo['isDelete'] == Model_House_JpHouseIdx::ENUM_IS_DELETE_YES) {
         return self::buildReturn(0, sprintf('房源[%d]已经删除[%d]', $choicePlanInfo['houseId'], $houseInfo['isDelete']));
     }
     /** 获取房源的板块id */
     if (in_array($houseInfo['houseType'], array(Model_House_JpHouseIdx::ENUM_HOUSE_TYPE_OFFICE_RENT, Model_House_JpHouseIdx::ENUM_HOUSE_TYPE_OFFICE_SALE))) {
         $propertyInfo = Model_House_JpBuilding::getBuildingById($houseInfo['propertyId'], array('blockId'));
     } else {
         $propertyInfo = Model_House_JpProperty::getPropertyById($houseInfo['propertyId'], array('blockId', 'isRoad'));
     }
     $blockId = $propertyInfo['blockId'];
     /** 商铺自选房源精选板块ID从房源信息表里取 */
     if (in_array($houseInfo['houseType'], array(Model_House_JpHouseIdx::ENUM_HOUSE_TYPE_SHOP_RENT, Model_House_JpHouseIdx::ENUM_HOUSE_TYPE_SHOP_SALE)) && $propertyInfo['isRoad'] == 1) {
         $houseTypeClass = Model_House_JpHouseIdx::getHouseTypeModelClass($houseInfo['houseType']);
         $extendHouseInfo = $houseTypeClass::getPropInfoById($houseInfo['id']);
         $blockId = $extendHouseInfo['blockId'];
     }
     /** 获取商圈ID */
     $businessCycleId = Bll_House_JpHouseInfo::getBusinessCycleId($houseInfo['cityId'], $blockId, $houseInfo['houseType']);
     /** 更新计划的板块和商圈ID */
     if (!Model_Plan_Jp::updatePlanBlockIdAndNewBlockIdById($choicePlanInfo['id'], $blockId, $businessCycleId)) {
         return self::buildReturn(0, sprintf('更新计划[%d]的板块[%d -> %d]和商圈[%d -> %d]id失败', $choicePlanInfo['id'], $choicePlanInfo['blockId'], $blockId, $choicePlanInfo['newBlockId'], $businessCycleId));
     }
     if (!Model_Choice_JPBidBucket::getBucketInfo($blockId, $businessCycleId, $choicePlanInfo['houseType'], $choicePlanInfo['priceId'])) {
         Model_Choice_JPBidBucket::initBucketInfo($blockId, $businessCycleId, $choicePlanInfo['houseType'], $choicePlanInfo['priceId'], $choicePlanInfo['cityId']);
     }
     Model_Choice_JPBidBucket::incrementUsedNumEx($blockId, $businessCycleId, $choicePlanInfo['houseType'], $choicePlanInfo['priceId']);
     return self::buildReturn(1, sprintf('更新计划[%d]的板块[%d -> %d]和商圈[%d -> %d]id成功', $choicePlanInfo['id'], $choicePlanInfo['blockId'], $blockId, $choicePlanInfo['newBlockId'], $businessCycleId));
 }