作者 赵彬吉

update

... ... @@ -102,7 +102,7 @@ class Count extends Command
* @time :2023/6/14 15:40
*/
public function pv_num($yesterday,$domain){
$pv = DB::connection('custom_mysql')->table('gl_customer_visit_item')->whereDate('updated_date', $yesterday)->where('domain',$domain)->count();
$pv = DB::connection('custom_mysql')->table('gl_customer_visit_item')->whereDate('updated_date', $yesterday)->count();
return $pv;
}
... ... @@ -113,7 +113,7 @@ class Count extends Command
* @time :2023/6/14 15:40
*/
public function ip_num($yesterday,$domain){
$ip = DB::connection('custom_mysql')->table('gl_customer_visit')->whereDate('updated_date', $yesterday)->where('domain',$domain)->count();
$ip = DB::connection('custom_mysql')->table('gl_customer_visit')->whereDate('updated_date', $yesterday)->count();
return $ip;
}
... ...
... ... @@ -138,10 +138,14 @@ class CountLogic extends BaseLogic
$customerVisitModel = new Visit();
$data = $customerVisitModel->select('referrer_url', DB::raw('COUNT(*) as count'))
->groupBy('referrer_url')->where(['domain'=>$this->user['domain']])
->orderByDesc('count')->limit(8)->get()->toArray();
->orderByDesc('count')->limit(9)->get()->toArray();
$total = $customerVisitModel->count();
if(!empty($data)){
foreach ($data as $k=>$v){
if(empty($v['referrer_url'])){
unset($data[$k]);
continue;
}
$data[$k]['proportion'] = ($v['count']/$total) * 100;
}
}
... ...