|
...
|
...
|
@@ -3,6 +3,7 @@ |
|
|
|
namespace App\Console\Commands\MonthlyCount;
|
|
|
|
|
|
|
|
use App\Helper\FormGlobalsoApi;
|
|
|
|
use App\Services\ProjectServer;
|
|
|
|
use Carbon\Carbon;
|
|
|
|
use Illuminate\Console\Command;
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
...
|
...
|
@@ -50,7 +51,9 @@ class InquiryMonthlyCount extends Command |
|
|
|
//按月统计询盘记录
|
|
|
|
$arr = $this->inquiryCount($arr,$startTime,$endTime,$value['test_domain']);
|
|
|
|
$arr = $this->flowCount($arr,$startTime,$endTime,$value['project_id']);
|
|
|
|
ProjectServer::useProject($value['project_id']);
|
|
|
|
$arr = $this->sourceCount($arr,$value['test_domain'],$startTime,$endTime);
|
|
|
|
DB::disconnect('custom_mysql');
|
|
|
|
$arr['created_at'] = date('Y-m-d H:i:s');
|
|
|
|
$arr['updated_at'] = date('Y-m-d H:i:s');
|
|
|
|
$arr['project_id'] = $value['project_id'];
|
|
...
|
...
|
@@ -128,21 +131,21 @@ class InquiryMonthlyCount extends Command |
|
|
|
*/
|
|
|
|
public function sourceCount(&$arr,$domain,$startTime,$endTime){
|
|
|
|
//访问来源前10
|
|
|
|
$source = DB::table('gl_customer_visit')
|
|
|
|
$source = DB::connection('custom_mysql')->table('gl_customer_visit')
|
|
|
|
->select('referrer_url', DB::raw('COUNT(*) as count'))
|
|
|
|
->groupBy('referrer_url')->where(['domain'=>$domain])
|
|
|
|
->whereBetween('updated_date', [$startTime,$endTime])
|
|
|
|
->orderByDesc('count')->limit(10)->get()->toArray();
|
|
|
|
$arr['source'] = json_encode($source);
|
|
|
|
//访问国家前15
|
|
|
|
$source_country = DB::table('gl_customer_visit')
|
|
|
|
$source_country = DB::connection('custom_mysql')->table('gl_customer_visit')
|
|
|
|
->select('country',DB::raw('COUNT(*) as ip'),DB::raw('SUM(depth) as pv'))
|
|
|
|
->groupBy('country')->where(['domain'=>$domain])
|
|
|
|
->whereBetween('updated_date', [$startTime,$endTime])
|
|
|
|
->orderBy('ip','desc')->limit(15)->get()->toArray();
|
|
|
|
$arr['source_country'] = json_encode($source_country);
|
|
|
|
//受访界面前15
|
|
|
|
$referrer_url = DB::table('gl_customer_visit')
|
|
|
|
$referrer_url = DB::connection('custom_mysql')->table('gl_customer_visit')
|
|
|
|
->select('url',DB::raw('COUNT(*) as num'))
|
|
|
|
->orderBy('num','desc')->where(['domain'=>$domain])
|
|
|
|
->whereBetween('updated_date', [$startTime,$endTime])
|
|
...
|
...
|
@@ -150,7 +153,7 @@ class InquiryMonthlyCount extends Command |
|
|
|
->limit(15)->get()->toArray();
|
|
|
|
$arr['referrer_url'] = json_encode($referrer_url);
|
|
|
|
//访问端口
|
|
|
|
$referrer_port = DB::table('gl_customer_visit')
|
|
|
|
$referrer_port = DB::connection('custom_mysql')->table('gl_customer_visit')
|
|
|
|
->select('device_port',DB::raw('COUNT(*) as num'))
|
|
|
|
->orderBy('num','desc')->where(['domain'=>$domain])
|
|
|
|
->whereBetween('updated_date', [$startTime,$endTime])
|
|
...
|
...
|
@@ -168,7 +171,7 @@ class InquiryMonthlyCount extends Command |
|
|
|
*/
|
|
|
|
public function selectParam(){
|
|
|
|
$select = [
|
|
|
|
'gl_project.id AS user_id',
|
|
|
|
'gl_project.id AS id',
|
|
|
|
'gl_project.extend_type AS extend_type',
|
|
|
|
'gl_project_deploy_build.test_domain AS test_domain',
|
|
|
|
'gl_project_deploy_optimize.domain AS domain',
|
...
|
...
|
|