更新 婚检地址匹配测试

main
鹿和sa0ChunLuyu 1 year ago
parent 14096e64b7
commit 2faf0b154b

@ -24,11 +24,20 @@ class UserController extends Controller
]); ]);
} }
$id_type_map = [ $id_type_map = [
'身份证' => 0,
'居民身份证' => 0, '居民身份证' => 0,
'驾驶证' => 1, '驾驶证' => 1,
'外国护照' => 2,
'护照' => 2, '护照' => 2,
'港澳居民来往内地通行证' => 3,
'港澳台身份证' => 3,
'港澳通行' => 3, '港澳通行' => 3,
'外国人永久居留身份证' => 4, '外国人永久居留身份证' => 4,
'其他' => 5, '其他' => 5,
'暂未获取' => 5, '暂未获取' => 5,
]; ];
@ -42,29 +51,59 @@ class UserController extends Controller
if (isset($id_type_map[$id_type])) { if (isset($id_type_map[$id_type])) {
$id_type_show = $id_type_map[$id_type]; $id_type_show = $id_type_map[$id_type];
} }
$person_info = [ // $address = $res['Address'] ?? '';
'国籍' => $res['MZ'] == '外国血统' ? '外国' : '中国', $address = '海南省海口市龙华区11111111';
'证件类型' => $id_type_show, $address_array = [];
'证件号' => $res['ID_No'] ?? '', if (!!$address) {
'姓名' => $res['Patname'] ?? '', $address_data_str = file_get_contents(public_path('assets/address.json'));
'生日' => $res['Patbdate'] ? date('Y-m-d', strtotime($res['Patbdate'])) : date('Y-m-d'), $address_data = json_decode($address_data_str, true);
'民族' => $res['MZ'] ?? '', foreach ($address_data as $ak => $av) {
'现地址省市区' => [ if (str_contains($address, $av['name'])) {
[ $address_array[] = [
'value' => '11', 'value' => $av['code'],
'text' => '北京市' 'text' => $av['name']
], ];
[ foreach ($av['children'] as $aak => $aav) {
'value' => '1101', if (str_contains($address, $aav['name'])) {
'text' => '市辖区' $address_array[] = [
], 'value' => $aav['code'],
[ 'text' => $aav['name']
'value' => '110101', ];
'text' => '东城区' foreach ($aav['children'] as $aaak => $aaav) {
], if (str_contains($address, $aaav['name'])) {
], $address_array[] = [
'现地址' => $res['Address'] ?? '', 'value' => $aaav['code'],
'详细地址省市区' => [ 'text' => $aaav['name']
];
break;
}
}
if (count($address_array) == 2) {
$address_array[] = [
'value' => $aav['children'][0]['code'],
'text' => $aav['children'][0]['name'],
];
}
break;
}
}
if (count($address_array) == 1) {
$address_array[] = [
'value' => $av['children'][0]['code'],
'text' => $av['children'][0]['name'],
];
$address_array[] = [
'value' => $av['children'][0]['children'][0]['code'],
'text' => $av['children'][0]['children'][0]['name'],
];
}
break;
}
}
}
if (count($address_array) == 0) {
$address_array = [
[ [
'value' => '11', 'value' => '11',
'text' => '北京市' 'text' => '北京市'
@ -77,8 +116,19 @@ class UserController extends Controller
'value' => '110101', 'value' => '110101',
'text' => '东城区' 'text' => '东城区'
], ],
], ];
'详细地址' => $res['Fulladdress'] ?? '', }
$person_info = [
'国籍' => $res['MZ'] == '外国血统' ? '外国' : '中国',
'证件类型' => $id_type_show,
'证件号' => $res['ID_No'] ?? '',
'姓名' => $res['Patname'] ?? '',
'生日' => $res['Patbdate'] ? date('Y-m-d', strtotime($res['Patbdate'])) : date('Y-m-d'),
'民族' => $res['MZ'] ?? '',
'现地址省市区' => $address_array,
'现地址' => $address,
'详细地址省市区' => $address_array,
'详细地址' => $address,
'户籍地址省市区' => [ '户籍地址省市区' => [
[ [
'value' => '11', 'value' => '11',

Loading…
Cancel
Save