| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 | 
							- <?php
 
- namespace app\api\controller;
 
- use app\common\controller\Api;
 
- use think\Db;
 
- /**
 
-  * 人脸核身
 
-  */
 
- class Renlian extends Api
 
- {
 
-     protected $noNeedLogin = [];
 
-     protected $noNeedRight = ['*'];
 
-     public function access_token(){
 
-         $config = config('renlian');
 
-         $appid  = $config['appid'];
 
-         $secret = $config['secret'];
 
-         $url = 'https://miniprogram-kyc.tencentcloudapi.com/api/oauth2/access_token?app_id='.$appid.'&secret='.$secret.'&grant_type=client_credential&version=1.0.0';
 
-         $result = curl_get($url);
 
-         $token = '';
 
-         if($result){
 
-             $result = json_decode($result,true);
 
-             if($result['code'] == 0 && isset($result['access_token'])){
 
-                 $token = $result['access_token'];
 
-             }
 
-         }
 
-         return $token;
 
-     }
 
-     public function nonce_ticket(){
 
-         $config = config('renlian');
 
-         $appid  = $config['appid'];
 
-         $secret = $config['secret'];
 
-         $token = $this->access_token();
 
-         $url = 'https://miniprogram-kyc.tencentcloudapi.com/api/oauth2/api_ticket?app_id='.$appid.'&access_token='.$token.'&type=NONCE&version=1.0.0&user_id='.$this->auth->id;
 
-         $tickets = '';
 
-         $result = curl_get($url);
 
- //        dump($result);
 
-         if($result){
 
-             $result = json_decode($result,true);
 
-             if($result['code'] == 0 && isset($result['tickets'][0]['value'])){
 
-                 $tickets = $result['tickets'][0]['value'];
 
-             }
 
-         }
 
-         $this->success('success',$tickets);
 
-     }
 
-     public function sdksign(){
 
-         $config = config('renlian');
 
-         $appid  = $config['appid'];
 
-         $secret = $config['secret'];
 
-     }
 
- }
 
 
  |