作者 lihan
1 个管道 的构建 通过 耗费 0 秒

自动定位功能

... ... @@ -48,12 +48,16 @@ class ActivityController extends HomeBaseController
} else {
require_once EXTEND_PATH . '/WeChatCommon.php';
$wx = new \WeChatCommon();
$pos = Db:: name('user')->field('lat,lng')->where(['id'=>session('user.id')])->find();
if(empty(session('user.city'))) {
$pos = Db:: name('user')->field('lat,lng')->where(['id' => session('user.id')])->find();
$return = json_decode(anti_analysis($pos['lat'], $pos['lng']), true);
$city = $return['result']['address_component']['city'];
session('user.city', $city);
}
return $this->fetch(':_list', [
'result' => $result,
'js_sdk' => $wx->js_sdk(),
'city' => $return['result']['address_component']['city']
'city' => session('user.city')
]);
}
}
... ...