wang hou sheng 8 months ago
parent 8861e84f0c
commit 4bc43e13b8
  1. 17
      app/api/controller/Wholesaler.php
  2. 1
      app/api/service/wholesaler/PaySuccess.php
  3. 10
      app/common/model/wholesaler/Apply.php

@ -109,13 +109,17 @@ class Wholesaler extends Controller
if (!$business) {
return $this->renderError('经营类目不能为空');
}
$avatar_id = intval($this->request->post('avatar_id'));
if (!$avatar_id) {
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 = 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'];
$data['pay_price'] = $priceInfo['price'];
@ -135,7 +139,7 @@ class Wholesaler extends Controller
*/
public function applyInfo(): Json
{
$info = Apply::info(['cardFrontImg', 'cardBackImg', 'licenseImg', 'doorImg']);
$info = Apply::info(['cardFrontImg', 'cardBackImg', 'licenseImg', 'doorImg', 'avatarImg']);
if (!empty($info->cardFrontImg)) {
unset($info->cardFrontImg);
}
@ -148,6 +152,9 @@ class Wholesaler extends Controller
if (!empty($info->doorImg)) {
unset($info->doorImg);
}
if (!empty($info->avatarImg)) {
unset($info->avatarImg);
}
return $this->renderSuccess(compact('info'));
}
@ -211,13 +218,17 @@ class Wholesaler extends Controller
if (!$business) {
return $this->renderError('经营类目不能为空');
}
$avatar_id = intval($this->request->post('avatar_id'));
if (!$avatar_id) {
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 = 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)) {
return $this->renderSuccess('操作成功');

@ -338,6 +338,7 @@ class PaySuccess extends BaseService
$add['credit_code'] = $orderInfo['credit_code'];
$add['business'] = $orderInfo['business'];
$add['user_id'] = $orderInfo['user_id'];
$add['avatar_id'] = $orderInfo['avatar_id'];
$info = Apply::detail(['user_id' => $orderInfo['user_id']]);
if (empty($info->id)) {
(new Apply())->add($add);

@ -72,6 +72,16 @@ class Apply extends BaseModel
->bind(['door_img' => 'preview_url']);
}
/**
* 门头照片
* @return HasOne
*/
public function avatarImg(): HasOne
{
return $this->hasOne(UploadFile::class, 'file_id', 'avatar_id')
->bind(['avatar_img' => 'preview_url']);
}
/**
* @notes:地区名称
* @param $value

Loading…
Cancel
Save