Пример #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'];
     $propIds = $this->_params['propId'];
     $propIds = explode(',', $propIds);
     $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::batchprop_out_fix($hzBrokerId, $propIds, $planId);
     if (!$result['status']) {
         return Util_MobileAPI::error(Const_APIStatus::E_PLAN_PARAM_ERR);
     }
     return array('status' => 'ok', 'data' => array());
 }
Пример #3
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());
 }