|
@@ -207,6 +207,10 @@ class WelcomeController extends BaseController
|
|
|
myLog('special')->info('welcome --------------------------');
|
|
|
myLog('special')->info(json_decode($options, 1));
|
|
|
}
|
|
|
+
|
|
|
+ //统计用户ua
|
|
|
+ $this->recordUA();
|
|
|
+
|
|
|
return view('wap.index', compact('options', 'title'));
|
|
|
}
|
|
|
|
|
@@ -2083,4 +2087,28 @@ class WelcomeController extends BaseController
|
|
|
}
|
|
|
return '';
|
|
|
}
|
|
|
+
|
|
|
+ //统计ua
|
|
|
+ private function recordUA(Request $request)
|
|
|
+ {
|
|
|
+ $is_ua_open = RedisEnv('ua_open');
|
|
|
+ if($is_ua_open)//开启
|
|
|
+ {
|
|
|
+ //判断是否已经统计
|
|
|
+ $has_got = Redis::hget('book_read:'.$this->uid,'ua');
|
|
|
+ if(!$has_got)
|
|
|
+ {
|
|
|
+ try{
|
|
|
+ $ua = $request->server('HTTP_USER_AGENT');
|
|
|
+ if($ua)
|
|
|
+ {
|
|
|
+ UserService::recordUA($ua,$this->uid);
|
|
|
+ Redis::hset('book_read:'.$this->uid,'ua',1);
|
|
|
+ }
|
|
|
+ }catch (\Exception $e) {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|