作者 赵彬吉

update

@@ -102,7 +102,7 @@ class Count extends Command @@ -102,7 +102,7 @@ class Count extends Command
102 * @time :2023/6/14 15:40 102 * @time :2023/6/14 15:40
103 */ 103 */
104 public function pv_num($yesterday,$domain){ 104 public function pv_num($yesterday,$domain){
105 - $pv = DB::connection('custom_mysql')->table('gl_customer_visit_item')->whereDate('updated_date', $yesterday)->where('domain',$domain)->count(); 105 + $pv = DB::connection('custom_mysql')->table('gl_customer_visit_item')->whereDate('updated_date', $yesterday)->count();
106 return $pv; 106 return $pv;
107 } 107 }
108 108
@@ -113,7 +113,7 @@ class Count extends Command @@ -113,7 +113,7 @@ class Count extends Command
113 * @time :2023/6/14 15:40 113 * @time :2023/6/14 15:40
114 */ 114 */
115 public function ip_num($yesterday,$domain){ 115 public function ip_num($yesterday,$domain){
116 - $ip = DB::connection('custom_mysql')->table('gl_customer_visit')->whereDate('updated_date', $yesterday)->where('domain',$domain)->count(); 116 + $ip = DB::connection('custom_mysql')->table('gl_customer_visit')->whereDate('updated_date', $yesterday)->count();
117 return $ip; 117 return $ip;
118 } 118 }
119 119
@@ -138,10 +138,14 @@ class CountLogic extends BaseLogic @@ -138,10 +138,14 @@ class CountLogic extends BaseLogic
138 $customerVisitModel = new Visit(); 138 $customerVisitModel = new Visit();
139 $data = $customerVisitModel->select('referrer_url', DB::raw('COUNT(*) as count')) 139 $data = $customerVisitModel->select('referrer_url', DB::raw('COUNT(*) as count'))
140 ->groupBy('referrer_url')->where(['domain'=>$this->user['domain']]) 140 ->groupBy('referrer_url')->where(['domain'=>$this->user['domain']])
141 - ->orderByDesc('count')->limit(8)->get()->toArray(); 141 + ->orderByDesc('count')->limit(9)->get()->toArray();
142 $total = $customerVisitModel->count(); 142 $total = $customerVisitModel->count();
143 if(!empty($data)){ 143 if(!empty($data)){
144 foreach ($data as $k=>$v){ 144 foreach ($data as $k=>$v){
  145 + if(empty($v['referrer_url'])){
  146 + unset($data[$k]);
  147 + continue;
  148 + }
145 $data[$k]['proportion'] = ($v['count']/$total) * 100; 149 $data[$k]['proportion'] = ($v['count']/$total) * 100;
146 } 150 }
147 } 151 }