|
@@ -209,7 +209,8 @@ class WelcomeController extends BaseController
|
|
}
|
|
}
|
|
|
|
|
|
//统计用户ua
|
|
//统计用户ua
|
|
- $this->recordUA();
|
|
|
|
|
|
+ $ua = $request->server('HTTP_USER_AGENT');
|
|
|
|
+ $this->recordUA($ua);
|
|
|
|
|
|
return view('wap.index', compact('options', 'title'));
|
|
return view('wap.index', compact('options', 'title'));
|
|
}
|
|
}
|
|
@@ -2089,22 +2090,18 @@ class WelcomeController extends BaseController
|
|
}
|
|
}
|
|
|
|
|
|
//统计ua
|
|
//统计ua
|
|
- private function recordUA(Request $request)
|
|
|
|
|
|
+ private function recordUA($ua)
|
|
{
|
|
{
|
|
$is_ua_open = RedisEnv('ua_open');
|
|
$is_ua_open = RedisEnv('ua_open');
|
|
- if($is_ua_open)//开启
|
|
|
|
|
|
+ if($is_ua_open && $ua)//开启
|
|
{
|
|
{
|
|
//判断是否已经统计
|
|
//判断是否已经统计
|
|
$has_got = Redis::hget('book_read:'.$this->uid,'ua');
|
|
$has_got = Redis::hget('book_read:'.$this->uid,'ua');
|
|
if(!$has_got)
|
|
if(!$has_got)
|
|
{
|
|
{
|
|
try{
|
|
try{
|
|
- $ua = $request->server('HTTP_USER_AGENT');
|
|
|
|
- if($ua)
|
|
|
|
- {
|
|
|
|
- UserService::recordUA($ua,$this->uid);
|
|
|
|
- Redis::hset('book_read:'.$this->uid,'ua',1);
|
|
|
|
- }
|
|
|
|
|
|
+ UserService::recordUA($ua,$this->uid);
|
|
|
|
+ Redis::hset('book_read:'.$this->uid,'ua',1);
|
|
}catch (\Exception $e) {
|
|
}catch (\Exception $e) {
|
|
|
|
|
|
}
|
|
}
|