Exemplo n.º 1
0
 /**
  * 110 房源图片信息变更
  *
  * <ol>
  * <li>
  * 查询房源信息是否存在<br>
  *      如果不存在,返回结束<br>
  *      如果有效,记录房源编辑日志<br>
  * </li>
  *
  * <li>
  * 查询房源计划关系<br>
  *      如果不存在,返回结束<br>
  *      如果存在,continue<br>
  * </li>
  *
  * <li>
  * 查询计划信息<br>
  *      如果计划不在推广,返回结束<br>
  *      如果计划正在推广或者第二天推广, 房源更新日志<br>
  * </li>
  * </ol>
  */
 public static function change_prop_pic($params)
 {
     $returnLog = array();
     array_push($returnLog, "队列(" . json_encode($params['id']) . ")开始处理");
     if (empty($params['pro_id'])) {
         array_push($returnLog, "房源ID为空");
         return self::build_return(1, $returnLog);
     }
     if (empty($params['city_id'])) {
         array_push($returnLog, "城市ID为空");
         return self::build_return(1, $returnLog);
     }
     //获取房源信息
     $propBll = new BLL_Property_Property();
     $propInfo = $propBll->getPropBaseInfoById($params['pro_id']);
     if (isset($propInfo[-9999])) {
         array_push($returnLog, "获取数据库中房源信息失败");
         return self::build_return(0, $returnLog);
     }
     if (empty($propInfo)) {
         array_push($returnLog, "房源信息为空");
         return self::build_return(1, $returnLog);
     }
     //房源信息存在写入房源编辑信息
     $data = self::build_prop_log($params, 2, "房源编辑" . ";队列表id为" . $params['id'], $params['broker_id']);
     if (!Model_Log_HouseLogNew::create($data, date('Ymd'))->save()) {
         array_push($returnLog, "房源编辑日志写入失败");
         return self::build_return(0, $returnLog);
     }
     array_push($returnLog, "房源编辑日志写入");
     //查询房源计划关系
     $relationBll = new Bll_FixedSpread_PropFixedPlanRelation();
     $relationInfo = $relationBll->getProSpreadRelationByProId($params['pro_id'], $params['city_id']);
     if (empty($relationInfo)) {
         array_push($returnLog, "房源计划关系为空");
         return self::build_return(1, $returnLog);
     }
     /**
      * 修正房源的计划id
      */
     if (empty($params['plan_id'])) {
         $params['plan_id'] = $relationInfo['PlanId'];
     }
     //获取计划信息
     $planBll = new Bll_Fixedspread_AjkFixedSpread();
     $planInfo = $planBll->getStaticPlanById($params['plan_id']);
     if (empty($planInfo)) {
         array_push($returnLog, "计划信息为空");
         return self::build_return(1, $returnLog);
     }
     $planStatus = $planBll->getFixedPlanStatus($planInfo['Status'], $planInfo['ViewTime']);
     //1. 刪除 2.推广中 3.第二天推广 4.账户没钱停止 5.手动停止
     switch ($planStatus) {
         case 1:
             array_push($returnLog, "计划状态已被置为删除");
             break;
         case 2:
         case 3:
             //房源更新日志
             $data = self::build_prop_log($params, 4, "房源更新" . ";队列表id为" . $params['id'], $params['broker_id']);
             if (!Model_Log_HouseLogNew::create($data, date('Ymd'))->save()) {
                 array_push($returnLog, "房源更新日志写入失败");
                 return self::build_return(0, $returnLog);
             }
             array_push($returnLog, "房源更新日志写入");
             break;
         case 4:
             array_push($returnLog, "计划状态为账户没钱停止");
             break;
         case 5:
             array_push($returnLog, "计划状态为手动停止");
             break;
         default:
             break;
     }
     return self::build_return(1, $returnLog);
 }
 /**
  * 获取房源定价推广的状态
  *
  * @param $propId 房源id
  * @return -2,错误状态-1,不在推广,1-正常推广,2-房源本身被删除, 3-第二天推广
  * 不在推广包括 账户没钱停止,手动停止,房源从推广计划中删除, 房源违规, 房源到期, 计划删除
  */
 public function getPropFixedStatus($propId, $cityId)
 {
     $return = array("status" => -1, "msg" => "不在推广");
     //获取房源计划关系
     if (isset(self::$propRelationsByPropId)) {
         $relationInfo = self::$propRelationsByPropId[$propId];
     } else {
         $relationInfo = $this->getProSpreadRelationByProId($propId, $cityId);
         if (empty($relationInfo)) {
             return $return;
         } else {
             self::$propRelationsByPropId = $relationInfo;
         }
     }
     switch ($relationInfo['Status']) {
         case 1:
             //获取对应的计划状态信息
             $planId = $relationInfo['PlanId'];
             $planBll = new Bll_Fixedspread_AjkFixedSpread();
             $planInfo = $planBll->getStaticPlanById($planId);
             if (isset($planInfo[-9999])) {
                 $return = array("status" => -2, "msg" => "数据库错误");
                 break;
             }
             if (empty($planInfo)) {
                 $return = array("status" => -2, "msg" => "计划信息为空");
                 break;
             }
             $planStatus = Bll_Fixedspread_AjkFixedSpread::getFixedPlanStatus($planInfo['Status'], $planInfo['ViewTime']);
             //1. 刪除 2.推广中 3.第二天推广 4.账户没钱停止 5.手动停止
             switch ($planStatus) {
                 case 1:
                     $return = array("status" => -1, "msg" => "计划被删除");
                     break;
                 case 2:
                     $return = array("status" => 1, "msg" => "正常推广");
                     break;
                 case 3:
                     $return = array("status" => 3, "msg" => "房源第二天推广");
                     break;
                 case 4:
                     $return = array("status" => -1, "msg" => "账户没钱停止计划");
                     break;
                 case 5:
                     $return = array("status" => -1, "msg" => "手动停止计划");
                     break;
                 default:
                     $return = array("status" => -2, "msg" => "未知状态");
                     break;
             }
             break;
         case 2:
             $return = array("status" => -1, "msg" => "房源已从计划中删除");
             break;
         case 3:
             $return = array("status" => -1, "msg" => "房源违规");
             break;
         case 4:
             $return = array("status" => -1, "msg" => "房源到期");
             break;
         case 5:
             $return = array("status" => 2, "msg" => "删除房源");
             break;
         case 6:
             $return = array("status" => -1, "msg" => "计划被删除");
             break;
         default:
             $return = array("status" => -2, "msg" => "未知状态");
             break;
     }
     return $return;
 }