|
|
|
@ -2,6 +2,7 @@ |
|
|
|
|
|
|
|
|
|
namespace app\api\controller; |
|
|
|
|
|
|
|
|
|
use app\api\model\wholesaler\Apply; |
|
|
|
|
use app\api\model\wholesaler\Set; |
|
|
|
|
use cores\exception\BaseException; |
|
|
|
|
use think\db\exception\DataNotFoundException; |
|
|
|
@ -125,4 +126,96 @@ class Wholesaler extends Controller |
|
|
|
|
return $this->renderSuccess($data, $service->getMessage() ?: '申请成功'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @notes:申请记录详情 |
|
|
|
|
* @return Json |
|
|
|
|
* @throws BaseException |
|
|
|
|
* @author: wanghousheng |
|
|
|
|
*/ |
|
|
|
|
public function applyInfo(): Json |
|
|
|
|
{ |
|
|
|
|
$info = Apply::info(['cardFrontImg', 'cardBackImg', 'licenseImg', 'doorImg']); |
|
|
|
|
if (!empty($info->cardFrontImg)) { |
|
|
|
|
unset($info->cardFrontImg); |
|
|
|
|
} |
|
|
|
|
if (!empty($info->cardBackImg)) { |
|
|
|
|
unset($info->cardBackImg); |
|
|
|
|
} |
|
|
|
|
if (!empty($info->licenseImg)) { |
|
|
|
|
unset($info->licenseImg); |
|
|
|
|
} |
|
|
|
|
if (!empty($info->doorImg)) { |
|
|
|
|
unset($info->doorImg); |
|
|
|
|
} |
|
|
|
|
return $this->renderSuccess(compact('info')); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @notes:编辑申请记录 |
|
|
|
|
* @return Json |
|
|
|
|
* @throws BaseException |
|
|
|
|
* @author: wanghousheng |
|
|
|
|
*/ |
|
|
|
|
public function editApply(): Json |
|
|
|
|
{ |
|
|
|
|
$username = $this->request->post('username'); |
|
|
|
|
if (!$username) { |
|
|
|
|
return $this->renderError('姓名不能为空'); |
|
|
|
|
} |
|
|
|
|
$mobile = $this->request->post('mobile'); |
|
|
|
|
if (!$mobile) { |
|
|
|
|
return $this->renderError('手机号不能为空'); |
|
|
|
|
} |
|
|
|
|
$mobile_code = $this->request->post('mobile_code'); |
|
|
|
|
if (!$mobile_code) { |
|
|
|
|
return $this->renderError('手机号验证码不能为空'); |
|
|
|
|
} |
|
|
|
|
$card_front_img_id = intval($this->request->post('card_front_img_id')); |
|
|
|
|
if (!$card_front_img_id) { |
|
|
|
|
return $this->renderError('身份证正面不能为空'); |
|
|
|
|
} |
|
|
|
|
$card_back_img_id = intval($this->request->post('card_back_img_id')); |
|
|
|
|
if (!$card_back_img_id) { |
|
|
|
|
return $this->renderError('身份证反面不能为空'); |
|
|
|
|
} |
|
|
|
|
$license_img_id = intval($this->request->post('license_img_id')); |
|
|
|
|
if (!$license_img_id) { |
|
|
|
|
return $this->renderError('营业执照不能为空'); |
|
|
|
|
} |
|
|
|
|
$card_no = $this->request->post('card_no'); |
|
|
|
|
if (!$card_no) { |
|
|
|
|
return $this->renderError('身份证号不能为空'); |
|
|
|
|
} |
|
|
|
|
$door_img_id = intval($this->request->post('door_img_id')); |
|
|
|
|
if (!$door_img_id) { |
|
|
|
|
return $this->renderError('门口照片不能为空'); |
|
|
|
|
} |
|
|
|
|
$province_id = intval($this->request->post('province_id')); |
|
|
|
|
if (!$province_id) { |
|
|
|
|
return $this->renderError('省份不能为空'); |
|
|
|
|
} |
|
|
|
|
$city_id = intval($this->request->post('city_id')); |
|
|
|
|
if (!$city_id) { |
|
|
|
|
return $this->renderError('城市不能为空'); |
|
|
|
|
} |
|
|
|
|
$company_name = $this->request->post('company_name'); |
|
|
|
|
if (!$company_name) { |
|
|
|
|
return $this->renderError('公司名称不能为空'); |
|
|
|
|
} |
|
|
|
|
$credit_code = $this->request->post('credit_code'); |
|
|
|
|
if (!$credit_code) { |
|
|
|
|
return $this->renderError('社会信用代码不能为空'); |
|
|
|
|
} |
|
|
|
|
$business = $this->request->post('business'); |
|
|
|
|
if (!$business) { |
|
|
|
|
return $this->renderError('经营类目不能为空'); |
|
|
|
|
} |
|
|
|
|
$data = compact('company_name', 'credit_code', 'city_id', 'province_id', 'door_img_id', 'business', 'card_no'); |
|
|
|
|
$data = array_merge($data, compact('username', 'mobile', 'card_back_img_id', 'card_front_img_id', 'license_img_id')); |
|
|
|
|
if ((new Apply())->edit($data)) { |
|
|
|
|
return $this->renderSuccess('操作成功'); |
|
|
|
|
} |
|
|
|
|
return $this->renderError('操作失败'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |