|
|
@@ -58,9 +58,13 @@ class RegionLogic extends BaseLogic
|
|
|
}
|
|
|
if ($result['status'] === 0) {
|
|
|
//获取城市id
|
|
|
- $city_id = Area::where(['name'=>['like',"%".$result['result']['address_component']['city']."%"]])->value('id');
|
|
|
- $result['result']['address_component']['city_id'] = $city_id;
|
|
|
- return $result['result']['address_component'];
|
|
|
+ if(empty($result['result']['address_component']['city'])){
|
|
|
+ throw new Exception('定位获取shibai');
|
|
|
+ }
|
|
|
+ $city_id = PostageRegion::where('name','like',"%".$result['result']['address_component']['city']."%")->value('id');
|
|
|
+ $result = $result['result']['address_component'];
|
|
|
+ $result['city_id'] = $city_id;
|
|
|
+ return $result;
|
|
|
}
|
|
|
} catch (\Exception $e) {
|
|
|
self::$error = $e->getMessage();
|