|
@@ -145,22 +145,23 @@ class GetKennelDetailWorkCommand extends CConsoleCommand {
|
|
|
//$dealPet->last_modify = $tmp['last_modify'];
|
|
|
//$dealPet->view_count = $tmp['view_count'];
|
|
|
//$dealPet->contact_count = $tmp['contact_count'];
|
|
|
-
|
|
|
- $position = CommonFn::GCJTobaidu($tmp['lat'], $tmp['lng']);
|
|
|
- $location = $position['lat'] . ',' . $position['lng'];
|
|
|
-
|
|
|
- $res = CommonFn::simple_http('http://api.map.baidu.com/geocoder/v2/?ak=B349f0b32ef6e78b2e678f45cb9fddaf&location=' . $location . '&output=json&pois=0');
|
|
|
- $info = json_decode($res);
|
|
|
- $cityinfo = array();
|
|
|
- if ($info || $info->status == 0) {
|
|
|
- $info = $info->result->addressComponent;
|
|
|
- if (!empty($info->province) && !empty($info->city)) {
|
|
|
- $cityinfo['province'] = $info->province;
|
|
|
- $cityinfo['city'] = $info->city;
|
|
|
- $cityinfo['area'] = $info->district;
|
|
|
-
|
|
|
+ if ( $tmp['lat'] != 0 && $tmp['lng'] != 0){
|
|
|
+ $position = CommonFn::GCJTobaidu($tmp['lat'], $tmp['lng']);
|
|
|
+ $location = $position['lat'] . ',' . $position['lng'];
|
|
|
+
|
|
|
+ $res = CommonFn::simple_http('http://api.map.baidu.com/geocoder/v2/?ak=B349f0b32ef6e78b2e678f45cb9fddaf&location=' . $location . '&output=json&pois=0');
|
|
|
+ $info = json_decode($res);
|
|
|
+ $cityinfo = array();
|
|
|
+ if ($info || $info->status == 0) {
|
|
|
+ $info = $info->result->addressComponent;
|
|
|
+ if (!empty($info->province) && !empty($info->city)) {
|
|
|
+ $cityinfo['province'] = $info->province;
|
|
|
+ $cityinfo['city'] = $info->city;
|
|
|
+ $cityinfo['area'] = $info->district;
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
- } else {
|
|
|
+ }else {
|
|
|
$cityinfo['province'] = '';
|
|
|
$cityinfo['city'] = '';
|
|
|
$cityinfo['area'] = '';
|