Skip to content

Commit

Permalink
Update Area.php
Browse files Browse the repository at this point in the history
修复已有数据的情况被修改
  • Loading branch information
workec authored Dec 18, 2017
1 parent 93e059d commit 7906c3f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Area.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
}

Expand Down

0 comments on commit 7906c3f

Please sign in to comment.