From 23b8ca2fdcbe117db5f0d692d60edcd1474d2f21 Mon Sep 17 00:00:00 2001 From: sa0ChunLuyu Date: Tue, 29 Oct 2024 16:38:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20=E5=A9=9A=E6=A3=80?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=20=E5=8C=B9=E9=85=8D=E5=87=BA=E7=94=9F?= =?UTF-8?q?=E5=9C=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/API/H5/UserController.php | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/Laravel/app/Http/Controllers/API/H5/UserController.php b/Laravel/app/Http/Controllers/API/H5/UserController.php index 20d3441..b90e1b4 100644 --- a/Laravel/app/Http/Controllers/API/H5/UserController.php +++ b/Laravel/app/Http/Controllers/API/H5/UserController.php @@ -118,6 +118,33 @@ class UserController extends Controller ], ]; } + $id_number = $res['ID_No'] ?? ''; + $birthplace = ''; + if ($id_type_show == 0 && mb_strlen($id_number, 'utf-8') == 18) { + $sheng = substr($id_number, 0, 2); + $shi = substr($id_number, 0, 4); + $xian = substr($id_number, 0, 6); + $address_data_str = file_get_contents(public_path('assets/address.json')); + $address_data = json_decode($address_data_str, true); + foreach ($address_data as $ak => $av) { + if ($av['code'] == $sheng) { + $birthplace = $birthplace . $av['name']; + foreach ($av['children'] as $aak => $aav) { + if ($aav['code'] == $shi) { + $birthplace = $birthplace . $aav['name']; + foreach ($aav['children'] as $aaak => $aaav) { + if ($aav['code'] == $xian) { + $birthplace = $birthplace . $aaav['name']; + break; + } + } + break; + } + } + break; + } + } + } $person_info = [ '国籍' => $res['MZ'] == '外国血统' ? '外国' : '中国', '证件类型' => $id_type_show, @@ -134,7 +161,7 @@ class UserController extends Controller '工作单位' => "", '文化程度' => "", '职业' => "", - '出生地' => "", + '出生地' => $birthplace, '配偶姓名' => "", '配偶证件类型' => 0, '配偶证件号' => "",