作者 lyh

gx

@@ -118,25 +118,24 @@ class MonthCountLogic extends BaseLogic @@ -118,25 +118,24 @@ class MonthCountLogic extends BaseLogic
118 */ 118 */
119 public function sourceCount(&$arr,$startTime,$endTime,$domain){ 119 public function sourceCount(&$arr,$startTime,$endTime,$domain){
120 //访问来源前10 120 //访问来源前10
121 - $domain = 'http://lxl.petuu.shop/';  
122 $source = DB::table('gl_customer_visit') 121 $source = DB::table('gl_customer_visit')
123 ->select('referrer_url', DB::raw('COUNT(*) as count')) 122 ->select('referrer_url', DB::raw('COUNT(*) as count'))
124 ->groupBy('referrer_url')->where(['domain'=>$domain]) 123 ->groupBy('referrer_url')->where(['domain'=>$domain])
125 -// ->whereBetween('updated_date', [$startTime,$endTime]) 124 + ->whereBetween('updated_date', [$startTime,$endTime])
126 ->orderByDesc('count')->limit(10)->get()->toArray(); 125 ->orderByDesc('count')->limit(10)->get()->toArray();
127 $arr['source'] = $source; 126 $arr['source'] = $source;
128 //访问国家前15 127 //访问国家前15
129 $source_country = DB::table('gl_customer_visit') 128 $source_country = DB::table('gl_customer_visit')
130 ->select('country',DB::raw('COUNT(*) as ip'),DB::raw('SUM(depth) as pv')) 129 ->select('country',DB::raw('COUNT(*) as ip'),DB::raw('SUM(depth) as pv'))
131 ->groupBy('country')->where(['domain'=>$domain]) 130 ->groupBy('country')->where(['domain'=>$domain])
132 -// ->whereBetween('updated_date', [$startTime,$endTime]) 131 + ->whereBetween('updated_date', [$startTime,$endTime])
133 ->orderBy('ip','desc')->limit(15)->get()->toArray(); 132 ->orderBy('ip','desc')->limit(15)->get()->toArray();
134 $arr['source_country'] = $source_country; 133 $arr['source_country'] = $source_country;
135 //受访界面前15 134 //受访界面前15
136 $referrer_url = DB::table('gl_customer_visit') 135 $referrer_url = DB::table('gl_customer_visit')
137 ->select('url',DB::raw('COUNT(*) as num')) 136 ->select('url',DB::raw('COUNT(*) as num'))
138 ->orderBy('num','desc')->where(['domain'=>$domain]) 137 ->orderBy('num','desc')->where(['domain'=>$domain])
139 -// ->whereBetween('updated_date', [$startTime,$endTime]) 138 + ->whereBetween('updated_date', [$startTime,$endTime])
140 ->groupBy('url') 139 ->groupBy('url')
141 ->limit(15)->get()->toArray(); 140 ->limit(15)->get()->toArray();
142 $arr['referrer_url'] = $referrer_url; 141 $arr['referrer_url'] = $referrer_url;
@@ -144,7 +143,7 @@ class MonthCountLogic extends BaseLogic @@ -144,7 +143,7 @@ class MonthCountLogic extends BaseLogic
144 $referrer_port = DB::table('gl_customer_visit') 143 $referrer_port = DB::table('gl_customer_visit')
145 ->select('device_port',DB::raw('COUNT(*) as num')) 144 ->select('device_port',DB::raw('COUNT(*) as num'))
146 ->orderBy('num','desc')->where(['domain'=>$domain]) 145 ->orderBy('num','desc')->where(['domain'=>$domain])
147 -// ->whereBetween('updated_date', [$startTime,$endTime]) 146 + ->whereBetween('updated_date', [$startTime,$endTime])
148 ->groupBy('device_port') 147 ->groupBy('device_port')
149 ->limit(15)->get()->toArray(); 148 ->limit(15)->get()->toArray();
150 $arr['referrer_port'] = $referrer_port; 149 $arr['referrer_port'] = $referrer_port;
@@ -131,14 +131,21 @@ class ProductLogic extends BaseLogic @@ -131,14 +131,21 @@ class ProductLogic extends BaseLogic
131 return $this->success(); 131 return $this->success();
132 } 132 }
133 133
  134 + /**
  135 + * @remark :统计数据
  136 + * @name :getStatusNumber
  137 + * @author :lyh
  138 + * @method :post
  139 + * @time :2023/8/9 10:17
  140 + */
134 public function getStatusNumber(){ 141 public function getStatusNumber(){
135 //三种状态 0:草稿 1:发布 2:回收站 142 //三种状态 0:草稿 1:发布 2:回收站
136 $data = ['dra'=>0,'pub'=>1,'del'=>2,'tal'=>3]; 143 $data = ['dra'=>0,'pub'=>1,'del'=>2,'tal'=>3];
137 foreach ($data as $k => $v){ 144 foreach ($data as $k => $v){
138 if($v == 3){ 145 if($v == 3){
139 - $data[$k] = $this->model->count(); 146 + $data[$k] = $this->model->where(['project_id'=>$this->user['project_id']])->count();
140 }else{ 147 }else{
141 - $data[$k] = $this->model->where(['status'=>$v])->count(); 148 + $data[$k] = $this->model->where(['status'=>$v,'project_id'=>$this->user['project_id']])->count();
142 } 149 }
143 } 150 }
144 return $this->success($data); 151 return $this->success($data);