|
@@ -3,6 +3,7 @@ |
|
@@ -3,6 +3,7 @@ |
|
3
|
namespace App\Console\Commands\MonthlyCount;
|
3
|
namespace App\Console\Commands\MonthlyCount;
|
|
4
|
|
4
|
|
|
5
|
use App\Helper\FormGlobalsoApi;
|
5
|
use App\Helper\FormGlobalsoApi;
|
|
|
|
6
|
+use App\Services\ProjectServer;
|
|
6
|
use Carbon\Carbon;
|
7
|
use Carbon\Carbon;
|
|
7
|
use Illuminate\Console\Command;
|
8
|
use Illuminate\Console\Command;
|
|
8
|
use Illuminate\Support\Facades\DB;
|
9
|
use Illuminate\Support\Facades\DB;
|
|
@@ -50,7 +51,9 @@ class InquiryMonthlyCount extends Command |
|
@@ -50,7 +51,9 @@ class InquiryMonthlyCount extends Command |
|
50
|
//按月统计询盘记录
|
51
|
//按月统计询盘记录
|
|
51
|
$arr = $this->inquiryCount($arr,$startTime,$endTime,$value['test_domain']);
|
52
|
$arr = $this->inquiryCount($arr,$startTime,$endTime,$value['test_domain']);
|
|
52
|
$arr = $this->flowCount($arr,$startTime,$endTime,$value['project_id']);
|
53
|
$arr = $this->flowCount($arr,$startTime,$endTime,$value['project_id']);
|
|
|
|
54
|
+ ProjectServer::useProject($value['project_id']);
|
|
53
|
$arr = $this->sourceCount($arr,$value['test_domain'],$startTime,$endTime);
|
55
|
$arr = $this->sourceCount($arr,$value['test_domain'],$startTime,$endTime);
|
|
|
|
56
|
+ DB::disconnect('custom_mysql');
|
|
54
|
$arr['created_at'] = date('Y-m-d H:i:s');
|
57
|
$arr['created_at'] = date('Y-m-d H:i:s');
|
|
55
|
$arr['updated_at'] = date('Y-m-d H:i:s');
|
58
|
$arr['updated_at'] = date('Y-m-d H:i:s');
|
|
56
|
$arr['project_id'] = $value['project_id'];
|
59
|
$arr['project_id'] = $value['project_id'];
|
|
@@ -128,21 +131,21 @@ class InquiryMonthlyCount extends Command |
|
@@ -128,21 +131,21 @@ class InquiryMonthlyCount extends Command |
|
128
|
*/
|
131
|
*/
|
|
129
|
public function sourceCount(&$arr,$domain,$startTime,$endTime){
|
132
|
public function sourceCount(&$arr,$domain,$startTime,$endTime){
|
|
130
|
//访问来源前10
|
133
|
//访问来源前10
|
|
131
|
- $source = DB::table('gl_customer_visit')
|
134
|
+ $source = DB::connection('custom_mysql')->table('gl_customer_visit')
|
|
132
|
->select('referrer_url', DB::raw('COUNT(*) as count'))
|
135
|
->select('referrer_url', DB::raw('COUNT(*) as count'))
|
|
133
|
->groupBy('referrer_url')->where(['domain'=>$domain])
|
136
|
->groupBy('referrer_url')->where(['domain'=>$domain])
|
|
134
|
->whereBetween('updated_date', [$startTime,$endTime])
|
137
|
->whereBetween('updated_date', [$startTime,$endTime])
|
|
135
|
->orderByDesc('count')->limit(10)->get()->toArray();
|
138
|
->orderByDesc('count')->limit(10)->get()->toArray();
|
|
136
|
$arr['source'] = json_encode($source);
|
139
|
$arr['source'] = json_encode($source);
|
|
137
|
//访问国家前15
|
140
|
//访问国家前15
|
|
138
|
- $source_country = DB::table('gl_customer_visit')
|
141
|
+ $source_country = DB::connection('custom_mysql')->table('gl_customer_visit')
|
|
139
|
->select('country',DB::raw('COUNT(*) as ip'),DB::raw('SUM(depth) as pv'))
|
142
|
->select('country',DB::raw('COUNT(*) as ip'),DB::raw('SUM(depth) as pv'))
|
|
140
|
->groupBy('country')->where(['domain'=>$domain])
|
143
|
->groupBy('country')->where(['domain'=>$domain])
|
|
141
|
->whereBetween('updated_date', [$startTime,$endTime])
|
144
|
->whereBetween('updated_date', [$startTime,$endTime])
|
|
142
|
->orderBy('ip','desc')->limit(15)->get()->toArray();
|
145
|
->orderBy('ip','desc')->limit(15)->get()->toArray();
|
|
143
|
$arr['source_country'] = json_encode($source_country);
|
146
|
$arr['source_country'] = json_encode($source_country);
|
|
144
|
//受访界面前15
|
147
|
//受访界面前15
|
|
145
|
- $referrer_url = DB::table('gl_customer_visit')
|
148
|
+ $referrer_url = DB::connection('custom_mysql')->table('gl_customer_visit')
|
|
146
|
->select('url',DB::raw('COUNT(*) as num'))
|
149
|
->select('url',DB::raw('COUNT(*) as num'))
|
|
147
|
->orderBy('num','desc')->where(['domain'=>$domain])
|
150
|
->orderBy('num','desc')->where(['domain'=>$domain])
|
|
148
|
->whereBetween('updated_date', [$startTime,$endTime])
|
151
|
->whereBetween('updated_date', [$startTime,$endTime])
|
|
@@ -150,7 +153,7 @@ class InquiryMonthlyCount extends Command |
|
@@ -150,7 +153,7 @@ class InquiryMonthlyCount extends Command |
|
150
|
->limit(15)->get()->toArray();
|
153
|
->limit(15)->get()->toArray();
|
|
151
|
$arr['referrer_url'] = json_encode($referrer_url);
|
154
|
$arr['referrer_url'] = json_encode($referrer_url);
|
|
152
|
//访问端口
|
155
|
//访问端口
|
|
153
|
- $referrer_port = DB::table('gl_customer_visit')
|
156
|
+ $referrer_port = DB::connection('custom_mysql')->table('gl_customer_visit')
|
|
154
|
->select('device_port',DB::raw('COUNT(*) as num'))
|
157
|
->select('device_port',DB::raw('COUNT(*) as num'))
|
|
155
|
->orderBy('num','desc')->where(['domain'=>$domain])
|
158
|
->orderBy('num','desc')->where(['domain'=>$domain])
|
|
156
|
->whereBetween('updated_date', [$startTime,$endTime])
|
159
|
->whereBetween('updated_date', [$startTime,$endTime])
|
|
@@ -168,7 +171,7 @@ class InquiryMonthlyCount extends Command |
|
@@ -168,7 +171,7 @@ class InquiryMonthlyCount extends Command |
|
168
|
*/
|
171
|
*/
|
|
169
|
public function selectParam(){
|
172
|
public function selectParam(){
|
|
170
|
$select = [
|
173
|
$select = [
|
|
171
|
- 'gl_project.id AS user_id',
|
174
|
+ 'gl_project.id AS id',
|
|
172
|
'gl_project.extend_type AS extend_type',
|
175
|
'gl_project.extend_type AS extend_type',
|
|
173
|
'gl_project_deploy_build.test_domain AS test_domain',
|
176
|
'gl_project_deploy_build.test_domain AS test_domain',
|
|
174
|
'gl_project_deploy_optimize.domain AS domain',
|
177
|
'gl_project_deploy_optimize.domain AS domain',
|