Przeglądaj źródła

阿里数脉二要素

lizhen_gitee 1 rok temu
rodzic
commit
328b4353ba
2 zmienionych plików z 62 dodań i 6 usunięć
  1. 51 1
      application/api/controller/Userauth.php
  2. 11 5
      application/config.php

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

@@ -83,7 +83,7 @@ class Userauth extends Api
         }
 
         //阿里云身份证三要素认证
-        $auth_restult = $this->userauth_aliyun_three($idcard, $truename,$this->auth->simplemobile);
+        $auth_restult = $this->userauth_aliyun_two($idcard, $truename,$this->auth->mobile);
         if($auth_restult == false){
             $this->error('身份证信息与姓名或注册手机号不符');
         }
@@ -127,7 +127,57 @@ class Userauth extends Api
     }
 
 
+    //产品链接:https://market.aliyun.com/products/57000002/cmapi026109.html#sku=yuncode20109000025
+    //阿里云-数脉api
+    //姓名+身份证号
+    private function userauth_aliyun_two($cardNo = '',$realname = ''){
+        if(!$cardNo || !$realname){
+            return false;
+        }
+
+        $config = config('aliyun_auth_shumai_two');
+
+        $host = "https://eid.shumaidata.com";
+        $path = "/eid/check";
+        $method = "POST";
+        $appcode = $config['app_code'];
+        $headers = array();
+        array_push($headers, "Authorization:APPCODE " . $appcode);
+
+        $querys = "idcard=".$cardNo."&name=".urlencode($realname);
+        $bodys  = '';
+        $url = $host . $path . "?" . $querys;
+
+        $curl = curl_init();
+        curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
+        curl_setopt($curl, CURLOPT_URL, $url);
+        curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
+        curl_setopt($curl, CURLOPT_FAILONERROR, false);
+        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
+        //设定返回信息中是否包含响应信息头,启用时会将头文件的信息作为数据流输出,true 表示输出信息头, false表示不输出信息头
+        //如果需要将字符串转成json,请将 CURLOPT_HEADER 设置成 false
+        curl_setopt($curl, CURLOPT_HEADER, false);
+        if (1 == strpos("$".$host, "https://"))
+        {
+            curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
+            curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
+        }
+        $returnRes = curl_exec($curl);
+        //var_dump($returnRes);
+        curl_close($curl);
+        $result = json_decode($returnRes,true);
+        //dump($result);
 
+        if(is_array($result) && isset($result['code']) && $result['code'] == 0){
+            if(isset($result['result']) && isset($result['result']['res'])){
+                if($result['result']['res'] == 1){
+                    //实名过了
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
     //产品链接:https://market.aliyun.com/products/57000002/cmapi026100.html?spm=5176.730005.result.8.1dbc123e8ArY19&innerSource=search#sku=yuncode2010000006
     //阿里云-数脉api
     //姓名+手机号+身份证号

+ 11 - 5
application/config.php

@@ -369,11 +369,11 @@ return [
         'app_code' => '',
     ],
 
-    //阿里云实名认证要素,正式数脉
-    'aliyun_auth_shumai' => [
-        'app_key'    => '204165018',
-        'app_secret' => 'owfeQdhvhzq988fC4iOz2YjnSGOk7sFX',
-        'app_code'   => '70754381570645739ce7bfb56268a483',
+    //阿里云实名认证要素,正式数脉
+    'aliyun_auth_shumai_two' => [
+        'app_key'    => '204562981',
+        'app_secret' => '8F52sWanDJF7pXfrSZVLxIMZeDzWuuff',
+        'app_code'   => 'a4c5dc1c580a4d9dab323286c2780328',
     ],
 
     //阿里云短信配置,正式
@@ -391,5 +391,11 @@ return [
         'client_secret' => 'YXA6KhfJfqyJYBn2I20DdgTEzWpx5Cs',
     ],
 
+    //人民币充值成金币,比例
+    'rmb_to_gold' => 10,
+
+    //金币提现成人民币
+    'gold_tk_rmb' => 10,
+
 
 ];