/**
  * 结算成功以后修复精选计划状态
  *
  * @param array $task
  */
 private function repairSpreadPlanState($task)
 {
     printf('修复精选推广计划状态 Task:%s' . PHP_EOL, json_encode($task));
     if ($task['siteType'] == 3) {
         $choicePlanInfo = Model_Plan_Jp::getPlanInfoById($task['planId'], true);
         if (empty($choicePlanInfo)) {
             printf('没有获取到金铺精选计划信息。' . PHP_EOL);
             return;
         }
         printf('金铺精选计划信息: %s' . PHP_EOL, json_encode($choicePlanInfo));
         if ($choicePlanInfo['status'] != Model_Plan_Jp::ENUM_STATUS_HOLD) {
             printf('金铺精选计划不是结算状态[%d],不处理。' . PHP_EOL, $choicePlanInfo['status']);
             return;
         }
         if (Model_Plan_Jp::updateChoiceStateById($task['planId'], Model_Plan_Jp::ENUM_STATUS_OVER)) {
             printf('修复金铺精选推广计划[%d]状态成功。' . PHP_EOL, $task['planId']);
         } else {
             printf('更新金铺精选推广计划[%d]状态失败。' . PHP_EOL, $task['planId']);
         }
         return;
     }
 }
Ejemplo n.º 2
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));
 }