Userauth.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599
  1. <?php
  2. namespace app\api\controller;
  3. use app\common\controller\Api;
  4. use think\Db;
  5. use think\Cache;
  6. use TencentCloud\Common\Credential;
  7. use TencentCloud\Common\Profile\ClientProfile;
  8. use TencentCloud\Common\Profile\HttpProfile;
  9. use TencentCloud\Common\Exception\TencentCloudSDKException;
  10. //use TencentCloud\Faceid\V20180301\FaceidClient;
  11. //use TencentCloud\Faceid\V20180301\Models\IdCardVerificationRequest;
  12. use TencentCloud\Iai\V20200303\IaiClient;
  13. use TencentCloud\Iai\V20200303\Models\CompareFaceRequest;
  14. /**
  15. * 实名认证,真人认证相关
  16. */
  17. class Userauth extends Api
  18. {
  19. protected $noNeedLogin = [];
  20. protected $noNeedRight = '*';
  21. //实名认证信息
  22. public function idcard_info(){
  23. $check = Db::name('user_idconfirm')->where('user_id',$this->auth->id)->order('id desc')->find();
  24. $this->success('success',$check);
  25. }
  26. //申请实名认证
  27. public function apply_idcard_confirm(){
  28. $truename = input('truename','');
  29. $idcard = input('idcard' ,'');
  30. if(empty($truename) || empty($idcard)){
  31. $this->error('实名认证信息必填');
  32. }
  33. if($this->auth->idcard_status == 1){
  34. $this->error('您已经完成实名认证');
  35. }
  36. if($this->auth->idcard_status == 0){
  37. $this->error('您已经提交实名认证,请等待审核');
  38. }
  39. Db::startTrans();
  40. $check = Db::name('user_idconfirm')->where('user_id',$this->auth->id)->lock(true)->find();
  41. if(!empty($check)){
  42. if($check['status'] == 0){
  43. Db::rollback();
  44. $this->error('您已经提交实名认证,请等待审核');
  45. }
  46. if($check['status'] == 1){
  47. Db::rollback();
  48. $this->error('您已经完成实名认证');
  49. }
  50. }
  51. $count = Db::name('user_idconfirm')->where(['idcard' => $idcard, 'user_id' => ['neq', $this->auth->id]])->count('id');
  52. if ($count) {
  53. $this->error('该身份证号已被他人使用');
  54. }
  55. //限制每日请求次数
  56. $time = time();
  57. $today_end = strtotime(date('Y-m-d 23:59:59', $time));
  58. $cache_time = $today_end - $time; //缓存时间
  59. $time_count = Cache::get('fourauth' . $this->auth->id);
  60. if (!$time_count) {
  61. Cache::set('fourauth' . $this->auth->id, 1, $cache_time);
  62. } else {
  63. Cache::set('fourauth' . $this->auth->id, $time_count + 1, $cache_time);
  64. if ($time_count > 5) {
  65. $this->error('今日实名次数已到上限,明天再来吧');
  66. }
  67. }
  68. if($this->auth->gender == 0){
  69. //阿里云身份证二要素认证
  70. $auth_restult = $this->userauth_aliyun_two($idcard, $truename);
  71. if($auth_restult == false){
  72. $this->error('身份证信息与姓名不符');
  73. }
  74. }
  75. $data = [
  76. 'user_id' => $this->auth->id,
  77. 'truename' => $truename,
  78. 'idcard' => $idcard,
  79. 'status' => 1, //不需要人工刚审核了,直接过审
  80. 'createtime' => time(),
  81. 'updatetime' => time(),
  82. ];
  83. if($this->auth->gender == 1){
  84. $data['status'] = 0;//男性待审
  85. }
  86. //更新
  87. $update_rs = Db::name('user')->where('id',$this->auth->id)->update(['idcard_status'=>$data['status']]);
  88. if(!empty($check)){
  89. $rs = Db::name('user_idconfirm')->where('id',$check['id'])->update($data);
  90. }else{
  91. $rs = Db::name('user_idconfirm')->insertGetId($data);
  92. }
  93. if($this->auth->gender == 0){
  94. //task任务
  95. //实名认证
  96. $task_rs = \app\common\model\TaskLog::tofinish($this->auth->id,5);
  97. if($task_rs === false){
  98. Db::rollback();
  99. $this->error('完成任务失败');
  100. }
  101. //系统消息
  102. $msg_id = \app\common\model\Message::addMessage($this->auth->id,'实名认证','实名认证已经审核通过');
  103. }
  104. if(!$rs || !$update_rs){
  105. Db::rollback();
  106. $this->error('提交失败');
  107. }
  108. Db::commit();
  109. if($this->auth->gender == 0){
  110. $this->success('认证通过');
  111. }else{
  112. $this->success('提交成功,请等待审核');
  113. }
  114. }
  115. //产品链接:https://market.aliyun.com/products/57000002/cmapi026109.html#sku=yuncode20109000025
  116. //阿里云-数脉api
  117. //姓名+身份证号
  118. private function userauth_aliyun_two($cardNo = '',$realname = ''){
  119. if(!$cardNo || !$realname){
  120. return false;
  121. }
  122. $config = config('aliyun_auth_shumai_two');
  123. $host = "https://eid.shumaidata.com";
  124. $path = "/eid/check";
  125. $method = "POST";
  126. $appcode = $config['app_code'];
  127. $headers = array();
  128. array_push($headers, "Authorization:APPCODE " . $appcode);
  129. $querys = "idcard=".$cardNo."&name=".urlencode($realname);
  130. $bodys = '';
  131. $url = $host . $path . "?" . $querys;
  132. $curl = curl_init();
  133. curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
  134. curl_setopt($curl, CURLOPT_URL, $url);
  135. curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
  136. curl_setopt($curl, CURLOPT_FAILONERROR, false);
  137. curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  138. //设定返回信息中是否包含响应信息头,启用时会将头文件的信息作为数据流输出,true 表示输出信息头, false表示不输出信息头
  139. //如果需要将字符串转成json,请将 CURLOPT_HEADER 设置成 false
  140. curl_setopt($curl, CURLOPT_HEADER, false);
  141. if (1 == strpos("$".$host, "https://"))
  142. {
  143. curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
  144. curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
  145. }
  146. $returnRes = curl_exec($curl);
  147. //var_dump($returnRes);
  148. curl_close($curl);
  149. $result = json_decode($returnRes,true);
  150. //dump($result);
  151. if(is_array($result) && isset($result['code']) && $result['code'] == 0){
  152. if(isset($result['result']) && isset($result['result']['res'])){
  153. if($result['result']['res'] == 1){
  154. //实名过了
  155. return true;
  156. }
  157. }
  158. }
  159. return false;
  160. }
  161. //产品链接:https://market.aliyun.com/products/57000002/cmapi026100.html?spm=5176.730005.result.8.1dbc123e8ArY19&innerSource=search#sku=yuncode2010000006
  162. //阿里云-数脉api
  163. //姓名+手机号+身份证号
  164. private function userauth_aliyun_three($cardNo = '',$realname = '',$mobile = ''){
  165. if(!$cardNo || !$realname || !$mobile){
  166. return false;
  167. }
  168. $config = config('aliyun_auth_shumai');
  169. $host = "https://mobile3elements.shumaidata.com";
  170. $path = "/mobile/verify_real_name";
  171. $method = "POST";
  172. $appcode = $config['app_code'];
  173. $headers = array();
  174. array_push($headers, "Authorization:APPCODE " . $appcode);
  175. //根据API的要求,定义相对应的Content-Type
  176. array_push($headers, "Content-Type".":"."application/x-www-form-urlencoded; charset=UTF-8");
  177. $querys = "";
  178. $bodys = "idcard=".$cardNo."&mobile=".$mobile."&name=".urlencode($realname);
  179. $url = $host . $path;
  180. $curl = curl_init();
  181. curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
  182. curl_setopt($curl, CURLOPT_URL, $url);
  183. curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
  184. curl_setopt($curl, CURLOPT_FAILONERROR, false);
  185. curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  186. //设定返回信息中是否包含响应信息头,启用时会将头文件的信息作为数据流输出,true 表示输出信息头, false表示不输出信息头
  187. //如果需要将字符串转成json,请将 CURLOPT_HEADER 设置成 false
  188. curl_setopt($curl, CURLOPT_HEADER, false);
  189. if (1 == strpos("$".$host, "https://"))
  190. {
  191. curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
  192. curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
  193. }
  194. curl_setopt($curl, CURLOPT_POSTFIELDS, $bodys);
  195. $returnRes = curl_exec($curl);
  196. curl_close($curl);
  197. $result = json_decode($returnRes,true);
  198. if(is_array($result) && isset($result['code']) && $result['code'] == 0){
  199. if(isset($result['result']) && isset($result['result']['res'])){
  200. if($result['result']['res'] == 1){
  201. //实名过了
  202. return true;
  203. }
  204. }
  205. }
  206. return false;
  207. }
  208. ///////////////////////////////////////////真人认证,来自知音////////////
  209. //申请真人认证
  210. public function realauth() {
  211. if ($this->auth->real_status == 1) {
  212. $this->error('您已经真人认证过了~');
  213. }
  214. if ($this->auth->avatar == config('avatar_boy') || $this->auth->avatar == config('avatar_girl')) {
  215. $this->error('请先上传真人头像~');
  216. }
  217. $check = Db::name('user_audit')->where('user_id',$this->auth->id)->where('type','avatar')->where('status',0)->find();
  218. if(!empty($check)){
  219. $this->error('您的头像还在审核中,审核完成在认证吧');
  220. }
  221. //获取token
  222. $token_url = 'https://miniprogram-kyc.tencentcloudapi.com/api/oauth2/access_token?app_id='.config('tencent_yun')['secret_id'].'&secret='.config('tencent_yun')['secret_key'].'&grant_type=client_credential&version=1.0.0';
  223. $token_result = file_get_contents($token_url);
  224. if (!$token_result) {
  225. $this->error('您的网络开小差啦1~');
  226. }
  227. $token_result = json_decode($token_result, true);
  228. if ($token_result['code'] != 0) {
  229. $this->error('您的网络开小差啦2~');
  230. }
  231. $token = $token_result['access_token'];
  232. //获取签名鉴权参数ticket
  233. $ticket_url = 'https://miniprogram-kyc.tencentcloudapi.com/api/oauth2/api_ticket?app_id='.config('tencent_yun')['secret_id'].'&access_token='.$token.'&type=SIGN&version=1.0.0';
  234. $ticket_result = file_get_contents($ticket_url);
  235. if (!$ticket_result) {
  236. $this->error('您的网络开小差啦3~');
  237. }
  238. $ticket_result = json_decode($ticket_result, true);
  239. if ($ticket_result['code'] != 0) {
  240. $this->error('您的网络开小差啦4~');
  241. }
  242. $ticket = $ticket_result['tickets'][0]['value'];
  243. //获取签名
  244. $sign_data = [
  245. 'wbappid' => config('tencent_yun')['secret_id'],
  246. 'userId' => (string)$this->auth->id,
  247. 'version' => '1.0.0',
  248. 'ticket' => $ticket,
  249. 'nonce' => Random::alnum(32)
  250. ];//p($sign_data);
  251. asort($sign_data); //p($sign_data);//排序
  252. $sign_string = join('', $sign_data);//p($sign_string);
  253. $sign = sha1($sign_string);//p($sign);
  254. //上传身份信息
  255. $orderNo = getMillisecond() . $this->auth->id . mt_rand(1, 1000); //商户请求的唯一标识
  256. $url = 'https://miniprogram-kyc.tencentcloudapi.com/api/server/getAdvFaceId?orderNo=' . $orderNo;
  257. $avatar = one_domain_image($this->auth->avatar);
  258. $avatar = str_replace('https', 'http', $avatar);
  259. $img = file_get_contents($avatar);
  260. $img = str_replace('data:image/jpg;base64', '', $img);
  261. $img = str_replace('\n', '', $img);
  262. $sourcePhotoStr = base64_encode($img);
  263. $data = [
  264. 'webankAppId' => config('tencent_yun')['secret_id'],
  265. 'orderNo' => $orderNo,
  266. 'userId' => (string)$this->auth->id,
  267. 'sourcePhotoStr' => $sourcePhotoStr,
  268. 'sourcePhotoType' => 2,
  269. 'version' => '1.0.0',
  270. 'sign' => $sign,
  271. 'nonce' => $sign_data['nonce']
  272. ];
  273. $rs = curl_post($url,json_encode($data, 320), ['Content-Type: application/json']);
  274. if (!$rs) {
  275. $this->error('您的网络开小差啦5~');
  276. }
  277. $rs = json_decode($rs, true);
  278. if (!$rs || $rs['code'] != 0) {
  279. $this->error('您的网络开小差啦6~');
  280. }
  281. $user_auth = [
  282. 'user_id' => $this->auth->id,
  283. 'certify_id' => $rs['result']['faceId'],
  284. 'out_trade_no' => $data['orderNo'],
  285. 'status' => 0,
  286. 'createtime' => time(),
  287. 'updatetime' => time()
  288. ];
  289. //开启事务
  290. Db::startTrans();
  291. //查询是否认证过
  292. $info = Db::name('user_auth')->where(['user_id' => $this->auth->id])->find();
  293. if ($info) {
  294. $auth_rs = Db::name('user_auth')->where(['id' => $info['id']])->setField($user_auth);
  295. } else {
  296. $auth_rs = Db::name('user_auth')->insertGetId($user_auth);
  297. }
  298. if (!$auth_rs) {
  299. Db::rollback();
  300. $this->error('您的网络开小差啦7~');
  301. }
  302. //修改用户表认证状态
  303. $user_rs = Db::name('user')->where(['id' => $this->auth->id])->setField('real_status', 0);
  304. if ($user_rs === false) {
  305. Db::rollback();
  306. $this->error('您的网络开小差啦8~');
  307. }
  308. Db::commit();
  309. $return_data = [
  310. 'face_id' => $user_auth['certify_id'],
  311. 'order_no' => $user_auth['out_trade_no'],
  312. 'user_id' => (string)$this->auth->id,
  313. 'nonce' => $sign_data['nonce'],
  314. 'sign' => $sign
  315. ];
  316. $this->success('success', $return_data);
  317. }
  318. //查询真人认证结果
  319. public function getrealauthresult() {
  320. $user_auth = Db::name('user_auth')->where(['user_id' => $this->auth->id])->find();
  321. if (!$user_auth) {
  322. $this->success('尚未认证');
  323. }
  324. if ($user_auth['status'] == 1) {
  325. $this->success('真人认证通过');
  326. }
  327. if (!$user_auth['certify_id']) {
  328. $this->success('请先进行真人认证');
  329. }
  330. //获取token
  331. $token_url = 'https://miniprogram-kyc.tencentcloudapi.com/api/oauth2/access_token?app_id='.config('tencent_yun')['secret_id'].'&secret='.config('tencent_yun')['secret_key'].'&grant_type=client_credential&version=1.0.0';
  332. $token_result = file_get_contents($token_url);
  333. if (!$token_result) {
  334. $this->error('您的网络开小差啦1~');
  335. }
  336. $token_result = json_decode($token_result, true);
  337. if ($token_result['code'] != 0) {
  338. $this->error('您的网络开小差啦2~');
  339. }
  340. $token = $token_result['access_token'];
  341. //获取签名鉴权参数ticket
  342. $ticket_url = 'https://miniprogram-kyc.tencentcloudapi.com/api/oauth2/api_ticket?app_id='.config('tencent_yun')['secret_id'].'&access_token='.$token.'&type=SIGN&version=1.0.0';
  343. $ticket_result = file_get_contents($ticket_url);
  344. if (!$ticket_result) {
  345. $this->error('您的网络开小差啦3~');
  346. }
  347. $ticket_result = json_decode($ticket_result, true);
  348. if ($ticket_result['code'] != 0) {
  349. $this->error('您的网络开小差啦4~');
  350. }
  351. $ticket = $ticket_result['tickets'][0]['value'];
  352. //获取签名
  353. $sign_data = [
  354. 'wbappid' => config('tencent_yun')['secret_id'],
  355. 'orderNo' => $user_auth['out_trade_no'],
  356. 'version' => '1.0.0',
  357. 'ticket' => $ticket,
  358. 'nonce' => Random::alnum(32)
  359. ];//p($sign_data);
  360. asort($sign_data); //p($sign_data);//排序
  361. $sign_string = join('', $sign_data);//p($sign_string);
  362. $sign = sha1($sign_string);//p($sign);
  363. //人脸核身结果查询
  364. $url = 'https://miniprogram-kyc.tencentcloudapi.com/api/v2/base/queryfacerecord?orderNo=' . $user_auth['out_trade_no'];
  365. $data = [
  366. 'appId' => config('tencent_yun')['secret_id'],
  367. 'version' => '1.0.0',
  368. 'nonce' => $sign_data['nonce'],
  369. 'orderNo' => $user_auth['out_trade_no'],
  370. 'sign' => $sign
  371. ];
  372. $rs = curl_post($url,json_encode($data, 320), ['Content-Type: application/json']);
  373. if (!$rs) {
  374. $this->error('您的网络开小差啦5~');
  375. }
  376. $rs = json_decode($rs, true);
  377. if (!$rs || $rs['code'] != 0) {
  378. $this->error($rs['msg']);
  379. }
  380. if ($rs['result']['liveRate'] >= 90 && $rs['result']['similarity'] >= 90) {
  381. $edit_data['status'] = 1;
  382. $msg = '真人认证成功';
  383. } else {
  384. $edit_data['status'] = 2;
  385. $edit_data['certify_id'] = '';
  386. $edit_data['out_trade_no'] = '';
  387. $msg = '真人认证失败';
  388. }
  389. $edit_data['updatetime'] = time();
  390. //开启事务
  391. Db::startTrans();
  392. //修改认证信息
  393. $result = Db::name('user_auth')->where(['user_id' => $this->auth->id, 'status' => $user_auth['status']])->setField($edit_data);
  394. if (!$result) {
  395. Db::rollback();
  396. $this->error('查询认证结果失败2');
  397. }
  398. //修改用户信息
  399. $rs = Db::name('user')->where(['id' => $this->auth->id])->setField('real_status', $edit_data['status']);
  400. if (!$rs) {
  401. Db::rollback();
  402. $this->error('查询认证结果失败3');
  403. }
  404. if ($edit_data['status'] == 1) { //通过
  405. //tag任务赠送金币
  406. //真人认证奖励
  407. $task_rs = \app\common\model\TaskLog::tofinish($this->auth->id,6);
  408. if($task_rs === false){
  409. Db::rollback();
  410. $this->error('完成任务赠送奖励失败');
  411. }
  412. //系统消息
  413. $msg_id = \app\common\model\Message::addMessage($this->auth->id,'真人认证','真人认证已经审核通过');
  414. } else {
  415. //系统消息
  416. $msg_id = \app\common\model\Message::addMessage($this->auth->id,'真人认证','真人认证审核不通过');
  417. }
  418. Db::commit();
  419. $this->success($msg);
  420. }
  421. //真人认证后修改头像
  422. public function editrealavatar() {
  423. if ($this->auth->real_status != 1) {
  424. $this->error('尚未通过真人认证');
  425. }
  426. $avatar = input('avatar', '', 'trim'); //头像地址
  427. if ($avatar === '') {
  428. $this->error('参数缺失');
  429. }
  430. $avatar = one_domain_image($avatar);
  431. $now_avatar = one_domain_image($this->auth->avatar);
  432. if ($avatar == $now_avatar) {
  433. $this->error('头像未改变');
  434. }
  435. //腾讯云人脸识别
  436. $auit_result = $this->face_tencent($now_avatar, $avatar); //1通过 0拒绝
  437. if ($auit_result != 1) {
  438. $this->success('提示', ['code' => 2]);
  439. }
  440. $data['avatar'] = $avatar;
  441. $user_result = Db::name('user')->where(['id' => $this->auth->id])->setField($data);
  442. if (!$user_result) {
  443. $this->error('修改失败');
  444. }
  445. $this->success('修改成功');
  446. }
  447. //真人认证后修改头像并取消真人认证
  448. public function editrealavatarcancelauit() {
  449. if ($this->auth->real_status != 1) {
  450. $this->error('尚未通过真人认证');
  451. }
  452. $avatar = input('avatar', '', 'trim'); //头像地址
  453. if ($avatar === '') {
  454. $this->error('参数缺失');
  455. }
  456. $avatar = one_domain_image($avatar);
  457. $now_avatar = one_domain_image($this->auth->avatar);
  458. if ($avatar == $now_avatar) {
  459. $this->error('头像未改变');
  460. }
  461. $data['avatar'] = $avatar;
  462. $data['real_status'] = -1;
  463. //开启事务
  464. Db::startTrans();
  465. $user_result = Db::name('user')->where(['id' => $this->auth->id])->setField($data);
  466. if (!$user_result) {
  467. Db::rollback();
  468. $this->error('修改失败');
  469. }
  470. $user_auth_result = Db::name('user_auth')->where(['user_id' => $this->auth->id])->delete();
  471. if (!$user_auth_result) {
  472. Db::rollback();
  473. $this->error('修改失败');
  474. }
  475. Db::commit();
  476. $this->success('修改成功');
  477. }
  478. //腾讯云人脸识别
  479. public function face_tencent($urla = '', $urlb = '') {
  480. // require_once 'vendor/autoload.php';
  481. try {
  482. // 实例化一个认证对象,入参需要传入腾讯云账户secretId,secretKey,此处还需注意密钥对的保密
  483. // 密钥可前往https://console.cloud.tencent.com/cam/capi网站进行获取
  484. $config = config('tencent_realauth');
  485. $cred = new Credential($config['SecretId'], $config['SecretKey']);
  486. // 实例化一个http选项,可选的,没有特殊需求可以跳过
  487. $httpProfile = new HttpProfile();
  488. $httpProfile->setEndpoint("iai.tencentcloudapi.com");
  489. // 实例化一个client选项,可选的,没有特殊需求可以跳过
  490. $clientProfile = new ClientProfile();
  491. $clientProfile->setHttpProfile($httpProfile);
  492. // 实例化要请求产品的client对象,clientProfile是可选的
  493. $client = new IaiClient($cred, "ap-beijing", $clientProfile);
  494. // 实例化一个请求对象,每个接口都会对应一个request对象
  495. $req = new CompareFaceRequest();
  496. $params = array(
  497. "UrlA" => $urla,
  498. "UrlB" => $urlb,
  499. "FaceModelVersion" => "3.0"
  500. );
  501. $req->fromJsonString(json_encode($params));
  502. // 返回的resp是一个CompareFaceResponse的实例,与请求对象对应
  503. $resp = $client->CompareFace($req);
  504. // 输出json格式的字符串回包
  505. // print_r($resp->toJsonString());
  506. $result = json_decode($resp->toJsonString(), true);
  507. //3.0版本误识率千分之一对应分数为40分,误识率万分之一对应分数为50分,误识率十万分之一对应分数为60分。 一般超过50分则可认定为同一人。
  508. if (isset($result['Score']) && $result['Score'] >= 60) {
  509. return 1; //通过
  510. } else {
  511. return 0;
  512. }
  513. }
  514. catch(TencentCloudSDKException $e) {
  515. // echo $e;
  516. return 0;
  517. }
  518. }
  519. }