|
|
|
@ -119,6 +119,13 @@ class Wholesaler extends Controller |
|
|
|
|
} catch (Exception $e) { |
|
|
|
|
return $this->renderError($e->getMessage() ?: '短信验证码不正确'); |
|
|
|
|
} |
|
|
|
|
$model = new Apply(); |
|
|
|
|
if ($model->where(['card_no' => $card_no])->exists()) { |
|
|
|
|
return $this->renderError('该身份证号已存在'); |
|
|
|
|
} |
|
|
|
|
if ($model->where(['business' => $business])->exists()) { |
|
|
|
|
return $this->renderError('营业执照已存在'); |
|
|
|
|
} |
|
|
|
|
$data = compact('company_name', 'credit_code', 'city_id', 'province_id', 'door_img_id', 'business', 'card_no', 'avatar_id'); |
|
|
|
|
$data = array_merge($data, compact('username', 'mobile', 'card_back_img_id', 'card_front_img_id', 'license_img_id')); |
|
|
|
|
$data['total_price'] = $priceInfo['price']; |
|
|
|
@ -222,6 +229,15 @@ class Wholesaler extends Controller |
|
|
|
|
if (!$avatar_id) { |
|
|
|
|
return $this->renderError('头像不能为空'); |
|
|
|
|
} |
|
|
|
|
$info = Apply::info(); |
|
|
|
|
if (empty($info->id)) { |
|
|
|
|
return $this->renderError('信息不存在'); |
|
|
|
|
} |
|
|
|
|
$model = new Apply(); |
|
|
|
|
$exists_id = $model->where(['card_no' => $card_no])->value('id'); |
|
|
|
|
if ($exists_id && $info->id != $exists_id) { |
|
|
|
|
return $this->renderError('该身份证号已存在'); |
|
|
|
|
} |
|
|
|
|
try { |
|
|
|
|
CaptchaApi::checkSms($mobile_code, $mobile); |
|
|
|
|
} catch (Exception $e) { |
|
|
|
@ -229,7 +245,7 @@ class Wholesaler extends Controller |
|
|
|
|
} |
|
|
|
|
$data = compact('company_name', 'credit_code', 'city_id', 'province_id', 'door_img_id', 'business', 'card_no', 'avatar_id'); |
|
|
|
|
$data = array_merge($data, compact('username', 'mobile', 'card_back_img_id', 'card_front_img_id', 'license_img_id')); |
|
|
|
|
if ((new Apply())->edit($data)) { |
|
|
|
|
if ((new Apply())->where()->edit($data)) { |
|
|
|
|
return $this->renderSuccess('操作成功'); |
|
|
|
|
} |
|
|
|
|
return $this->renderError('操作失败'); |
|
|
|
|