diff --git a/app/api/controller/Wholesaler.php b/app/api/controller/Wholesaler.php index fbf6bf72..cca416ee 100644 --- a/app/api/controller/Wholesaler.php +++ b/app/api/controller/Wholesaler.php @@ -9,6 +9,7 @@ use think\db\exception\DataNotFoundException; use think\db\exception\DbException; use think\db\exception\ModelNotFoundException; use think\response\Json; +use yiovo\captcha\CaptchaApi; class Wholesaler extends Controller { @@ -68,12 +69,6 @@ class Wholesaler extends Controller if (!$mobile_code) { return $this->renderError('手机号验证码不能为空'); } - // 验证短信验证码是否匹配 -// try { -// CaptchaApi::checkSms($mobile_code, $mobile); -// } catch (Exception $e) { -// return $this->renderError($e->getMessage() ?: '短信验证码不正确'); -// } $card_front_img_id = intval($this->request->post('card_front_img_id')); if (!$card_front_img_id) { return $this->renderError('身份证正面不能为空'); @@ -114,6 +109,12 @@ class Wholesaler extends Controller if (!$business) { return $this->renderError('经营类目不能为空'); } + // 验证短信验证码是否匹配 + try { + CaptchaApi::checkSms($mobile_code, $mobile); + } catch (Exception $e) { + return $this->renderError($e->getMessage() ?: '短信验证码不正确'); + } $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')); $data['total_price'] = $priceInfo['price']; @@ -210,6 +211,12 @@ class Wholesaler extends Controller if (!$business) { return $this->renderError('经营类目不能为空'); } + // 验证短信验证码是否匹配 + try { + CaptchaApi::checkSms($mobile_code, $mobile); + } catch (Exception $e) { + return $this->renderError($e->getMessage() ?: '短信验证码不正确'); + } $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)) {