正在显示
1 个修改的文件
包含
4 行增加
和
49 行删除
| @@ -111,10 +111,6 @@ class OptimizationReportController extends BaseController | @@ -111,10 +111,6 @@ class OptimizationReportController extends BaseController | ||
| 111 | * @time :2023/7/3 9:55 | 111 | * @time :2023/7/3 9:55 |
| 112 | */ | 112 | */ |
| 113 | public function currentMonthCount($project_id){ | 113 | public function currentMonthCount($project_id){ |
| 114 | - // 获取当前月的开始时间 | ||
| 115 | - $startTime = date('Y-m-01', strtotime($this->param['date'])); | ||
| 116 | - // 获取当前月的结束时间 | ||
| 117 | - $endTime = date('Y-m-t', strtotime($this->param['date'])); | ||
| 118 | $arr = []; | 114 | $arr = []; |
| 119 | $date = date('Y-m', strtotime($this->param['date'])); | 115 | $date = date('Y-m', strtotime($this->param['date'])); |
| 120 | $monthCountModel = new MonthCount(); | 116 | $monthCountModel = new MonthCount(); |
| @@ -129,56 +125,15 @@ class OptimizationReportController extends BaseController | @@ -129,56 +125,15 @@ class OptimizationReportController extends BaseController | ||
| 129 | if($arr['ip'] != 0){ | 125 | if($arr['ip'] != 0){ |
| 130 | $arr['rate'] = round(($arr['month_total'] / $arr['ip']) * 100,2); | 126 | $arr['rate'] = round(($arr['month_total'] / $arr['ip']) * 100,2); |
| 131 | } | 127 | } |
| 128 | + $arr['source'] = json_decode($month_info['source'],true); | ||
| 129 | + $arr['source_country'] = json_decode($month_info['source_country'],true); | ||
| 130 | + $arr['referrer_url'] = json_decode($month_info['referrer_url'],true); | ||
| 131 | + $arr['referrer_port'] = json_decode($month_info['referrer_port'],true); | ||
| 132 | } | 132 | } |
| 133 | - $arr = $this->sourceCount($arr,$startTime,$endTime); | ||
| 134 | $arr['month'] = date('Y-m',time()); | 133 | $arr['month'] = date('Y-m',time()); |
| 135 | return $arr; | 134 | return $arr; |
| 136 | } | 135 | } |
| 137 | 136 | ||
| 138 | - /** | ||
| 139 | - * @remark :来源访问前8 | ||
| 140 | - * @name :sourceCount | ||
| 141 | - * @author :lyh | ||
| 142 | - * @method :post | ||
| 143 | - * @time :2023/6/30 16:14 | ||
| 144 | - */ | ||
| 145 | - public function sourceCount(&$arr,$startTime,$endTime){ | ||
| 146 | - //访问来源前10 | ||
| 147 | - $source = DB::connection('custom_mysql')->table('gl_customer_visit') | ||
| 148 | - ->select('referrer_url', DB::raw('COUNT(*) as count')) | ||
| 149 | - ->groupBy('referrer_url') | ||
| 150 | - ->where('referrer_url','!=','') | ||
| 151 | - ->whereBetween('updated_date', [$startTime,$endTime]) | ||
| 152 | - ->orderByDesc('count')->limit(10)->get()->toArray(); | ||
| 153 | - $arr['source'] = $source; | ||
| 154 | - //访问国家前15 | ||
| 155 | - $query = DB::connection('custom_mysql')->table('gl_customer_visit') | ||
| 156 | - ->select('country',DB::raw('COUNT(*) as ip'),DB::raw('SUM(depth) as pv')) | ||
| 157 | - ->groupBy('country'); | ||
| 158 | - | ||
| 159 | - $query->where('country','<>','中国'); | ||
| 160 | - | ||
| 161 | - $source_country = $query->whereBetween('updated_date', [$startTime,$endTime]) | ||
| 162 | - ->orderBy('ip','desc')->limit(15)->get()->toArray(); | ||
| 163 | - $arr['source_country'] = $source_country; | ||
| 164 | - //受访界面前15 | ||
| 165 | - $referrer_url = DB::connection('custom_mysql')->table('gl_customer_visit') | ||
| 166 | - ->select('url',DB::raw('COUNT(*) as num')) | ||
| 167 | - ->orderBy('num','desc') | ||
| 168 | - ->whereBetween('updated_date', [$startTime,$endTime]) | ||
| 169 | - ->groupBy('url') | ||
| 170 | - ->limit(15)->get()->toArray(); | ||
| 171 | - $arr['referrer_url'] = $referrer_url; | ||
| 172 | - //访问断后 | ||
| 173 | - $referrer_port = DB::connection('custom_mysql')->table('gl_customer_visit') | ||
| 174 | - ->select('device_port',DB::raw('COUNT(*) as num')) | ||
| 175 | - ->orderBy('num','desc') | ||
| 176 | - ->whereBetween('updated_date', [$startTime,$endTime]) | ||
| 177 | - ->groupBy('device_port') | ||
| 178 | - ->limit(15)->get()->toArray(); | ||
| 179 | - $arr['referrer_port'] = $referrer_port; | ||
| 180 | - return $arr; | ||
| 181 | - } | ||
| 182 | 137 | ||
| 183 | public function getApiList($projectInfo,$export = false) | 138 | public function getApiList($projectInfo,$export = false) |
| 184 | { | 139 | { |
-
请 注册 或 登录 后发表评论