示例#1
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $planId = $this->_params['planId'];
     // 获取定价计划
     $fixPlan = Model_Plan_HzPlanBasic::getActivePlanById($planId);
     if (!$fixPlan) {
         throw new Exception('计划不存在', Const_APIStatus::E_PLAN_NOTFOUND);
     }
     // 暂停定价计划
     $hzBrokerId = Bll_HzBroker::get_brokerid_by_ajk_brokerid($brokerId);
     $result = Bll_HzFixPlan::option_fix_plan($hzBrokerId, $planId, "stop");
     if (!$result['status']) {
         switch ($result['msg']) {
             case Const_HzErrorInfo::PLANSTOPING:
                 throw new Exception('计划已经停止', Const_APIStatus::E_PLAN_ALREADY_STOPPED);
                 break;
             default:
                 return Util_MobileAPI::error(Const_APIStatus::E_PLAN_PARAM_ERR);
         }
     }
     // 记录定价上下架日志
     $result = Bll_ProPlanChangeApiBll::get_instance()->insertProPlanChange(array('broker_id' => $brokerId, 'plan_id' => $planId, 'type' => 'plan_stop', 'from' => 'Mobile API v1: ' . __CLASS__, 'remark' => json_encode(array('fix' => array('plan_status' => $fixPlan['status']))), 'site_type' => 2), $brokerId);
     if ($result['status'] != 'ok') {
         return array('status' => Const_APIStatus::RETURN_CODE_ERROR, 'errcode' => Const_APIStatus::E_SYS_ERR, 'message' => $result['msg']);
     }
     return array('status' => 'ok', 'data' => array());
 }
示例#2
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $planId = $this->_params['planId'];
     // 获取定价计划
     $fixPlan = Model_Plan_HzPlanBasic::getActivePlanById($planId);
     if (!$fixPlan) {
         throw new Exception('计划不存在', Const_APIStatus::E_PLAN_NOTFOUND);
     }
     // 开启定价计划
     $hzBrokerId = Bll_HzBroker::get_brokerid_by_ajk_brokerid($brokerId);
     $result = Bll_HzFixPlan::option_fix_plan($hzBrokerId, $planId, "repeat");
     if (!$result['status']) {
         switch ($result['msg']) {
             case Const_HzErrorInfo::PLANFIXING:
                 throw new Exception('计划已经开启', Const_APIStatus::E_PLAN_ALREADY_STARTED);
                 break;
             case Const_HzErrorInfo::BROKERCHECK:
                 throw new Exception('您的身份认证未通过审核,请联系你的客户经理', Const_APIStatus::E_BROKER_ISNOT_VERFIYED);
                 break;
             case Const_HzErrorInfo::PLANMONEY:
                 throw new Exception('账户余额不足,请充值后操作', Const_APIStatus::E_BROKER_NO_MONEY);
                 break;
             case Const_HzErrorInfo::PLANAMOUNT:
                 throw new Exception('今日限额已经用完,请调整限额后操作', Const_APIStatus::E_PLAN_ERR_3013);
                 break;
             default:
                 return Util_MobileAPI::error(Const_APIStatus::E_PLAN_PARAM_ERR);
         }
     }
     // 记录定价上下架日志
     $result = Bll_ProPlanChangeApiBll::get_instance()->insertProPlanChange(array('broker_id' => $brokerId, 'plan_id' => $planId, 'type' => 'plan_start', 'from' => 'Mobile API v1: ' . __CLASS__, 'remark' => json_encode(array('fix' => array('plan_status' => $fixPlan['status']))), 'site_type' => 2), $brokerId);
     if ($result['status'] != 'ok') {
         return array('status' => Const_APIStatus::RETURN_CODE_ERROR, 'errcode' => Const_APIStatus::E_SYS_ERR, 'message' => $result['msg']);
     }
     return array('status' => 'ok', 'data' => array());
 }
示例#3
0
 /**
  * 204 计划限额变大
  * 计划id非空判断
  * 计划信息非空判断
  * 记录修改计划日志
  * 查询计划的今日话费 是否大于限额
  * 判断是否刷爆status ==2
  *   重推
  *   写入计划推广日志
  *   写入房源上线日志
  */
 private function add_plan_budget()
 {
     $planInfo = $this->checkPlanIsEmpty();
     $this->writePlanLog(2, '增加计划限额');
     // 判断计划今日话费和限额
     $today_cost = Bll_HzFixPlan::get_plan_clickinfo($this->params['broker_id'], $this->params['plan_id']);
     if ((int) $planInfo['amount'] < $today_cost['total_cost']) {
         throw new Exception_BllErrorException("计划今日花费>=限额");
     }
     // 刷爆
     if ($planInfo['status'] == Const_HzPlan::AUTOOVER) {
         // 重推
         if (Bll_HzPropBll::switchUpOrDown()) {
             Bll_HzFixPlan::option_fix_plan($this->params['broker_id'], $this->params['plan_id'], 'repeat', 2);
             $this->writePlanLog(4, '计划推广');
         }
         // 写入房源上线日志
         $plannings = Dao_Broker_HzPlan::get_planning($this->params['plan_id']);
         if (empty($plannings)) {
             return;
         }
         foreach ($plannings as $planning) {
             //写入上线日志,并且更新数据
             $this->params['pro_id'] = $planning['proid'];
             $this->writePropLog(5, '上线');
         }
     }
 }