Userauth.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595
  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. //获取token
  218. $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';
  219. $token_result = file_get_contents($token_url);
  220. if (!$token_result) {
  221. $this->error('您的网络开小差啦1~');
  222. }
  223. $token_result = json_decode($token_result, true);
  224. if ($token_result['code'] != 0) {
  225. $this->error('您的网络开小差啦2~');
  226. }
  227. $token = $token_result['access_token'];
  228. //获取签名鉴权参数ticket
  229. $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';
  230. $ticket_result = file_get_contents($ticket_url);
  231. if (!$ticket_result) {
  232. $this->error('您的网络开小差啦3~');
  233. }
  234. $ticket_result = json_decode($ticket_result, true);
  235. if ($ticket_result['code'] != 0) {
  236. $this->error('您的网络开小差啦4~');
  237. }
  238. $ticket = $ticket_result['tickets'][0]['value'];
  239. //获取签名
  240. $sign_data = [
  241. 'wbappid' => config('tencent_yun')['secret_id'],
  242. 'userId' => (string)$this->auth->id,
  243. 'version' => '1.0.0',
  244. 'ticket' => $ticket,
  245. 'nonce' => Random::alnum(32)
  246. ];//p($sign_data);
  247. asort($sign_data); //p($sign_data);//排序
  248. $sign_string = join('', $sign_data);//p($sign_string);
  249. $sign = sha1($sign_string);//p($sign);
  250. //上传身份信息
  251. $orderNo = getMillisecond() . $this->auth->id . mt_rand(1, 1000); //商户请求的唯一标识
  252. $url = 'https://miniprogram-kyc.tencentcloudapi.com/api/server/getAdvFaceId?orderNo=' . $orderNo;
  253. $avatar = one_domain_image($this->auth->avatar);
  254. $avatar = str_replace('https', 'http', $avatar);
  255. $img = file_get_contents($avatar);
  256. $img = str_replace('data:image/jpg;base64', '', $img);
  257. $img = str_replace('\n', '', $img);
  258. $sourcePhotoStr = base64_encode($img);
  259. $data = [
  260. 'webankAppId' => config('tencent_yun')['secret_id'],
  261. 'orderNo' => $orderNo,
  262. 'userId' => (string)$this->auth->id,
  263. 'sourcePhotoStr' => $sourcePhotoStr,
  264. 'sourcePhotoType' => 2,
  265. 'version' => '1.0.0',
  266. 'sign' => $sign,
  267. 'nonce' => $sign_data['nonce']
  268. ];
  269. $rs = curl_post($url,json_encode($data, 320), ['Content-Type: application/json']);
  270. if (!$rs) {
  271. $this->error('您的网络开小差啦5~');
  272. }
  273. $rs = json_decode($rs, true);
  274. if (!$rs || $rs['code'] != 0) {
  275. $this->error('您的网络开小差啦6~');
  276. }
  277. $user_auth = [
  278. 'user_id' => $this->auth->id,
  279. 'certify_id' => $rs['result']['faceId'],
  280. 'out_trade_no' => $data['orderNo'],
  281. 'status' => 0,
  282. 'createtime' => time(),
  283. 'updatetime' => time()
  284. ];
  285. //开启事务
  286. Db::startTrans();
  287. //查询是否认证过
  288. $info = Db::name('user_auth')->where(['user_id' => $this->auth->id])->find();
  289. if ($info) {
  290. $auth_rs = Db::name('user_auth')->where(['id' => $info['id']])->setField($user_auth);
  291. } else {
  292. $auth_rs = Db::name('user_auth')->insertGetId($user_auth);
  293. }
  294. if (!$auth_rs) {
  295. Db::rollback();
  296. $this->error('您的网络开小差啦7~');
  297. }
  298. //修改用户表认证状态
  299. $user_rs = Db::name('user')->where(['id' => $this->auth->id])->setField('real_status', 0);
  300. if ($user_rs === false) {
  301. Db::rollback();
  302. $this->error('您的网络开小差啦8~');
  303. }
  304. Db::commit();
  305. $return_data = [
  306. 'face_id' => $user_auth['certify_id'],
  307. 'order_no' => $user_auth['out_trade_no'],
  308. 'user_id' => (string)$this->auth->id,
  309. 'nonce' => $sign_data['nonce'],
  310. 'sign' => $sign
  311. ];
  312. $this->success('success', $return_data);
  313. }
  314. //查询真人认证结果
  315. public function getrealauthresult() {
  316. $user_auth = Db::name('user_auth')->where(['user_id' => $this->auth->id])->find();
  317. if (!$user_auth) {
  318. $this->success('尚未认证');
  319. }
  320. if ($user_auth['status'] == 1) {
  321. $this->success('真人认证通过');
  322. }
  323. if (!$user_auth['certify_id']) {
  324. $this->success('请先进行真人认证');
  325. }
  326. //获取token
  327. $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';
  328. $token_result = file_get_contents($token_url);
  329. if (!$token_result) {
  330. $this->error('您的网络开小差啦1~');
  331. }
  332. $token_result = json_decode($token_result, true);
  333. if ($token_result['code'] != 0) {
  334. $this->error('您的网络开小差啦2~');
  335. }
  336. $token = $token_result['access_token'];
  337. //获取签名鉴权参数ticket
  338. $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';
  339. $ticket_result = file_get_contents($ticket_url);
  340. if (!$ticket_result) {
  341. $this->error('您的网络开小差啦3~');
  342. }
  343. $ticket_result = json_decode($ticket_result, true);
  344. if ($ticket_result['code'] != 0) {
  345. $this->error('您的网络开小差啦4~');
  346. }
  347. $ticket = $ticket_result['tickets'][0]['value'];
  348. //获取签名
  349. $sign_data = [
  350. 'wbappid' => config('tencent_yun')['secret_id'],
  351. 'orderNo' => $user_auth['out_trade_no'],
  352. 'version' => '1.0.0',
  353. 'ticket' => $ticket,
  354. 'nonce' => Random::alnum(32)
  355. ];//p($sign_data);
  356. asort($sign_data); //p($sign_data);//排序
  357. $sign_string = join('', $sign_data);//p($sign_string);
  358. $sign = sha1($sign_string);//p($sign);
  359. //人脸核身结果查询
  360. $url = 'https://miniprogram-kyc.tencentcloudapi.com/api/v2/base/queryfacerecord?orderNo=' . $user_auth['out_trade_no'];
  361. $data = [
  362. 'appId' => config('tencent_yun')['secret_id'],
  363. 'version' => '1.0.0',
  364. 'nonce' => $sign_data['nonce'],
  365. 'orderNo' => $user_auth['out_trade_no'],
  366. 'sign' => $sign
  367. ];
  368. $rs = curl_post($url,json_encode($data, 320), ['Content-Type: application/json']);
  369. if (!$rs) {
  370. $this->error('您的网络开小差啦5~');
  371. }
  372. $rs = json_decode($rs, true);
  373. if (!$rs || $rs['code'] != 0) {
  374. $this->error($rs['msg']);
  375. }
  376. if ($rs['result']['liveRate'] >= 90 && $rs['result']['similarity'] >= 90) {
  377. $edit_data['status'] = 1;
  378. $msg = '真人认证成功';
  379. } else {
  380. $edit_data['status'] = 2;
  381. $edit_data['certify_id'] = '';
  382. $edit_data['out_trade_no'] = '';
  383. $msg = '真人认证失败';
  384. }
  385. $edit_data['updatetime'] = time();
  386. //开启事务
  387. Db::startTrans();
  388. //修改认证信息
  389. $result = Db::name('user_auth')->where(['user_id' => $this->auth->id, 'status' => $user_auth['status']])->setField($edit_data);
  390. if (!$result) {
  391. Db::rollback();
  392. $this->error('查询认证结果失败2');
  393. }
  394. //修改用户信息
  395. $rs = Db::name('user')->where(['id' => $this->auth->id])->setField('real_status', $edit_data['status']);
  396. if (!$rs) {
  397. Db::rollback();
  398. $this->error('查询认证结果失败3');
  399. }
  400. if ($edit_data['status'] == 1) { //通过
  401. //tag任务赠送金币
  402. //真人认证奖励
  403. $task_rs = \app\common\model\TaskLog::tofinish($this->auth->id,6);
  404. if($task_rs === false){
  405. Db::rollback();
  406. $this->error('完成任务赠送奖励失败');
  407. }
  408. //系统消息
  409. $msg_id = \app\common\model\Message::addMessage($this->auth->id,'真人认证','真人认证已经审核通过');
  410. } else {
  411. //系统消息
  412. $msg_id = \app\common\model\Message::addMessage($this->auth->id,'真人认证','真人认证审核不通过');
  413. }
  414. Db::commit();
  415. $this->success($msg);
  416. }
  417. //真人认证后修改头像
  418. public function editrealavatar() {
  419. if ($this->auth->real_status != 1) {
  420. $this->error('尚未通过真人认证');
  421. }
  422. $avatar = input('avatar', '', 'trim'); //头像地址
  423. if ($avatar === '') {
  424. $this->error('参数缺失');
  425. }
  426. $avatar = one_domain_image($avatar);
  427. $now_avatar = one_domain_image($this->auth->avatar);
  428. if ($avatar == $now_avatar) {
  429. $this->error('头像未改变');
  430. }
  431. //腾讯云人脸识别
  432. $auit_result = $this->face_tencent($now_avatar, $avatar); //1通过 0拒绝
  433. if ($auit_result != 1) {
  434. $this->success('提示', ['code' => 2]);
  435. }
  436. $data['avatar'] = $avatar;
  437. $user_result = Db::name('user')->where(['id' => $this->auth->id])->setField($data);
  438. if (!$user_result) {
  439. $this->error('修改失败');
  440. }
  441. $this->success('修改成功');
  442. }
  443. //真人认证后修改头像并取消真人认证
  444. public function editrealavatarcancelauit() {
  445. if ($this->auth->real_status != 1) {
  446. $this->error('尚未通过真人认证');
  447. }
  448. $avatar = input('avatar', '', 'trim'); //头像地址
  449. if ($avatar === '') {
  450. $this->error('参数缺失');
  451. }
  452. $avatar = one_domain_image($avatar);
  453. $now_avatar = one_domain_image($this->auth->avatar);
  454. if ($avatar == $now_avatar) {
  455. $this->error('头像未改变');
  456. }
  457. $data['avatar'] = $avatar;
  458. $data['real_status'] = -1;
  459. //开启事务
  460. Db::startTrans();
  461. $user_result = Db::name('user')->where(['id' => $this->auth->id])->setField($data);
  462. if (!$user_result) {
  463. Db::rollback();
  464. $this->error('修改失败');
  465. }
  466. $user_auth_result = Db::name('user_auth')->where(['user_id' => $this->auth->id])->delete();
  467. if (!$user_auth_result) {
  468. Db::rollback();
  469. $this->error('修改失败');
  470. }
  471. Db::commit();
  472. $this->success('修改成功');
  473. }
  474. //腾讯云人脸识别
  475. public function face_tencent($urla = '', $urlb = '') {
  476. // require_once 'vendor/autoload.php';
  477. try {
  478. // 实例化一个认证对象,入参需要传入腾讯云账户secretId,secretKey,此处还需注意密钥对的保密
  479. // 密钥可前往https://console.cloud.tencent.com/cam/capi网站进行获取
  480. $config = config('tencent_realauth');
  481. $cred = new Credential($config['SecretId'], $config['SecretKey']);
  482. // 实例化一个http选项,可选的,没有特殊需求可以跳过
  483. $httpProfile = new HttpProfile();
  484. $httpProfile->setEndpoint("iai.tencentcloudapi.com");
  485. // 实例化一个client选项,可选的,没有特殊需求可以跳过
  486. $clientProfile = new ClientProfile();
  487. $clientProfile->setHttpProfile($httpProfile);
  488. // 实例化要请求产品的client对象,clientProfile是可选的
  489. $client = new IaiClient($cred, "ap-beijing", $clientProfile);
  490. // 实例化一个请求对象,每个接口都会对应一个request对象
  491. $req = new CompareFaceRequest();
  492. $params = array(
  493. "UrlA" => $urla,
  494. "UrlB" => $urlb,
  495. "FaceModelVersion" => "3.0"
  496. );
  497. $req->fromJsonString(json_encode($params));
  498. // 返回的resp是一个CompareFaceResponse的实例,与请求对象对应
  499. $resp = $client->CompareFace($req);
  500. // 输出json格式的字符串回包
  501. // print_r($resp->toJsonString());
  502. $result = json_decode($resp->toJsonString(), true);
  503. //3.0版本误识率千分之一对应分数为40分,误识率万分之一对应分数为50分,误识率十万分之一对应分数为60分。 一般超过50分则可认定为同一人。
  504. if (isset($result['Score']) && $result['Score'] >= 60) {
  505. return 1; //通过
  506. } else {
  507. return 0;
  508. }
  509. }
  510. catch(TencentCloudSDKException $e) {
  511. // echo $e;
  512. return 0;
  513. }
  514. }
  515. }