StatisticsController.php
2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?php
namespace App\Http\Controllers\Bside;
use App\Http\Logic\Bside\Statistics\StatisticsLogic;
use App\Models\Bside\Statistics\TrafficStatistics;
use Illuminate\Http\JsonResponse;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
/**
* 流量统计
* Class StatisticsController
* @package App\Http\Controllers\Bside
*/
class StatisticsController extends BaseController
{
public $statisticsLogic;
public $trafficStatistics;
public function __construct()
{
$this->statisticsLogic = new StatisticsLogic();
$this->trafficStatistics = new TrafficStatistics();
}
/**
* 访问来源
* @return JsonResponse
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function source()
{
$type = $this->trafficStatistics::TYPE_SOURCE;
$response = $this->statisticsLogic->getStatisticsData($type);
return $this->success($response);
}
/**
* 地域分布
* @return JsonResponse
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function distribution()
{
$type = $this->trafficStatistics::TYPE_DISTRIBUTION;
$response = $this->statisticsLogic->getStatisticsData($type);
return $this->success($response);
}
/**
* 受访页面
* @return JsonResponse
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function page()
{
$type = $this->trafficStatistics::TYPE_PAGE;
$response = $this->statisticsLogic->getStatisticsData($type);
return $this->success($response);
}
/**
* 访问终端
* @return JsonResponse
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function terminal()
{
$type = $this->trafficStatistics::TYPE_TERMINAL;
$response = $this->statisticsLogic->getStatisticsData($type);
return $this->success($response);
}
/**
* 流量趋势
* @return JsonResponse
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function trend()
{
$type = $this->trafficStatistics::TYPE_TREND;
$response = $this->statisticsLogic->getStatisticsData($type);
return $this->success($response);
}
}