Browse Source

实名认证修改

lizhen_gitee 1 year ago
parent
commit
2b5efef7c8

+ 8 - 0
application/api/controller/Pay.php

@@ -35,6 +35,10 @@ class Pay extends Api
             $this->error('请选择会员套餐');
         }
 
+        if(!$this->user_auth_limit()){
+            $this->error('请先完成实名认证');
+        }
+
 
         //赋值money
         $recharge_config = Db::name('payvip_config')->where('id',$rc_id)->find();
@@ -113,6 +117,10 @@ class Pay extends Api
             $this->error('请选择或填写充值金额');
         }
 
+        if(!$this->user_auth_limit()){
+            $this->error('请先完成实名认证');
+        }
+
         //赋值money
         if($rc_id){
             $recharge_config = Db::name('paygold_webcon')->where('id',$rc_id)->find();

+ 8 - 0
application/api/controller/Payios.php

@@ -33,6 +33,10 @@ class Payios extends Api
             $this->error('请选择会员套餐');
         }
 
+        if(!$this->user_auth_limit()){
+            $this->error('请先完成实名认证');
+        }
+
         //赋值money
         $recharge_config = Db::name('payvip_config_ios')->where('id',$rc_id)->find();
         $money = $recharge_config['money'];
@@ -161,6 +165,10 @@ class Payios extends Api
             $this->error('请选择充值金额');
         }
 
+        if(!$this->user_auth_limit()){
+            $this->error('请先完成实名认证');
+        }
+
         //赋值money
         $recharge_config = Db::name('paygold_webcon_ios')->where('id',$rc_id)->find();
         $money = $recharge_config['money'] ?: 0;

+ 4 - 4
application/api/controller/Takecash.php

@@ -45,6 +45,10 @@ class Takecash extends Api
             $this->error('请选择或填写金额');
         }
 
+        if(!$this->user_auth_limit()){
+            $this->error('请先完成实名认证');
+        }
+
         //赋值money
         if($rc_id){
             $recharge_config = Db::name('take_cash_config')->where('id',$rc_id)->find();
@@ -72,10 +76,6 @@ class Takecash extends Api
             $this->error('提现金额不能大于'.$max);
         }
 
-        if(empty($this->auth->idcard_status)){
-            $this->error('请先完成实名认证');
-        }
-
         $check = Db::name('take_cash')->where(['user_id'=>$this->auth->id,'status'=>0])->find();
         if($check){
             $this->error('您已经申请了提现,请等待审核');

+ 1 - 1
application/api/controller/Userauth.php

@@ -69,7 +69,7 @@ class Userauth extends Api
             Cache::set('fourauth' . $this->auth->id, 1, $cache_time);
         } else {
             Cache::set('fourauth' . $this->auth->id, $time_count + 1, $cache_time);
-            if ($time_count > 20) {
+            if ($time_count > 5) {
                 $this->error('今日实名次数已到上限,明天再来吧');
             }
         }

+ 16 - 29
application/api/controller/Userbank.php

@@ -32,31 +32,19 @@ class Userbank extends Api
         $userId = $this->auth->id;
 
         //检测实名认证
-        if(config('site.user_auth_switch') == 1){
-            $userAuthWhere['user_id'] = $userId;
-            $userAuth = Db::name('user_idconfirm')->where($userAuthWhere)->find();
-            if (empty($userAuth)) {
-                $this->error('请先实名认证');
-            }
-            if ($userAuth['status'] != 1) {
-                $this->error('请先实名认证通过');
-            }
+
+        $userAuthWhere['user_id'] = $userId;
+        $userAuth = Db::name('user_idconfirm')->where($userAuthWhere)->find();
+        if (empty($userAuth)) {
+            $this->error('请先实名认证');
+        }
+        if ($userAuth['status'] != 1) {
+            $this->error('请先实名认证通过');
         }
 
         $truename = $userAuth['truename'];
         $idCard = $userAuth['idcard'];
 
-        //验证
-        /*$userService = new UserService();
-        $aliParams = [
-            'bank_no' => $bank_no,
-            'id_card' => $idCard,
-            'real_name' => $truename,
-        ];
-        $aliBankCheckRes = $userService->bankCheck($aliParams);
-        if (!$aliBankCheckRes['status']) {
-            $this->error($aliBankCheckRes['msg']);
-        }*/
 
         // 查询是否有过绑定
         $bankInfo = Db::name('user_bank')->where(["user_id"=>$userId])->find();
@@ -100,15 +88,14 @@ class Userbank extends Api
         $userId = $this->auth->id;
 
         //检测实名认证
-        if(config('site.user_auth_switch') == 1){
-            $userAuthWhere['user_id'] = $userId;
-            $userAuth = Db::name('user_idconfirm')->where($userAuthWhere)->find();
-            if (empty($userAuth)) {
-                $this->error('请先实名认证');
-            }
-            if ($userAuth['status'] != 1) {
-                $this->error('请先实名认证通过');
-            }
+
+        $userAuthWhere['user_id'] = $userId;
+        $userAuth = Db::name('user_idconfirm')->where($userAuthWhere)->find();
+        if (empty($userAuth)) {
+            $this->error('请先实名认证');
+        }
+        if ($userAuth['status'] != 1) {
+            $this->error('请先实名认证通过');
         }
 
 

+ 16 - 1
application/common/controller/Api.php

@@ -462,7 +462,7 @@ class Api
         return $result;
     }
 
-    //用户是否vip,1是,0否
+    //获取用户是否vip,1是,0否
     protected function is_vip($user_id){
         $result = 0;
 
@@ -498,5 +498,20 @@ class Api
         }
     }
 
+    //实名认证限制
+    //true  不需要实名认证
+    //false 需要实名认证
+    protected function user_auth_limit(){
+        $user_auth_switch = config('site.user_auth_switch');
+        if($user_auth_switch != 1){
+            return true;
+        }else{
+            if($this->auth->idcard_status == 1){
+                return true;
+            }
+        }
+
+        return false;
+    }
 
 }