|
@@ -93,7 +93,7 @@ class OptimizationReportController extends BaseController |
|
@@ -93,7 +93,7 @@ class OptimizationReportController extends BaseController |
|
93
|
'data' => array_values($indexed_pages['data'] ?? []),
|
93
|
'data' => array_values($indexed_pages['data'] ?? []),
|
|
94
|
];
|
94
|
];
|
|
95
|
//月统计报告
|
95
|
//月统计报告
|
|
96
|
- $data['month_count'] = $this->currentMonthCount($domain_info['domain'],$this->param['project_id']);
|
96
|
+ $data['month_count'] = $this->currentMonthCount($this->param['project_id']);
|
|
97
|
//测速
|
97
|
//测速
|
|
98
|
$speed = Speed::where('project_id', $this->param['project_id'])->first();
|
98
|
$speed = Speed::where('project_id', $this->param['project_id'])->first();
|
|
99
|
$data['speed'] = $speed['data'] ?? [];
|
99
|
$data['speed'] = $speed['data'] ?? [];
|
|
@@ -110,60 +110,27 @@ class OptimizationReportController extends BaseController |
|
@@ -110,60 +110,27 @@ class OptimizationReportController extends BaseController |
|
110
|
* @method :post
|
110
|
* @method :post
|
|
111
|
* @time :2023/7/3 9:55
|
111
|
* @time :2023/7/3 9:55
|
|
112
|
*/
|
112
|
*/
|
|
113
|
- public function currentMonthCount($domain,$project_id){
|
113
|
+ public function currentMonthCount($project_id){
|
|
114
|
// 获取当前月的开始时间
|
114
|
// 获取当前月的开始时间
|
|
115
|
$startTime = date('Y-m-01', strtotime($this->param['date']));
|
115
|
$startTime = date('Y-m-01', strtotime($this->param['date']));
|
|
116
|
// 获取当前月的结束时间
|
116
|
// 获取当前月的结束时间
|
|
117
|
$endTime = date('Y-m-t', strtotime($this->param['date']));
|
117
|
$endTime = date('Y-m-t', strtotime($this->param['date']));
|
|
118
|
$arr = [];
|
118
|
$arr = [];
|
|
119
|
- $arr = $this->inquiryCount($arr,$startTime,$endTime,$domain,$project_id);
|
|
|
|
120
|
- $arr = $this->flowCount($arr,$startTime,$endTime,$project_id);
|
|
|
|
121
|
- $arr = $this->sourceCount($arr,$startTime,$endTime,$domain);
|
|
|
|
122
|
- $arr['month'] = date('Y-m',time());
|
|
|
|
123
|
- return $arr;
|
|
|
|
124
|
- }
|
|
|
|
125
|
-
|
|
|
|
126
|
- /**
|
|
|
|
127
|
- * @param $domain
|
|
|
|
128
|
- * @param $project_id
|
|
|
|
129
|
- * @remark :询盘按月统计
|
|
|
|
130
|
- * @name :inquiryCount
|
|
|
|
131
|
- * @author :lyh
|
|
|
|
132
|
- * @method :post
|
|
|
|
133
|
- * @time :2023/6/30 14:29
|
|
|
|
134
|
- */
|
|
|
|
135
|
- public function inquiryCount(&$arr, &$startTime, $project_id){
|
|
|
|
136
|
- $month = date('Y-m',strtotime($startTime));
|
|
|
|
137
|
$monthCountModel = new MonthCount();
|
119
|
$monthCountModel = new MonthCount();
|
|
138
|
- $info = $monthCountModel->read(['project_id'=>$project_id,'month'=>$month]);
|
|
|
|
139
|
- if($info !== false){
|
|
|
|
140
|
- $arr['country'] = $info['country'];
|
|
|
|
141
|
- $arr['total'] = $info['total'];
|
|
|
|
142
|
- $arr['month_total'] = $info['month_total'];
|
|
|
|
143
|
- }
|
|
|
|
144
|
- return $arr;
|
|
|
|
145
|
- }
|
|
|
|
146
|
-
|
|
|
|
147
|
- /**
|
|
|
|
148
|
- * @remark :流量统计
|
|
|
|
149
|
- * @name :flowCount
|
|
|
|
150
|
- * @author :lyh
|
|
|
|
151
|
- * @method :post
|
|
|
|
152
|
- * @time :2023/6/30 14:31
|
|
|
|
153
|
- */
|
|
|
|
154
|
- public function flowCount(&$arr,&$startTime,&$endTime,$project_id){
|
|
|
|
155
|
- $pv_ip = DB::table('gl_count')
|
|
|
|
156
|
- ->where(['project_id'=>$project_id])
|
|
|
|
157
|
- ->whereBetween('date', [$startTime,$endTime])
|
|
|
|
158
|
- ->select(DB::raw('SUM(pv_num) as pv_num'), DB::raw('SUM(ip_num) as ip_num'))
|
|
|
|
159
|
- ->orderBy('id','desc')
|
|
|
|
160
|
- ->first();
|
|
|
|
161
|
- $arr['pv'] = $pv_ip->pv_num;
|
|
|
|
162
|
- $arr['ip'] = $pv_ip->ip_num;
|
|
|
|
163
|
- $arr['rate'] = 0;
|
|
|
|
164
|
- if($arr['ip'] != 0){
|
|
|
|
165
|
- $arr['rate'] = round(($arr['month_total'] / $arr['ip']) * 100,2);
|
120
|
+ $month_info = $monthCountModel->read(['project_id'=>$project_id,'month'=>$this->param['date']]);
|
|
|
|
121
|
+ if($month_info !== false){
|
|
|
|
122
|
+ $arr['country'] = $month_info['country'];
|
|
|
|
123
|
+ $arr['total'] = $month_info['total'];
|
|
|
|
124
|
+ $arr['month_total'] = $month_info['month_total'];
|
|
|
|
125
|
+ $arr['pv'] = $month_info['pv'];
|
|
|
|
126
|
+ $arr['ip'] = $month_info['ip'];
|
|
|
|
127
|
+ $arr['rate'] = 0;
|
|
|
|
128
|
+ if($arr['ip'] != 0){
|
|
|
|
129
|
+ $arr['rate'] = round(($arr['month_total'] / $arr['ip']) * 100,2);
|
|
|
|
130
|
+ }
|
|
166
|
}
|
131
|
}
|
|
|
|
132
|
+ $arr = $this->sourceCount($arr,$startTime,$endTime);
|
|
|
|
133
|
+ $arr['month'] = date('Y-m',time());
|
|
167
|
return $arr;
|
134
|
return $arr;
|
|
168
|
}
|
135
|
}
|
|
169
|
|
136
|
|
|
@@ -174,7 +141,7 @@ class OptimizationReportController extends BaseController |
|
@@ -174,7 +141,7 @@ class OptimizationReportController extends BaseController |
|
174
|
* @method :post
|
141
|
* @method :post
|
|
175
|
* @time :2023/6/30 16:14
|
142
|
* @time :2023/6/30 16:14
|
|
176
|
*/
|
143
|
*/
|
|
177
|
- public function sourceCount(&$arr,$startTime,$endTime,$domain){
|
144
|
+ public function sourceCount(&$arr,$startTime,$endTime){
|
|
178
|
//访问来源前10
|
145
|
//访问来源前10
|
|
179
|
$source = DB::connection('custom_mysql')->table('gl_customer_visit')
|
146
|
$source = DB::connection('custom_mysql')->table('gl_customer_visit')
|
|
180
|
->select('referrer_url', DB::raw('COUNT(*) as count'))
|
147
|
->select('referrer_url', DB::raw('COUNT(*) as count'))
|