正在显示
1 个修改的文件
包含
23 行增加
和
27 行删除
| @@ -42,34 +42,30 @@ class MonthReportController extends BaseController | @@ -42,34 +42,30 @@ class MonthReportController extends BaseController | ||
| 42 | $monthCountModel = new MonthCount(); | 42 | $monthCountModel = new MonthCount(); |
| 43 | $this->map['project_id'] = $this->user['project_id']; | 43 | $this->map['project_id'] = $this->user['project_id']; |
| 44 | $info = $monthCountModel->read($this->map); | 44 | $info = $monthCountModel->read($this->map); |
| 45 | - foreach ($info as $k => $v){ | ||
| 46 | - if(!empty($v['source_country'])){ | ||
| 47 | - $v['source_country'] = json_decode($v['source_country']); | ||
| 48 | - } | ||
| 49 | - if(!empty($v['referrer_port'])){ | ||
| 50 | - $v['referrer_port'] = json_decode($v['referrer_port']); | ||
| 51 | - } | ||
| 52 | - if(!empty($v['referrer_url'])){ | ||
| 53 | - $v['referrer_url'] = json_decode($v['referrer_url']); | ||
| 54 | - } | ||
| 55 | - if(!empty($v['source'])){ | ||
| 56 | - $v['source'] = json_decode($v['source']); | ||
| 57 | - } | ||
| 58 | - if(!empty($v['country'])){ | ||
| 59 | - $v['country'] = json_decode($v['country']); | ||
| 60 | - } | ||
| 61 | - //获取上去的流量统计 | ||
| 62 | - // 获取上个月的开始时间 | ||
| 63 | - $startTime = Carbon::now()->subMonth()->startOfMonth()->toDateString(); | ||
| 64 | - // 获取上个月的结束时间 | ||
| 65 | - $endTime = Carbon::now()->subMonth()->endOfMonth()->toDateString(); | ||
| 66 | - $param = [ | ||
| 67 | - 'date' => ['between',[$startTime,$endTime]], | ||
| 68 | - 'project_id' => $this->user['project_id'] | ||
| 69 | - ]; | ||
| 70 | - $v['pv_ip'] = (new Count())->list($param,'date',['id','pv_num','ip_num','date']); | ||
| 71 | - $info[$k] = $v; | 45 | + if(!empty($info['source_country'])){ |
| 46 | + $info['source_country'] = json_decode($info['source_country']); | ||
| 72 | } | 47 | } |
| 48 | + if(!empty($info['referrer_port'])){ | ||
| 49 | + $info['referrer_port'] = json_decode($info['referrer_port']); | ||
| 50 | + } | ||
| 51 | + if(!empty($info['referrer_url'])){ | ||
| 52 | + $info['referrer_url'] = json_decode($info['referrer_url']); | ||
| 53 | + } | ||
| 54 | + if(!empty($info['source'])){ | ||
| 55 | + $info['source'] = json_decode($info['source']); | ||
| 56 | + } | ||
| 57 | + if(!empty($info['country'])){ | ||
| 58 | + $info['country'] = json_decode($info['country']); | ||
| 59 | + } | ||
| 60 | + // 获取上个月的开始时间 | ||
| 61 | + $startTime = Carbon::now()->subMonth()->startOfMonth()->toDateString(); | ||
| 62 | + // 获取上个月的结束时间 | ||
| 63 | + $endTime = Carbon::now()->subMonth()->endOfMonth()->toDateString(); | ||
| 64 | + $param = [ | ||
| 65 | + 'date' => ['between',[$startTime,$endTime]], | ||
| 66 | + 'project_id' => $this->user['project_id'] | ||
| 67 | + ]; | ||
| 68 | + $info['pv_ip'] = (new Count())->list($param,'date',['id','pv_num','ip_num','date']); | ||
| 73 | $this->response('success',Code::SUCCESS,$info); | 69 | $this->response('success',Code::SUCCESS,$info); |
| 74 | } | 70 | } |
| 75 | } | 71 | } |
-
请 注册 或 登录 后发表评论