|
...
|
...
|
@@ -39,9 +39,9 @@ class InquiryMonthlyCount extends Command |
|
|
|
->leftJoin('gl_project_deploy_optimize', 'gl_project.id', '=', 'gl_project_deploy_optimize.project_id')
|
|
|
|
->select($this->selectParam())->get()->toArray();
|
|
|
|
// 获取上个月的开始时间
|
|
|
|
$startTime = Carbon::now()->subMonth()->startOfMonth();
|
|
|
|
$startTime = Carbon::now()->subMonth()->startOfMonth()->toDateString();
|
|
|
|
// 获取上个月的结束时间
|
|
|
|
$endTime = Carbon::now()->subMonth()->endOfMonth();
|
|
|
|
$endTime = Carbon::now()->subMonth()->endOfMonth()->toDateString();
|
|
|
|
foreach ($list as $value){
|
|
|
|
$value = (array)$value;
|
|
|
|
if($value['domain'] != ''){
|
|
...
|
...
|
@@ -105,8 +105,8 @@ class InquiryMonthlyCount extends Command |
|
|
|
public function flowCount(&$arr,&$startTime,&$endTime,$project_id){
|
|
|
|
$pv_ip = DB::table('gl_count')
|
|
|
|
->where(['project_id'=>$project_id])
|
|
|
|
->where('date','>=',$startTime->toDateString().' 00:00:00')
|
|
|
|
->where('date','<=',$endTime->toDateString().' 23:59:59')
|
|
|
|
->where('date','>=',$startTime.' 00:00:00')
|
|
|
|
->where('date','<=',$endTime.' 23:59:59')
|
|
|
|
->select(DB::raw('SUM(pv_num) as pv_num'), DB::raw('SUM(ip_num) as ip_num'))
|
|
|
|
->first();
|
|
|
|
$arr['pv'] = $pv_ip->pv_num;
|
|
...
|
...
|
@@ -129,21 +129,21 @@ class InquiryMonthlyCount extends Command |
|
|
|
$source = DB::table('gl_customer_visit')
|
|
|
|
->select('referrer_url', DB::raw('COUNT(*) as count'))
|
|
|
|
->groupBy('referrer_url')->where(['domain'=>$domain])
|
|
|
|
->whereBetween('updated_date', [$startTime->toDateString(),$endTime->toDateString()])
|
|
|
|
->whereBetween('updated_date', [$startTime,$endTime])
|
|
|
|
->orderByDesc('count')->limit(10)->get()->toArray();
|
|
|
|
$arr['source'] = json_encode($source);
|
|
|
|
//访问国家前15
|
|
|
|
$source_country = DB::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->toDateString(),$endTime->toDateString()])
|
|
|
|
->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')
|
|
|
|
->select('url',DB::raw('COUNT(*) as num'))
|
|
|
|
->orderBy('num','desc')->where(['domain'=>$domain])
|
|
|
|
->whereBetween('updated_date', [$startTime->toDateString(),$endTime->toDateString()])
|
|
|
|
->whereBetween('updated_date', [$startTime,$endTime])
|
|
|
|
->groupBy('url')
|
|
|
|
->limit(15)->get()->toArray();
|
|
|
|
$arr['referrer_url'] = json_encode($referrer_url);
|
|
...
|
...
|
@@ -151,7 +151,7 @@ class InquiryMonthlyCount extends Command |
|
|
|
$referrer_port = DB::table('gl_customer_visit')
|
|
|
|
->select('device_port',DB::raw('COUNT(*) as num'))
|
|
|
|
->orderBy('num','desc')->where(['domain'=>$domain])
|
|
|
|
->whereBetween('updated_date', [$startTime->toDateString(),$endTime->toDateString()])
|
|
|
|
->whereBetween('updated_date', [$startTime,$endTime])
|
|
|
|
->groupBy('device_port')
|
|
|
|
->limit(15)->get()->toArray();
|
|
|
|
$arr['referrer_port'] = json_encode($referrer_port);
|
...
|
...
|
|