/** * 手动暂停金铺经纪人的定价计划 * * @param int $jpBrokerId * @param int $cityId * @param array $fixPlan */ private function stopJpFixPlan($jpBrokerId, $cityId, $fixPlan) { try { $ajkBrokerId = Bll_Broker_User::getAjkBrokerIdByJpBrokerId($jpBrokerId); } catch (Exception $e) { $this->logMsg($e->getMessage()); return; } $this->logMsg(sprintf('经纪人[%d - %d - %d]金铺的定价计划,处理开始。', $cityId, $ajkBrokerId, $jpBrokerId)); $this->logMsg(sprintf('经纪人[%d - %d - %d]定价计划[%d - %d - %d]状态。', $cityId, $ajkBrokerId, $jpBrokerId, $fixPlan['id'], $fixPlan['status'], $fixPlan['stopReason'])); $data = array('houseId' => 0, 'planId' => 0, 'brokerId' => $ajkBrokerId, 'cityId' => $cityId, 'type' => 207, 'remark' => '切新端口,暂停定价计划', 'flag' => 0, 'addDate' => time(), 'dealRemark' => '', 'operateId' => 0, 'from' => __METHOD__, 'siteType' => 3); $this->logMsg(json_encode($fixPlan)); if (false == Bll_Plan_Fix_JpPlan::stopPlanByHand($fixPlan['id'])) { $this->logMsg(sprintf('经纪人[%d - %d - %d]定价计划[%d - %d]手动暂停失败。', $cityId, $ajkBrokerId, $jpBrokerId, $fixPlan['id'], $fixPlan['stopReason'])); return; } $this->logMsg(sprintf('经纪人[%d - %d - %d]定价计划[%d - %d]手动暂停成功。', $cityId, $ajkBrokerId, $jpBrokerId, $fixPlan['id'], $fixPlan['stopReason'])); if ($fixPlan['status'] == 4) { $this->logMsg(sprintf('经纪人[%d - %d - %d]定价计划[%d - %d]已经停止,不通知上下架。', $cityId, $ajkBrokerId, $jpBrokerId, $fixPlan['id'], $fixPlan['stopReason'])); 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 - %d]金铺的定价计划,处理结束。', $cityId, $ajkBrokerId, $jpBrokerId)); }
private function moveJpPPCFixPlanRelation($cityId, $jpBrokerId, $fixPlan) { try { $ajkBrokerId = Bll_Broker_User::getAjkBrokerIdByJpBrokerId($jpBrokerId); } catch (Exception $e) { $this->logMsg($e->getMessage()); return; } if ($ajkBrokerId == 0) { $this->logMsg(sprintf('经纪人[%d - %d]没有获取到二手房经纪人ID。', $cityId, $jpBrokerId)); return; } $fixPlanId = $fixPlan['id']; $fixPlanHouseRelationList = Model_House_JpHouseIdx::getHouseInfoByFixPlanIdEx($fixPlanId); if (empty($fixPlanHouseRelationList)) { $this->logMsg(sprintf('经纪人[%d - %d - %d - %d]没有获取到金铺定价计划房源。', $cityId, $ajkBrokerId, $jpBrokerId, $fixPlanId)); return; } foreach ($fixPlanHouseRelationList as $fixPlanHouseRelation) { $comboHouseRelation = Bll_Combo_HouseRelation::getRelationByHouseId($fixPlanHouseRelation['id'], Model_Combo_HouseRelation::SITE_TYPE_JP); if (!empty($comboHouseRelation)) { if ($comboHouseRelation['state'] == Model_Combo_HouseRelation::ENUM_COMBO_EXPIRE) { $this->logMsg(sprintf('房源[%d]的套餐关系存在id[%d],且state==205', $fixPlanHouseRelation['id'], $comboHouseRelation['id'])); continue; } if (1 == Bll_Combo_HouseRelation::updateComboStatusById($comboHouseRelation['id'], Model_Combo_HouseRelation::ENUM_COMBO_EXPIRE, Model_Combo_HouseRelation::SITE_TYPE_JP)) { $this->logMsg(sprintf('房源[%d]的套餐关系存在id[%d],更新成功', $fixPlanHouseRelation['id'], $comboHouseRelation['id'])); } else { $this->logMsg(sprintf('房源[%d]的套餐关系存在id[%d],更新失败', $fixPlanHouseRelation['id'], $comboHouseRelation['id'])); } continue; } $data = array('houseId' => $fixPlanHouseRelation['id'], 'brokerId' => $ajkBrokerId, 'cityId' => $cityId, 'state' => Model_Combo_HouseRelation::ENUM_COMBO_EXPIRE, 'created' => $fixPlanHouseRelation['createTime']); if (1 == Model_Combo_HouseRelation::create($data, Model_Combo_HouseRelation::SITE_TYPE_JP)->save()) { $this->logMsg(sprintf('房源[%d]转移成功', $fixPlanHouseRelation['id'])); } else { $this->logMsg(sprintf('房源[%d]转移失败', $fixPlanHouseRelation['id'])); } } }