作者 lyh

gx

... ... @@ -42,7 +42,7 @@ class MonthCountLogic extends BaseLogic
*/
public function currentMonthCount(){
$startTime = Carbon::now()->startOfMonth()->toDateString();
$endTime = date('Y-m-d H:i:s',time());
$endTime = date('Y-m-d',time());
$arr = [];
$arr = $this->inquiryCount($arr,$startTime,$endTime,$this->user['domain']);
$arr = $this->flowCount($arr,$startTime,$endTime,$this->user['project_id']);
... ... @@ -94,8 +94,8 @@ class MonthCountLogic extends BaseLogic
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;
... ... @@ -118,24 +118,24 @@ class MonthCountLogic extends BaseLogic
$source = DB::table('gl_customer_visit')
->select('referrer_url', DB::raw('COUNT(*) as count'))
->groupBy('referrer_url')->where(['domain'=>$domain])
->where('updated_date','>=',$startTime->toDateString())
->where('updated_date','<=',$endTime->toDateString())
->where('updated_date','>=',$startTime)
->where('updated_date','<=',$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])
->where('updated_date','>=',$startTime->toDateString())
->where('updated_date','<=',$endTime->toDateString())
->where('updated_date','>=',$startTime)
->where('updated_date','<=',$endTime)
->orderBy('ip','desc')->limit(15)->get()->toArray();
$arr['source_country'] = json_encode($source_country);
//受访界面前15
$referrer_url = DB::table('gl_customer_visit_item')
->select('url',DB::raw('COUNT(*) as num'))
->orderBy('num','desc')->where(['domain'=>$domain])
->where('updated_date','>=',$startTime->toDateString())
->where('updated_date','<=',$endTime->toDateString())
->where('updated_date','>=',$startTime)
->where('updated_date','<=',$endTime)
->groupBy('url')
->limit(15)->get()->toArray();
$arr['referrer_url'] = json_encode($referrer_url);
... ... @@ -143,8 +143,8 @@ class MonthCountLogic extends BaseLogic
$referrer_port = DB::table('gl_customer_visit_item')
->select('device_port',DB::raw('COUNT(*) as num'))
->orderBy('num','desc')->where(['domain'=>$domain])
->where('updated_date','>=',$startTime->toDateString())
->where('updated_date','<=',$endTime->toDateString())
->where('updated_date','>=',$startTime)
->where('updated_date','<=',$endTime)
->groupBy('device_port')
->limit(15)->get()->toArray();
$arr['referrer_port'] = json_encode($referrer_port);
... ...