wang hou sheng 8 months ago
parent ea2bd4aaad
commit cd1452004d
  1. 18
      app/api/controller/dealer/Apply.php
  2. 23
      app/api/model/dealer/Apply.php

@ -103,6 +103,7 @@ class Apply extends Controller
return $this->renderError($model->getError() ?: '提交失败'); return $this->renderError($model->getError() ?: '提交失败');
} }
/** /**
* @notes:更新申请服务商 * @notes:更新申请服务商
* @return Json * @return Json
@ -135,8 +136,21 @@ class Apply extends Controller
$data = compact('business', 'city', 'real_name', 'mobile', 'shop_type', 'shop_name', 'business', 'city'); $data = compact('business', 'city', 'real_name', 'mobile', 'shop_type', 'shop_name', 'business', 'city');
$model = new DealerApplyModel; $model = new DealerApplyModel;
if ($model->editApplyServiceProviders($data)) { if ($model->editApplyServiceProviders($data)) {
return $this->renderSuccess('提交成功'); return $this->renderSuccess('更新成功');
} }
return $this->renderError($model->getError() ?: '提交失败'); return $this->renderError($model->getError() ?: '更新失败');
}
/**
* @notes:申请记录详情
* @return Json
* @throws BaseException
* @author: wanghousheng
*/
public function getApplyInfo(): Json
{
$model = new DealerApplyModel;
$info = $model->getApplyInfo();
return $this->renderSuccess(compact('info'));
} }
} }

@ -98,7 +98,8 @@ class Apply extends ApplyModel
$userId = UserService::getCurrentLoginUserId(); $userId = UserService::getCurrentLoginUserId();
// 成为分销商条件 // 成为分销商条件
$config = Setting::getItem('condition'); $config = Setting::getItem('condition');
if ($this->where(['user_id' => $userId])->exists()) { $info = self::get(['user_id' => $userId]);
if (!empty($info)) {
throwError('您已申请服务商,请勿重复提交'); throwError('您已申请服务商,请勿重复提交');
} }
// 数据整理 // 数据整理
@ -135,7 +136,7 @@ class Apply extends ApplyModel
// 当前用户ID // 当前用户ID
$userId = UserService::getCurrentLoginUserId(); $userId = UserService::getCurrentLoginUserId();
$info = self::get(['user_id' => $userId]); $info = self::get(['user_id' => $userId]);
if ($info->isEmpty()) { if (empty($info)) {
throwError('申请记录不存在'); throwError('申请记录不存在');
} }
$info = $info->toArray(); $info = $info->toArray();
@ -151,11 +152,23 @@ class Apply extends ApplyModel
'business' => $data['business'], 'business' => $data['business'],
'city' => $data['city'], 'city' => $data['city'],
]; ];
$res = $this->where(['user_id' => $userId])->update($data); if ($this->update($data, ['user_id' => $userId])) {
if ($res->getError()) { return true;
}
return false; return false;
} }
return true;
/**
* @notes:申请记录详情
* @return Apply|array|null
* @throws BaseException
* @author: wanghousheng
*/
public function getApplyInfo()
{
// 当前用户ID
$userId = UserService::getCurrentLoginUserId();
return self::get(['user_id' => $userId]);
} }
/** /**

Loading…
Cancel
Save