예제 #1
0
 /**
  * 手动暂停二手房经纪人的定价计划
  *
  * @param int $brokerId
  * @param int $cityId
  * @param array $fixPlan
  */
 private function stopAjkFixPlan($brokerId, $cityId, $fixPlan)
 {
     $this->logMsg(sprintf('二手房经纪人[%d - %d]的定价计划,处理开始。', $cityId, $brokerId));
     $currentTimestamp = time();
     $data = array('houseId' => 0, 'planId' => 0, 'brokerId' => $brokerId, 'cityId' => $cityId, 'type' => 207, 'remark' => '切新端口,暂停定价计划', 'flag' => 0, 'addDate' => time(), 'dealRemark' => '', 'operateId' => 0, 'from' => __METHOD__, 'siteType' => 1);
     $this->logMsg(json_encode($fixPlan));
     /**
      * 经纪人的计划,已经被手动停止
      */
     if ($fixPlan['viewTime'] == 1861891200) {
         $this->logMsg(sprintf('二手房经纪人[%d - %d]的计划[%d - %d]已经手动停止,不处理。', $cityId, $brokerId, $fixPlan['id'], $fixPlan['viewTime']));
         return;
     }
     /**
      * 经纪人的计划,在推广中
      */
     if ($fixPlan['viewTime'] <= $currentTimestamp) {
         $this->logMsg(sprintf('二手房经纪人[%d - %d]的计划[%d - %d]推广中。', $cityId, $brokerId, $fixPlan['id'], $fixPlan['viewTime']));
     }
     /**
      * 经纪人的计划,因账户没钱停止
      */
     if ($fixPlan['viewTime'] == 1893427200) {
         $this->logMsg(sprintf('二手房经纪人[%d - %d]的计划[%d - %d]因账户没钱停止。', $cityId, $brokerId, $fixPlan['id'], $fixPlan['viewTime']));
     }
     if (false == BLL_Plan_EsfPropFixedPlanRelation::stopFixPlanByHand($fixPlan['id'])) {
         $this->logMsg(sprintf('二手房经纪人[%d - %d]的计划[%d - %d]手动暂停失败。', $cityId, $brokerId, $fixPlan['id'], $fixPlan['viewTime']));
         return;
     }
     $this->logMsg(sprintf('二手房经纪人[%d - %d]的计划[%d - %d]手动暂停成功。', $cityId, $brokerId, $fixPlan['id'], $fixPlan['viewTime']));
     if ($fixPlan['viewTime'] > $currentTimestamp) {
         $this->logMsg(sprintf('二手房经纪人[%d - %d]的计划[%d - %d]已经停止,不通知上下架。', $cityId, $brokerId, $fixPlan['id'], $fixPlan['viewTime']));
         return;
     }
     /**
      * 记录上下架队列
      */
     $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]的定价计划,处理结束。', $cityId, $brokerId));
 }