Просмотр исходного кода

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

-交换了台胞证与返乡证的类型判断逻辑,确保正确识别证件类型- 在调用百度OCR接口后添加了日志记录,便于调试和追踪结果
-保持了原有的错误处理和返回机制
shichen месяцев назад: 10
Родитель
Сommit
fc9795c3be
1 измененных файлов с 4 добавлено и 2 удалено
  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 948
             // 设置exitentrypermit_type
949 949
             $exType = '';
950 950
             if ($cardType == 2) {
951
-                $exType = 'tw_return_passport_front'; //台胞
951
+                $exType = 'hk_mc_return_passport_front'; //返乡
952 952
             }
953 953
             if ($cardType == 3) {
954
-                $exType = 'hk_mc_return_passport_front'; // 返乡
954
+                $exType = 'tw_return_passport_front'; // 台胞
955 955
             }
956 956
 
957 957
             if (empty($exType)) {
@@ -961,6 +961,7 @@ class User extends BaseController
961 961
             $postData['url'] = $params['card_positive'];
962 962
             $postData['exitentrypermit_type'] = $exType;
963 963
             $result = $baidu->hkMacauTaiwan($postData);
964
+            Log::info('hkMacauTaiwan:' . json_encode($result));
964 965
             $real_user_name = $result['words_result']['name_chn'][0]['word']??'';
965 966
             $real_user_card = $result['words_result']['card_number'][0]['word']??'';
966 967
             if ($real_user_name != $params['user_name']) {
@@ -1003,6 +1004,7 @@ class User extends BaseController
1003 1004
             $image = file_get_contents($params['card_positive']);
1004 1005
             $idCardSide = "front";
1005 1006
             $result = $baidu->idcard($image, $idCardSide);
1007
+            Log::info('hkMacauTaiwan:' . json_encode($result));
1006 1008
             $real_user_name = $result['words_result']['姓名']['words'] ?? '';
1007 1009
             $real_user_card = $result['words_result']['公民身份号码']['words'] ?? '';
1008 1010
             if ($real_user_name != $params['user_name']) {