diff --git a/app/api/controller/Wholesaler.php b/app/api/controller/Wholesaler.php index d28eaded..30fa5fab 100644 --- a/app/api/controller/Wholesaler.php +++ b/app/api/controller/Wholesaler.php @@ -120,10 +120,10 @@ class Wholesaler extends Controller return $this->renderError($e->getMessage() ?: '短信验证码不正确'); } $model = new Apply(); - if ($model->where(['card_no' => $card_no])->exists()) { + if ($model->where(['card_no' => $card_no])->value('id')) { return $this->renderError('该身份证号已存在'); } - if ($model->where(['credit_code' => $credit_code])->exists()) { + if ($model->where(['credit_code' => $credit_code])->value('id')) { return $this->renderError('营业执照已存在'); } $data = compact('company_name', 'credit_code', 'city_id', 'province_id', 'door_img_id', 'business', 'card_no', 'avatar_id'); diff --git a/app/store/model/dealer/User.php b/app/store/model/dealer/User.php index 536a10c2..308d65f2 100644 --- a/app/store/model/dealer/User.php +++ b/app/store/model/dealer/User.php @@ -12,6 +12,7 @@ declare (strict_types=1); namespace app\store\model\dealer; +use app\common\enum\user\UserTypeEnum; use app\common\model\dealer\User as UserModel; use app\store\model\dealer\Apply as ApplyModel; use app\store\model\dealer\Referee as RefereeModel; @@ -89,6 +90,9 @@ class User extends UserModel // 删除申请记录 $applyModel = new ApplyModel(); $applyModel->where(['user_id' => $this['user_id']])->delete(); + //修改会员身份 + $userModel = new \app\common\model\User(); + $userModel->where(['user_id' => $this['user_id']])->save(['user_type' => UserTypeEnum::NORMAL, 'fx_effective_time' => null]); $this->onDeleteReferee($this['user_id']); // 标记当前分销商记录为已删除 return $this->delete();