From 7906c3ff2e93ef04915f5d9c2846e748f81a6503 Mon Sep 17 00:00:00 2001 From: workec <171562904@qq.com> Date: Mon, 18 Dec 2017 10:49:03 +0800 Subject: [PATCH] Update Area.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复已有数据的情况被修改 --- src/Area.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Area.php b/src/Area.php index 632a198..04d356c 100644 --- a/src/Area.php +++ b/src/Area.php @@ -538,14 +538,14 @@ public static function getNewAreaId($area) { $area['region'] = isset($area['region']) ? $area['region'] : '0'; if ($area['province'] && strlen($area['province']) == 6) { - $area['country'] = 100000; + $area['country'] = $area['country']?$area['country']:100000; } //北京市 天津市 上海市 重庆市 if (in_array($area['province'], [110000, 120000, 310000, 500000])) { if ($area['city']) { - $area['region'] = $area['city']; - $area['city'] = substr($area['province'], 0, 3) . '100'; + $area['region'] = $area['region']?$area['region']:$area['city']; + $area['city'] = $area['city']?$area['city']:substr($area['province'], 0, 3) . '100'; } }