|
|
|
@ -12,11 +12,15 @@ declare (strict_types=1); |
|
|
|
|
|
|
|
|
|
namespace app\api\controller\dealer; |
|
|
|
|
|
|
|
|
|
use think\response\Json; |
|
|
|
|
use app\api\controller\Controller; |
|
|
|
|
use app\api\model\dealer\User as DealerUserModel; |
|
|
|
|
use app\api\model\dealer\Apply as DealerApplyModel; |
|
|
|
|
use app\api\model\dealer\User as DealerUserModel; |
|
|
|
|
use app\api\service\User as UserService; |
|
|
|
|
use cores\exception\BaseException; |
|
|
|
|
use think\db\exception\DataNotFoundException; |
|
|
|
|
use think\db\exception\DbException; |
|
|
|
|
use think\db\exception\ModelNotFoundException; |
|
|
|
|
use think\response\Json; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 分销商申请 |
|
|
|
@ -28,7 +32,7 @@ class Apply extends Controller |
|
|
|
|
/** |
|
|
|
|
* 分销商申请状态 |
|
|
|
|
* @return Json |
|
|
|
|
* @throws \cores\exception\BaseException |
|
|
|
|
* @throws BaseException |
|
|
|
|
*/ |
|
|
|
|
public function status(): Json |
|
|
|
|
{ |
|
|
|
@ -45,10 +49,10 @@ class Apply extends Controller |
|
|
|
|
/** |
|
|
|
|
* 提交分销商申请 |
|
|
|
|
* @return Json |
|
|
|
|
* @throws \cores\exception\BaseException |
|
|
|
|
* @throws \think\db\exception\DataNotFoundException |
|
|
|
|
* @throws \think\db\exception\DbException |
|
|
|
|
* @throws \think\db\exception\ModelNotFoundException |
|
|
|
|
* @throws BaseException |
|
|
|
|
* @throws DataNotFoundException |
|
|
|
|
* @throws DbException |
|
|
|
|
* @throws ModelNotFoundException |
|
|
|
|
*/ |
|
|
|
|
public function submit(): Json |
|
|
|
|
{ |
|
|
|
@ -58,4 +62,44 @@ class Apply extends Controller |
|
|
|
|
} |
|
|
|
|
return $this->renderError($model->getError() ?: '提交失败'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @notes:申请服务商 |
|
|
|
|
* @return Json |
|
|
|
|
* @throws BaseException |
|
|
|
|
* @throws DataNotFoundException |
|
|
|
|
* @throws DbException |
|
|
|
|
* @throws ModelNotFoundException |
|
|
|
|
* @author: wanghousheng |
|
|
|
|
*/ |
|
|
|
|
public function applyProviders(): Json |
|
|
|
|
{ |
|
|
|
|
$real_name = $this->request->post('real_name'); |
|
|
|
|
if (!$real_name) { |
|
|
|
|
return $this->renderError('联系人不能为空'); |
|
|
|
|
} |
|
|
|
|
$mobile = $this->request->post('mobile'); |
|
|
|
|
if (empty($mobile)) { |
|
|
|
|
return $this->renderError('联系电话不能为空'); |
|
|
|
|
} |
|
|
|
|
$shop_type = intval($this->request->post('shop_type', 10)); |
|
|
|
|
$shop_name = $this->request->post('shop_name'); |
|
|
|
|
if (empty($shop_name)) { |
|
|
|
|
return $this->renderError('店铺名称不能为空'); |
|
|
|
|
} |
|
|
|
|
$business = $this->request->post('business'); |
|
|
|
|
if (empty($business)) { |
|
|
|
|
return $this->renderError('经营类型不能为空'); |
|
|
|
|
} |
|
|
|
|
$city = $this->request->post('city'); |
|
|
|
|
if (empty($city)) { |
|
|
|
|
return $this->renderError('所在城市不能为空'); |
|
|
|
|
} |
|
|
|
|
$data = compact('business', 'city', 'real_name', 'mobile', 'shop_type', 'shop_name', 'business', 'city'); |
|
|
|
|
$model = new DealerApplyModel; |
|
|
|
|
if ($model->applyServiceProviders($data)) { |
|
|
|
|
return $this->renderSuccess('提交成功'); |
|
|
|
|
} |
|
|
|
|
return $this->renderError($model->getError() ?: '提交失败'); |
|
|
|
|
} |
|
|
|
|
} |