|
@@ -120,19 +120,24 @@ class InquiryMonthlyCount extends Command |
|
@@ -120,19 +120,24 @@ class InquiryMonthlyCount extends Command |
|
120
|
* @time :2023/6/30 16:14
|
120
|
* @time :2023/6/30 16:14
|
|
121
|
*/
|
121
|
*/
|
|
122
|
public function sourceCount(&$arr,$domain,$startTime,$endTime){
|
122
|
public function sourceCount(&$arr,$domain,$startTime,$endTime){
|
|
|
|
123
|
+ //访问来源前10
|
|
123
|
$arr['source'] = DB::table('gl_customer_visit')
|
124
|
$arr['source'] = DB::table('gl_customer_visit')
|
|
124
|
->select('referrer_url', DB::raw('COUNT(*) as count'))
|
125
|
->select('referrer_url', DB::raw('COUNT(*) as count'))
|
|
125
|
->groupBy('referrer_url')->where(['domain'=>$domain])
|
126
|
->groupBy('referrer_url')->where(['domain'=>$domain])
|
|
126
|
->where('updated_date','>=',$startTime->toDateString())
|
127
|
->where('updated_date','>=',$startTime->toDateString())
|
|
127
|
->where('updated_date','<=',$endTime->toDateString())
|
128
|
->where('updated_date','<=',$endTime->toDateString())
|
|
128
|
- ->orderByDesc('count')->limit(8)->get()->toArray();
|
129
|
+ ->orderByDesc('count')->limit(10)->get()->toArray();
|
|
129
|
if(!empty($data)){
|
130
|
if(!empty($data)){
|
|
130
|
$arr['source'] = json_encode($arr['source']);
|
131
|
$arr['source'] = json_encode($arr['source']);
|
|
131
|
}
|
132
|
}
|
|
|
|
133
|
+ //访问国家前15
|
|
132
|
$arr['source_country'] = DB::table('gl_customer_visit')
|
134
|
$arr['source_country'] = DB::table('gl_customer_visit')
|
|
133
|
->select('country',DB::raw('COUNT(*) as ip'),DB::raw('SUM(depth) as pv'))
|
135
|
->select('country',DB::raw('COUNT(*) as ip'),DB::raw('SUM(depth) as pv'))
|
|
134
|
->groupBy('country')->where(['domain'=>$domain])
|
136
|
->groupBy('country')->where(['domain'=>$domain])
|
|
|
|
137
|
+ ->where('updated_date','>=',$startTime->toDateString())
|
|
|
|
138
|
+ ->where('updated_date','<=',$endTime->toDateString())
|
|
135
|
->orderBy('ip','desc')->limit(15)->get()->toArray();
|
139
|
->orderBy('ip','desc')->limit(15)->get()->toArray();
|
|
|
|
140
|
+ //受访界面
|
|
136
|
return $arr;
|
141
|
return $arr;
|
|
137
|
}
|
142
|
}
|
|
138
|
} |
143
|
} |