|
...
|
...
|
@@ -81,16 +81,10 @@ class InquiryMonthlyCount extends Command |
|
|
|
arsort($countryArr);
|
|
|
|
$top20 = array_slice($countryArr, 0, 15, true);
|
|
|
|
$arr['country'] = json_encode($top20);
|
|
|
|
$this->flowCount($arr,$startTime,$endTime,$project_id);
|
|
|
|
$arr['created_at'] = date('Y-m-d H:i:s');
|
|
|
|
$arr['updated_at'] = date('Y-m-d H:i:s');
|
|
|
|
$arr['project_id'] = $project_id;
|
|
|
|
$pv_ip = DB::table('gl_count')
|
|
|
|
->where(['project_id'=>1])
|
|
|
|
->where('date','>=',$startTime->toDateString().' 00:00:00')
|
|
|
|
->where('date','<=',$endTime->toDateString().' 23:59:59')
|
|
|
|
->select(DB::raw('SUM(pv_num) as pv_num'), DB::raw('SUM(ip_num) as ip_num'))
|
|
|
|
->get();
|
|
|
|
|
|
|
|
DB::table('gl_inquiry_month_count')->insert($arr);
|
|
|
|
}
|
|
|
|
|
|
...
|
...
|
@@ -101,11 +95,35 @@ class InquiryMonthlyCount extends Command |
|
|
|
* @method :post
|
|
|
|
* @time :2023/6/30 14:31
|
|
|
|
*/
|
|
|
|
public function flowCount($startTime,$endTime,$project_id){
|
|
|
|
DB::table('gl_count')
|
|
|
|
public function flowCount(&$arr,$startTime,$endTime,$project_id){
|
|
|
|
$pv_ip = DB::table('gl_count')
|
|
|
|
->where(['project_id'=>$project_id])
|
|
|
|
->where('date','>=',$startTime.' 00:00:00')
|
|
|
|
->where('date','<=',$endTime.' 23:59:59')
|
|
|
|
->sum('pv_num');
|
|
|
|
->where('date','>=',$startTime->toDateString().' 00:00:00')
|
|
|
|
->where('date','<=',$endTime->toDateString().' 23:59:59')
|
|
|
|
->select(DB::raw('SUM(pv_num) as pv_num'), DB::raw('SUM(ip_num) as ip_num'))
|
|
|
|
->first();
|
|
|
|
$arr['pv'] = $pv_ip['pv_num'];
|
|
|
|
$arr['ip'] = $pv_ip['ip_num'];
|
|
|
|
if($arr['ip'] != 0){
|
|
|
|
$arr['rate'] = round(($arr['month_total'] / $arr['ip']) * 10,2);
|
|
|
|
}
|
|
|
|
return $arr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :访问前8
|
|
|
|
* @name :sourceCount
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/6/30 16:14
|
|
|
|
*/
|
|
|
|
public function sourceCount(&$arr,$domain){
|
|
|
|
$data = DB::table('gl_customer_visit')
|
|
|
|
->select('referrer_url', DB::raw('COUNT(*) as count'))
|
|
|
|
->groupBy('referrer_url')->where(['domain'=>$domain])
|
|
|
|
->orderByDesc('count')->limit(8)->get()->toArray();
|
|
|
|
if(!empty($data)){
|
|
|
|
$arr['source'] = json_encode($data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|