作者 lyh

gx

@@ -42,23 +42,21 @@ class MonthReportController extends BaseController @@ -42,23 +42,21 @@ 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']); 45 + if(!empty($info['source_country'])){
  46 + $info['source_country'] = json_decode($info['source_country']);
48 } 47 }
49 - if(!empty($v['referrer_port'])){  
50 - $v['referrer_port'] = json_decode($v['referrer_port']); 48 + if(!empty($info['referrer_port'])){
  49 + $info['referrer_port'] = json_decode($info['referrer_port']);
51 } 50 }
52 - if(!empty($v['referrer_url'])){  
53 - $v['referrer_url'] = json_decode($v['referrer_url']); 51 + if(!empty($info['referrer_url'])){
  52 + $info['referrer_url'] = json_decode($info['referrer_url']);
54 } 53 }
55 - if(!empty($v['source'])){  
56 - $v['source'] = json_decode($v['source']); 54 + if(!empty($info['source'])){
  55 + $info['source'] = json_decode($info['source']);
57 } 56 }
58 - if(!empty($v['country'])){  
59 - $v['country'] = json_decode($v['country']); 57 + if(!empty($info['country'])){
  58 + $info['country'] = json_decode($info['country']);
60 } 59 }
61 - //获取上去的流量统计  
62 // 获取上个月的开始时间 60 // 获取上个月的开始时间
63 $startTime = Carbon::now()->subMonth()->startOfMonth()->toDateString(); 61 $startTime = Carbon::now()->subMonth()->startOfMonth()->toDateString();
64 // 获取上个月的结束时间 62 // 获取上个月的结束时间
@@ -67,9 +65,7 @@ class MonthReportController extends BaseController @@ -67,9 +65,7 @@ class MonthReportController extends BaseController
67 'date' => ['between',[$startTime,$endTime]], 65 'date' => ['between',[$startTime,$endTime]],
68 'project_id' => $this->user['project_id'] 66 'project_id' => $this->user['project_id']
69 ]; 67 ];
70 - $v['pv_ip'] = (new Count())->list($param,'date',['id','pv_num','ip_num','date']);  
71 - $info[$k] = $v;  
72 - } 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 }