/** * 208 计划手动开启 * 查询计划信息 * 如果计划status!=1 return * 记录计划推广日志 * 判断计划是否是推广状态, 如非 return * 查询房源计划关系 * 如果不存在 return * 记录房源推广日志 * 更新关系状态 = 1 */ private function handle_plan_start() { $planInfo = $this->checkPlanIsEmpty(); if ($planInfo['status'] != Const_HzPlan::SPREAD) { return; } $this->allReturn[] = "定价计划" . $planInfo['id'] . ",status=" . $planInfo['status']; /** Jackin Fix bug34418 */ $broker_money = self::get_broker_balance_by_broker_id($this->params['ajk_broker_id']); // 余额不足 if ($broker_money <= 0) { throw new Exception_BllErrorException('余额不足ajk_broker_id' . $this->params['ajk_broker_id']); } $plan_cost = Bll_HzFixPlan::get_plan_clickinfo($this->params['broker_id'], $this->params['plan_id']); if ($planInfo['amount'] <= $plan_cost[$this->params['plan_id']]['total_cost']) { throw new Exception_BllErrorException('限额不足'); } $this->writePlanLog(4, '手动开始计划'); $plannings = Dao_Broker_HzPlan::get_planning($this->params['plan_id']); if (empty($plannings)) { return; } foreach ($plannings as $planning) { // 更新状态为1 if (!Dao_Broker_HzPlan::update_planning($planning['id'], Const_HzPlan::SPREAD)) { throw new Exception_BllErrorException("更新关系为手动开启推广失败,关系id={$planning['id']}"); } $this->params['pro_id'] = $planning['proid']; // 维护房子状态 Bll_HzPropBll::bulidHzProStatu($planning['proid']); //写入上线日志 $this->writePropLog(5, '推广'); } }