Пример #1
0
 /**
  * 二手房小区合并
  *
  * @param array $queueInfo
  * @return array
  */
 public static function ajkCommunityMerge($queueInfo)
 {
     if (!isset($queueInfo) || empty($queueInfo)) {
         return static::buildReturn(self::PROCESS_STATUS_ERROR, '小区合并,remark的值为空');
     }
     $communityMergeInfo = json_decode($queueInfo['remark'], true);
     if (!is_array($communityMergeInfo)) {
         return static::buildReturn(self::PROCESS_STATUS_ERROR, '小区合并,remark的值不是JSON');
     }
     /** 获取推广中的小区的精选计划 */
     $choicePlanList = Model_Plan_EsfAjkPropSpread::getSpreadChoicePlanByCommunityId($communityMergeInfo['cityId'], $communityMergeInfo['commId']);
     if (empty($choicePlanList)) {
         return static::buildReturn(self::PROCESS_STATUS_SUCCESS, sprintf('小区小区合并,没有获取到小区[%d]的精选计划信息', $communityMergeInfo['commId']));
     }
     $houseLogWriteError = array();
     $houseLogWriteSuccess = array();
     foreach ($choicePlanList as $choicePlan) {
         $data = array();
         $data['houseId'] = $choicePlan['propId'];
         $data['planId'] = $choicePlan['id'];
         $data['brokerId'] = $choicePlan['brokerId'];
         $data['cityId'] = $queueInfo['city_id'];
         $data['type'] = Const_ProLogType::LOG_COMMUNITY_MERGE;
         $data['changeType'] = $queueInfo['type'];
         $data['remark'] = '小区合并';
         $data['addDate'] = date('Y-m-d H:i:s');
         $data['operatorId'] = 0;
         $data['siteType'] = 1;
         if (!Model_Log_HouseLogNew::create($data, date('Ymd'))->save()) {
             $houseLogWriteError[] = $choicePlan['propId'];
         } else {
             $houseLogWriteSuccess[] = $choicePlan['propId'];
         }
     }
     return static::buildReturn(self::PROCESS_STATUS_SUCCESS, sprintf('小区小区合并,房源日志写入成功[%s],房源日志写入失败[%s]', implode(',', $houseLogWriteSuccess), implode(',', $houseLogWriteError)));
 }