作者 lyh

gx

... ... @@ -42,34 +42,30 @@ class MonthReportController extends BaseController
$monthCountModel = new MonthCount();
$this->map['project_id'] = $this->user['project_id'];
$info = $monthCountModel->read($this->map);
foreach ($info as $k => $v){
if(!empty($v['source_country'])){
$v['source_country'] = json_decode($v['source_country']);
}
if(!empty($v['referrer_port'])){
$v['referrer_port'] = json_decode($v['referrer_port']);
}
if(!empty($v['referrer_url'])){
$v['referrer_url'] = json_decode($v['referrer_url']);
}
if(!empty($v['source'])){
$v['source'] = json_decode($v['source']);
}
if(!empty($v['country'])){
$v['country'] = json_decode($v['country']);
}
//获取上去的流量统计
// 获取上个月的开始时间
$startTime = Carbon::now()->subMonth()->startOfMonth()->toDateString();
// 获取上个月的结束时间
$endTime = Carbon::now()->subMonth()->endOfMonth()->toDateString();
$param = [
'date' => ['between',[$startTime,$endTime]],
'project_id' => $this->user['project_id']
];
$v['pv_ip'] = (new Count())->list($param,'date',['id','pv_num','ip_num','date']);
$info[$k] = $v;
if(!empty($info['source_country'])){
$info['source_country'] = json_decode($info['source_country']);
}
if(!empty($info['referrer_port'])){
$info['referrer_port'] = json_decode($info['referrer_port']);
}
if(!empty($info['referrer_url'])){
$info['referrer_url'] = json_decode($info['referrer_url']);
}
if(!empty($info['source'])){
$info['source'] = json_decode($info['source']);
}
if(!empty($info['country'])){
$info['country'] = json_decode($info['country']);
}
// 获取上个月的开始时间
$startTime = Carbon::now()->subMonth()->startOfMonth()->toDateString();
// 获取上个月的结束时间
$endTime = Carbon::now()->subMonth()->endOfMonth()->toDateString();
$param = [
'date' => ['between',[$startTime,$endTime]],
'project_id' => $this->user['project_id']
];
$info['pv_ip'] = (new Count())->list($param,'date',['id','pv_num','ip_num','date']);
$this->response('success',Code::SUCCESS,$info);
}
}
... ...