Преглед на файлове

refactor(idcard): 优化身份证验证客户端错误处理

- 更新 IDCardClient 门面注释,使用 @mixin 替代具体方法声明
- 将 RuntimeException 替换为 throw_logic_exception 函数处理错误
- 提高代码可维护性和一致性
runphp преди 3 месеца
родител
ревизия
e49a87985f
променени са 2 файла, в които са добавени 2 реда и са изтрити 2 реда
  1. 1 1
      src/Facade/IDCardClient.php
  2. 1 1
      src/IDCardClient.php

+ 1 - 1
src/Facade/IDCardClient.php

@@ -5,7 +5,7 @@ namespace SixShop\AliyunIDCard\Facade;
 use think\Facade;
 
 /**
- * @method static array idcard(string $cardno, string $name) 身份证验证
+ * @mixin \SixShop\AliyunIDCard\IDCardClient
  */
 class IDCardClient extends Facade
 {

+ 1 - 1
src/IDCardClient.php

@@ -42,7 +42,7 @@ class IDCardClient
         if ($result['resp']['code'] == 0) {
             return $result['data'];
         } else {
-            throw new \RuntimeException($this->errorMesageMap[$result['resp']['code']] ?? $result['resp']['desc']);
+            throw_logic_exception($this->errorMesageMap[$result['resp']['code']] ?? $result['resp']['desc']);
         }
     }
 }