Explorar o código

fix(user):修复台胞证与返乡证类型判断逻辑

-交换了台胞证与返乡证的类型判断逻辑,确保正确识别证件类型- 在调用百度OCR接口后添加了日志记录,便于调试和追踪结果
-保持了原有的错误处理和返回机制
shichen hai 10 meses
pai
achega
fc9795c3be
Modificáronse 1 ficheiros con 4 adicións e 2 borrados
  1. 4 2
      app/controller/api/user/User.php

+ 4 - 2
app/controller/api/user/User.php

@@ -948,10 +948,10 @@ class User extends BaseController
948
             // 设置exitentrypermit_type
948
             // 设置exitentrypermit_type
949
             $exType = '';
949
             $exType = '';
950
             if ($cardType == 2) {
950
             if ($cardType == 2) {
951
-                $exType = 'tw_return_passport_front'; //台胞
951
+                $exType = 'hk_mc_return_passport_front'; //返乡
952
             }
952
             }
953
             if ($cardType == 3) {
953
             if ($cardType == 3) {
954
-                $exType = 'hk_mc_return_passport_front'; // 返乡
954
+                $exType = 'tw_return_passport_front'; // 台胞
955
             }
955
             }
956
 
956
 
957
             if (empty($exType)) {
957
             if (empty($exType)) {
@@ -961,6 +961,7 @@ class User extends BaseController
961
             $postData['url'] = $params['card_positive'];
961
             $postData['url'] = $params['card_positive'];
962
             $postData['exitentrypermit_type'] = $exType;
962
             $postData['exitentrypermit_type'] = $exType;
963
             $result = $baidu->hkMacauTaiwan($postData);
963
             $result = $baidu->hkMacauTaiwan($postData);
964
+            Log::info('hkMacauTaiwan:' . json_encode($result));
964
             $real_user_name = $result['words_result']['name_chn'][0]['word']??'';
965
             $real_user_name = $result['words_result']['name_chn'][0]['word']??'';
965
             $real_user_card = $result['words_result']['card_number'][0]['word']??'';
966
             $real_user_card = $result['words_result']['card_number'][0]['word']??'';
966
             if ($real_user_name != $params['user_name']) {
967
             if ($real_user_name != $params['user_name']) {
@@ -1003,6 +1004,7 @@ class User extends BaseController
1003
             $image = file_get_contents($params['card_positive']);
1004
             $image = file_get_contents($params['card_positive']);
1004
             $idCardSide = "front";
1005
             $idCardSide = "front";
1005
             $result = $baidu->idcard($image, $idCardSide);
1006
             $result = $baidu->idcard($image, $idCardSide);
1007
+            Log::info('hkMacauTaiwan:' . json_encode($result));
1006
             $real_user_name = $result['words_result']['姓名']['words'] ?? '';
1008
             $real_user_name = $result['words_result']['姓名']['words'] ?? '';
1007
             $real_user_card = $result['words_result']['公民身份号码']['words'] ?? '';
1009
             $real_user_card = $result['words_result']['公民身份号码']['words'] ?? '';
1008
             if ($real_user_name != $params['user_name']) {
1010
             if ($real_user_name != $params['user_name']) {