正在显示
1 个修改的文件
包含
11 行增加
和
11 行删除
| @@ -42,7 +42,7 @@ class MonthCountLogic extends BaseLogic | @@ -42,7 +42,7 @@ class MonthCountLogic extends BaseLogic | ||
| 42 | */ | 42 | */ |
| 43 | public function currentMonthCount(){ | 43 | public function currentMonthCount(){ |
| 44 | $startTime = Carbon::now()->startOfMonth()->toDateString(); | 44 | $startTime = Carbon::now()->startOfMonth()->toDateString(); |
| 45 | - $endTime = date('Y-m-d H:i:s',time()); | 45 | + $endTime = date('Y-m-d',time()); |
| 46 | $arr = []; | 46 | $arr = []; |
| 47 | $arr = $this->inquiryCount($arr,$startTime,$endTime,$this->user['domain']); | 47 | $arr = $this->inquiryCount($arr,$startTime,$endTime,$this->user['domain']); |
| 48 | $arr = $this->flowCount($arr,$startTime,$endTime,$this->user['project_id']); | 48 | $arr = $this->flowCount($arr,$startTime,$endTime,$this->user['project_id']); |
| @@ -94,8 +94,8 @@ class MonthCountLogic extends BaseLogic | @@ -94,8 +94,8 @@ class MonthCountLogic extends BaseLogic | ||
| 94 | public function flowCount(&$arr,&$startTime,&$endTime,$project_id){ | 94 | public function flowCount(&$arr,&$startTime,&$endTime,$project_id){ |
| 95 | $pv_ip = DB::table('gl_count') | 95 | $pv_ip = DB::table('gl_count') |
| 96 | ->where(['project_id'=>$project_id]) | 96 | ->where(['project_id'=>$project_id]) |
| 97 | - ->where('date','>=',$startTime->toDateString().' 00:00:00') | ||
| 98 | - ->where('date','<=',$endTime->toDateString().' 23:59:59') | 97 | + ->where('date','>=',$startTime.' 00:00:00') |
| 98 | + ->where('date','<=',$endTime.' 23:59:59') | ||
| 99 | ->select(DB::raw('SUM(pv_num) as pv_num'), DB::raw('SUM(ip_num) as ip_num')) | 99 | ->select(DB::raw('SUM(pv_num) as pv_num'), DB::raw('SUM(ip_num) as ip_num')) |
| 100 | ->first(); | 100 | ->first(); |
| 101 | $arr['pv'] = $pv_ip->pv_num; | 101 | $arr['pv'] = $pv_ip->pv_num; |
| @@ -118,24 +118,24 @@ class MonthCountLogic extends BaseLogic | @@ -118,24 +118,24 @@ class MonthCountLogic extends BaseLogic | ||
| 118 | $source = DB::table('gl_customer_visit') | 118 | $source = DB::table('gl_customer_visit') |
| 119 | ->select('referrer_url', DB::raw('COUNT(*) as count')) | 119 | ->select('referrer_url', DB::raw('COUNT(*) as count')) |
| 120 | ->groupBy('referrer_url')->where(['domain'=>$domain]) | 120 | ->groupBy('referrer_url')->where(['domain'=>$domain]) |
| 121 | - ->where('updated_date','>=',$startTime->toDateString()) | ||
| 122 | - ->where('updated_date','<=',$endTime->toDateString()) | 121 | + ->where('updated_date','>=',$startTime) |
| 122 | + ->where('updated_date','<=',$endTime) | ||
| 123 | ->orderByDesc('count')->limit(10)->get()->toArray(); | 123 | ->orderByDesc('count')->limit(10)->get()->toArray(); |
| 124 | $arr['source'] = json_encode($source); | 124 | $arr['source'] = json_encode($source); |
| 125 | //访问国家前15 | 125 | //访问国家前15 |
| 126 | $source_country = DB::table('gl_customer_visit') | 126 | $source_country = DB::table('gl_customer_visit') |
| 127 | ->select('country',DB::raw('COUNT(*) as ip'),DB::raw('SUM(depth) as pv')) | 127 | ->select('country',DB::raw('COUNT(*) as ip'),DB::raw('SUM(depth) as pv')) |
| 128 | ->groupBy('country')->where(['domain'=>$domain]) | 128 | ->groupBy('country')->where(['domain'=>$domain]) |
| 129 | - ->where('updated_date','>=',$startTime->toDateString()) | ||
| 130 | - ->where('updated_date','<=',$endTime->toDateString()) | 129 | + ->where('updated_date','>=',$startTime) |
| 130 | + ->where('updated_date','<=',$endTime) | ||
| 131 | ->orderBy('ip','desc')->limit(15)->get()->toArray(); | 131 | ->orderBy('ip','desc')->limit(15)->get()->toArray(); |
| 132 | $arr['source_country'] = json_encode($source_country); | 132 | $arr['source_country'] = json_encode($source_country); |
| 133 | //受访界面前15 | 133 | //受访界面前15 |
| 134 | $referrer_url = DB::table('gl_customer_visit_item') | 134 | $referrer_url = DB::table('gl_customer_visit_item') |
| 135 | ->select('url',DB::raw('COUNT(*) as num')) | 135 | ->select('url',DB::raw('COUNT(*) as num')) |
| 136 | ->orderBy('num','desc')->where(['domain'=>$domain]) | 136 | ->orderBy('num','desc')->where(['domain'=>$domain]) |
| 137 | - ->where('updated_date','>=',$startTime->toDateString()) | ||
| 138 | - ->where('updated_date','<=',$endTime->toDateString()) | 137 | + ->where('updated_date','>=',$startTime) |
| 138 | + ->where('updated_date','<=',$endTime) | ||
| 139 | ->groupBy('url') | 139 | ->groupBy('url') |
| 140 | ->limit(15)->get()->toArray(); | 140 | ->limit(15)->get()->toArray(); |
| 141 | $arr['referrer_url'] = json_encode($referrer_url); | 141 | $arr['referrer_url'] = json_encode($referrer_url); |
| @@ -143,8 +143,8 @@ class MonthCountLogic extends BaseLogic | @@ -143,8 +143,8 @@ class MonthCountLogic extends BaseLogic | ||
| 143 | $referrer_port = DB::table('gl_customer_visit_item') | 143 | $referrer_port = DB::table('gl_customer_visit_item') |
| 144 | ->select('device_port',DB::raw('COUNT(*) as num')) | 144 | ->select('device_port',DB::raw('COUNT(*) as num')) |
| 145 | ->orderBy('num','desc')->where(['domain'=>$domain]) | 145 | ->orderBy('num','desc')->where(['domain'=>$domain]) |
| 146 | - ->where('updated_date','>=',$startTime->toDateString()) | ||
| 147 | - ->where('updated_date','<=',$endTime->toDateString()) | 146 | + ->where('updated_date','>=',$startTime) |
| 147 | + ->where('updated_date','<=',$endTime) | ||
| 148 | ->groupBy('device_port') | 148 | ->groupBy('device_port') |
| 149 | ->limit(15)->get()->toArray(); | 149 | ->limit(15)->get()->toArray(); |
| 150 | $arr['referrer_port'] = json_encode($referrer_port); | 150 | $arr['referrer_port'] = json_encode($referrer_port); |
-
请 注册 或 登录 后发表评论