panghu 1 tahun lalu
induk
melakukan
f1aba062cc
1 mengubah file dengan 4 tambahan dan 20 penghapusan
  1. 4 20
      app/Http/Controllers/AdminApi/CommonController.php

+ 4 - 20
app/Http/Controllers/AdminApi/CommonController.php

@@ -46,29 +46,13 @@ class CommonController extends AdminController
 
         $result = BaiduServer::creatServer()->idCard($id_card);
         if ($result['code'] == 1){
-            $id_number = empty($result['data']['公民身份号码']['words']) ? '' : $result['data']['公民身份号码']['words'];
-            $name = empty($result['data']['姓名']['words']) ? '' : $result['data']['姓名']['words'];
-            $sex = empty($result['data']['性别']['words']) ? '' : $result['data']['性别']['words'];
-            $birthday = empty($result['data']['出生']['words']) ? '' : $result['data']['出生']['words'];
-            if ($birthday) {
-                $birthday = substr($birthday, 0, 4) . '-' . substr($birthday, 4, 2) . '-' . substr($birthday, 6, 2);
-            }
-            $newData = [
-                'name' => $name,
-                'birthday' => $birthday,
-                'sex' => $sex,
-                'id_number' => $id_number,
-            ];
+
+            return $this->apiResponseSuccess($result['msg'],$result['data']);
         }else{
-            $newData = [
-                'name' => '',
-                'birthday' => '',
-                'sex' => '',
-                'id_number' => '',
-            ];
+
+            return $this->apiResponseError($result['msg']);
         }
 
-        return $this->apiResponseSuccess('获取成功', $newData);
     }
 
     /**