|
@@ -31,6 +31,21 @@ class MonthCountLogic extends BaseLogic |
|
@@ -31,6 +31,21 @@ class MonthCountLogic extends BaseLogic |
|
31
|
public function getCountLists($map,$order = 'created_at',$filed = ['*']){
|
31
|
public function getCountLists($map,$order = 'created_at',$filed = ['*']){
|
|
32
|
$map['project_id'] = $this->user['project_id'];
|
32
|
$map['project_id'] = $this->user['project_id'];
|
|
33
|
$lists = $this->model->list($map,$order,$filed);
|
33
|
$lists = $this->model->list($map,$order,$filed);
|
|
|
|
34
|
+ if(isset($this->project['is_record_china_visit']) && ($this->project['is_record_china_visit'] == 0)){
|
|
|
|
35
|
+ foreach ($lists as $k => $v){
|
|
|
|
36
|
+ if(empty($v['source_country'])){
|
|
|
|
37
|
+ continue;
|
|
|
|
38
|
+ }
|
|
|
|
39
|
+ $source_country = json_decode($v['source_country']);
|
|
|
|
40
|
+ foreach ($source_country as $k1 => $v1){
|
|
|
|
41
|
+ if($v1['country'] == '中国'){
|
|
|
|
42
|
+ unset($source_country[$k1]);
|
|
|
|
43
|
+ }
|
|
|
|
44
|
+ }
|
|
|
|
45
|
+ $v['source_country'] = json_encode(array_values($source_country));
|
|
|
|
46
|
+ $lists[$k] = $v;
|
|
|
|
47
|
+ }
|
|
|
|
48
|
+ }
|
|
34
|
$lists['new'] = $this->currentMonthCount();
|
49
|
$lists['new'] = $this->currentMonthCount();
|
|
35
|
return $this->success($lists);
|
50
|
return $this->success($lists);
|
|
36
|
}
|
51
|
}
|
|
@@ -46,7 +61,6 @@ class MonthCountLogic extends BaseLogic |
|
@@ -46,7 +61,6 @@ class MonthCountLogic extends BaseLogic |
|
46
|
$startTime = Carbon::now()->startOfMonth()->toDateString();
|
61
|
$startTime = Carbon::now()->startOfMonth()->toDateString();
|
|
47
|
$endTime = date('Y-m-d',time());
|
62
|
$endTime = date('Y-m-d',time());
|
|
48
|
$arr = [];
|
63
|
$arr = [];
|
|
49
|
-
|
|
|
|
50
|
ProjectServer::useProject($this->user['project_id']);
|
64
|
ProjectServer::useProject($this->user['project_id']);
|
|
51
|
$arr = $this->inquiryCount($arr,$startTime,$endTime,$this->user['domain']);
|
65
|
$arr = $this->inquiryCount($arr,$startTime,$endTime,$this->user['domain']);
|
|
52
|
$arr = $this->flowCount($arr,$startTime,$endTime,$this->user['project_id']);
|
66
|
$arr = $this->flowCount($arr,$startTime,$endTime,$this->user['project_id']);
|
|
@@ -114,6 +128,7 @@ class MonthCountLogic extends BaseLogic |
|
@@ -114,6 +128,7 @@ class MonthCountLogic extends BaseLogic |
|
114
|
->where(['project_id'=>$project_id])
|
128
|
->where(['project_id'=>$project_id])
|
|
115
|
->whereBetween('date', [$startTime,$endTime])
|
129
|
->whereBetween('date', [$startTime,$endTime])
|
|
116
|
->select(DB::raw('SUM(pv_num) as pv_num'), DB::raw('SUM(ip_num) as ip_num'))
|
130
|
->select(DB::raw('SUM(pv_num) as pv_num'), DB::raw('SUM(ip_num) as ip_num'))
|
|
|
|
131
|
+ ->orderBy('id','desc')
|
|
117
|
->first();
|
132
|
->first();
|
|
118
|
$arr['pv'] = $pv_ip->pv_num;
|
133
|
$arr['pv'] = $pv_ip->pv_num;
|
|
119
|
$arr['ip'] = $pv_ip->ip_num;
|
134
|
$arr['ip'] = $pv_ip->ip_num;
|
|
@@ -140,10 +155,13 @@ class MonthCountLogic extends BaseLogic |
|
@@ -140,10 +155,13 @@ class MonthCountLogic extends BaseLogic |
|
140
|
->orderByDesc('count')->limit(10)->get()->toArray();
|
155
|
->orderByDesc('count')->limit(10)->get()->toArray();
|
|
141
|
$arr['source'] = $source;
|
156
|
$arr['source'] = $source;
|
|
142
|
//访问国家前15
|
157
|
//访问国家前15
|
|
143
|
- $source_country = DB::connection('custom_mysql')->table('gl_customer_visit')
|
158
|
+ $query = DB::connection('custom_mysql')->table('gl_customer_visit')
|
|
144
|
->select('country',DB::raw('COUNT(*) as ip'),DB::raw('SUM(depth) as pv'))
|
159
|
->select('country',DB::raw('COUNT(*) as ip'),DB::raw('SUM(depth) as pv'))
|
|
145
|
- ->groupBy('country')
|
|
|
|
146
|
- ->whereBetween('updated_date', [$startTime,$endTime])
|
160
|
+ ->groupBy('country');
|
|
|
|
161
|
+ if(isset($this->project['is_record_china_visit']) && ($this->project['is_record_china_visit'] == 0)){
|
|
|
|
162
|
+ $query->where('country','<>','中国');
|
|
|
|
163
|
+ }
|
|
|
|
164
|
+ $source_country = $query->whereBetween('updated_date', [$startTime,$endTime])
|
|
147
|
->orderBy('ip','desc')->limit(15)->get()->toArray();
|
165
|
->orderBy('ip','desc')->limit(15)->get()->toArray();
|
|
148
|
$arr['source_country'] = $source_country;
|
166
|
$arr['source_country'] = $source_country;
|
|
149
|
//受访界面前15
|
167
|
//受访界面前15
|
|
@@ -176,7 +194,7 @@ class MonthCountLogic extends BaseLogic |
|
@@ -176,7 +194,7 @@ class MonthCountLogic extends BaseLogic |
|
176
|
$count = new Count();
|
194
|
$count = new Count();
|
|
177
|
$startTime = date("Y-m-d", strtotime("-9 months", mktime(0, 0, 0)));
|
195
|
$startTime = date("Y-m-d", strtotime("-9 months", mktime(0, 0, 0)));
|
|
178
|
$ensTime = date('Y-m-d',time());
|
196
|
$ensTime = date('Y-m-d',time());
|
|
179
|
- $lists = $count->list(['date'=>['between',[$startTime,$ensTime]],'project_id'=>$this->user['project_id']]);
|
197
|
+ $lists = $count->list(['date'=>['between',[$startTime,$ensTime]],'project_id'=>$this->user['project_id']],'id',['*'],'asc');
|
|
180
|
$groupedData = [];
|
198
|
$groupedData = [];
|
|
181
|
foreach ($lists as $k=>$v){
|
199
|
foreach ($lists as $k=>$v){
|
|
182
|
$month = date('Y-m', strtotime($v['date']));
|
200
|
$month = date('Y-m', strtotime($v['date']));
|
|
@@ -184,7 +202,7 @@ class MonthCountLogic extends BaseLogic |
|
@@ -184,7 +202,7 @@ class MonthCountLogic extends BaseLogic |
|
184
|
$groupedData[$month] = [];
|
202
|
$groupedData[$month] = [];
|
|
185
|
}
|
203
|
}
|
|
186
|
if(empty($v['country'])){
|
204
|
if(empty($v['country'])){
|
|
187
|
- $v['country'] = ['中国'=>0];
|
205
|
+ $v['country'] = [];
|
|
188
|
}
|
206
|
}
|
|
189
|
$groupedData[$month][] = $v;
|
207
|
$groupedData[$month][] = $v;
|
|
190
|
}
|
208
|
}
|