Пример #1
0
 /**
  * 手动暂停好租经纪人的定价计划
  *
  * @param int $ajkBrokerId
  * @param int $cityId
  */
 private function stopHzFixPlan($ajkBrokerId, $cityId)
 {
     $hzBrokerId = Bll_Broker_HzBroker::getBrokerIdByAjkBrokerId($ajkBrokerId);
     if ($hzBrokerId == 0) {
         $this->logMsg(sprintf('经纪人[%d - %d]没有获取到好租经纪人ID。', $cityId, $ajkBrokerId));
         return;
     }
     $this->logMsg(sprintf('经纪人[%d - %d - %d]的好租定价计划,处理开始。', $cityId, $ajkBrokerId, $hzBrokerId));
     $fixPlanList = Bll_HzFixPlan::getBrokerPlan($hzBrokerId);
     if (empty($fixPlanList)) {
         $this->logMsg(sprintf('经纪人[%d - %d - %d]没有获取到好租定价计划。', $cityId, $ajkBrokerId, $hzBrokerId));
         return;
     }
     $data = array('houseId' => 0, 'planId' => 0, 'brokerId' => $ajkBrokerId, 'cityId' => $cityId, 'type' => 207, 'remark' => '切新端口,暂停定价计划', 'flag' => 0, 'addDate' => time(), 'dealRemark' => '', 'operateId' => 0, 'from' => __METHOD__, 'siteType' => 2);
     foreach ($fixPlanList as $fixPlan) {
         $this->logMsg(json_encode($fixPlan));
         if ($fixPlan['status'] == Const_HzPlan::MANUALLY_PAUSE) {
             $this->logMsg(sprintf('经纪人[%d - %d - %d]定价计划[%d]已经手动暂停,不做处理。', $cityId, $ajkBrokerId, $hzBrokerId, $fixPlan['id']));
             continue;
         }
         if (false == Bll_HzFixPlan::stopPlanByHand($fixPlan['id'])) {
             $this->logMsg(sprintf('经纪人[%d - %d - %d]定价计划[%d - %d]手动暂停失败。', $cityId, $ajkBrokerId, $hzBrokerId, $fixPlan['id'], $fixPlan['status']));
             continue;
         }
         $this->logMsg(sprintf('经纪人[%d - %d - %d]定价计划[%d - %d]手动暂停成功。', $cityId, $ajkBrokerId, $hzBrokerId, $fixPlan['id'], $fixPlan['status']));
         /**
          * 记录上下架队列
          */
         $data['planId'] = $fixPlan['id'];
         if (!Model_House_UpDown_Task::create($data, date('Ymd'))->save()) {
             $this->logMsg(sprintf('%s 记录上下架队列失败。', json_encode($data)));
         } else {
             $this->logMsg(sprintf('%s 记录上下架队列成功。', json_encode($data)));
         }
     }
     $this->logMsg(sprintf('经纪人[%d - %d - %d]的好租定价计划,处理结束。', $cityId, $ajkBrokerId, $hzBrokerId));
 }