From ee59ee91b748d6088b4e02e65093113699c32221 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=8D=8E=E6=B8=85?= <18691022700@163.com> Date: Wed, 17 Sep 2025 22:39:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E5=90=8D=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/model/UserData.php | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/application/api/model/UserData.php b/application/api/model/UserData.php index da8a728..5dc24ac 100644 --- a/application/api/model/UserData.php +++ b/application/api/model/UserData.php @@ -287,11 +287,16 @@ class UserData extends Model if(empty($user_mobile)){ return ['code' => 0, 'msg' => '请先绑定手机号','data' =>null]; } - //查询是否已经提交过数据了 - $is_real = db::name('user_auth')->where(['card_id' => $id_card,'is_real' => 1])->find(); - if($is_real){ - return ['code' => 0, 'msg' => '已经提交审核了,请等待验证结果!','data' =>null]; + $card_id_count = db::name('user_auth')->where(['card_id' => $id_card,'is_real' => 1])->count(); + if($card_id_count >= 3){ + return ['code' => 0, 'msg' => '该身份证实名已达上限!','data' =>null]; } + //查询是否已经提交过数据了 + $is_real = db::name('user_auth')->where(['card_id' => $id_card,'is_real' => 1,'mobile' =>$user_mobile])->find(); + if($is_real){ + return ['code' => 0, 'msg' => '已经审核通过!请勿重复提交!','data' =>null]; + } + $auth = [ 'mobile' => $user_mobile, 'real_name' => $real_name, @@ -347,8 +352,17 @@ class UserData extends Model public function real_name_result($user_id,$orderNo) { $user_mobile = db::name('user')->where(['id' => $user_id,'status'=>1])->value('mobile'); + $id = db::name('user_auth')->where(['mobile' => $user_mobile,'is_real' => 3])->value('id'); + if($id){ + $res = db::name('user_auth')->where(['id' => ['<>',$id],'mobile' => $user_mobile])->select(); + if($res){ + foreach ($res as $key => $value) { + db::name('user_auth')->where('id' , $value['id'])->delete(); + } + } + } //修改状态 - $reslut = db::name('user_auth')->where('mobile' , $user_mobile)->update(['is_real' => 1]); + $reslut = db::name('user_auth')->where('id' , $id)->update(['is_real' => 1]); if(!$reslut){ return ['code' => 0, 'msg' => '实名失败','data' =>null]; }