正在显示
1 个修改的文件
包含
7 行增加
和
3 行删除
@@ -48,12 +48,16 @@ class ActivityController extends HomeBaseController | @@ -48,12 +48,16 @@ class ActivityController extends HomeBaseController | ||
48 | } else { | 48 | } else { |
49 | require_once EXTEND_PATH . '/WeChatCommon.php'; | 49 | require_once EXTEND_PATH . '/WeChatCommon.php'; |
50 | $wx = new \WeChatCommon(); | 50 | $wx = new \WeChatCommon(); |
51 | - $pos = Db:: name('user')->field('lat,lng')->where(['id'=>session('user.id')])->find(); | ||
52 | - $return = json_decode(anti_analysis($pos['lat'], $pos['lng']), true); | 51 | + if(empty(session('user.city'))) { |
52 | + $pos = Db:: name('user')->field('lat,lng')->where(['id' => session('user.id')])->find(); | ||
53 | + $return = json_decode(anti_analysis($pos['lat'], $pos['lng']), true); | ||
54 | + $city = $return['result']['address_component']['city']; | ||
55 | + session('user.city', $city); | ||
56 | + } | ||
53 | return $this->fetch(':_list', [ | 57 | return $this->fetch(':_list', [ |
54 | 'result' => $result, | 58 | 'result' => $result, |
55 | 'js_sdk' => $wx->js_sdk(), | 59 | 'js_sdk' => $wx->js_sdk(), |
56 | - 'city' => $return['result']['address_component']['city'] | 60 | + 'city' => session('user.city') |
57 | ]); | 61 | ]); |
58 | } | 62 | } |
59 | } | 63 | } |
-
请 注册 或 登录 后发表评论