|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the overtrue/wechat. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) overtrue <[email protected]> |
|
7
|
|
|
* |
|
8
|
|
|
* This source file is subject to the MIT license that is bundled |
|
9
|
|
|
* with this source code in the file LICENSE. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace EasyWeChat\MiniProgram\DataCube; |
|
13
|
|
|
|
|
14
|
|
|
use EasyWeChat\Kernel\BaseClient; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* Class Client. |
|
18
|
|
|
* |
|
19
|
|
|
* @author mingyoung <[email protected]> |
|
20
|
|
|
*/ |
|
21
|
|
|
class Client extends BaseClient |
|
22
|
|
|
{ |
|
23
|
|
|
/** |
|
24
|
|
|
* Get summary trend. |
|
25
|
|
|
* |
|
26
|
|
|
* @param string $from |
|
27
|
|
|
* @param string $to |
|
28
|
|
|
* |
|
29
|
|
|
* @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string |
|
30
|
|
|
*/ |
|
31
|
1 |
|
public function summaryTrend(string $from, string $to) |
|
32
|
|
|
{ |
|
33
|
1 |
|
return $this->query('datacube/getweanalysisappiddailysummarytrend', $from, $to); |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* Get daily visit trend. |
|
38
|
|
|
* |
|
39
|
|
|
* @param string $from |
|
40
|
|
|
* @param string $to |
|
41
|
|
|
* |
|
42
|
|
|
* @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string |
|
43
|
|
|
*/ |
|
44
|
1 |
|
public function dailyVisitTrend(string $from, string $to) |
|
45
|
|
|
{ |
|
46
|
1 |
|
return $this->query('datacube/getweanalysisappiddailyvisittrend', $from, $to); |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* Get weekly visit trend. |
|
51
|
|
|
* |
|
52
|
|
|
* @param string $from |
|
53
|
|
|
* @param string $to |
|
54
|
|
|
* |
|
55
|
|
|
* @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string |
|
56
|
|
|
*/ |
|
57
|
1 |
|
public function weeklyVisitTrend(string $from, string $to) |
|
58
|
|
|
{ |
|
59
|
1 |
|
return $this->query('datacube/getweanalysisappidweeklyvisittrend', $from, $to); |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* Get monthly visit trend. |
|
64
|
|
|
* |
|
65
|
|
|
* @param string $from |
|
66
|
|
|
* @param string $to |
|
67
|
|
|
* |
|
68
|
|
|
* @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string |
|
69
|
|
|
*/ |
|
70
|
1 |
|
public function monthlyVisitTrend(string $from, string $to) |
|
71
|
|
|
{ |
|
72
|
1 |
|
return $this->query('datacube/getweanalysisappidmonthlyvisittrend', $from, $to); |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
/** |
|
76
|
|
|
* Get visit distribution. |
|
77
|
|
|
* |
|
78
|
|
|
* @param string $from |
|
79
|
|
|
* @param string $to |
|
80
|
|
|
* |
|
81
|
|
|
* @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string |
|
82
|
|
|
*/ |
|
83
|
1 |
|
public function visitDistribution(string $from, string $to) |
|
84
|
|
|
{ |
|
85
|
1 |
|
return $this->query('datacube/getweanalysisappidvisitdistribution', $from, $to); |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
/** |
|
89
|
|
|
* Get daily retain info. |
|
90
|
|
|
* |
|
91
|
|
|
* @param string $from |
|
92
|
|
|
* @param string $to |
|
93
|
|
|
* |
|
94
|
|
|
* @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string |
|
95
|
|
|
*/ |
|
96
|
1 |
|
public function dailyRetainInfo(string $from, string $to) |
|
97
|
|
|
{ |
|
98
|
1 |
|
return $this->query('datacube/getweanalysisappiddailyretaininfo', $from, $to); |
|
99
|
|
|
} |
|
100
|
|
|
|
|
101
|
|
|
/** |
|
102
|
|
|
* Get weekly retain info. |
|
103
|
|
|
* |
|
104
|
|
|
* @param string $from |
|
105
|
|
|
* @param string $to |
|
106
|
|
|
* |
|
107
|
|
|
* @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string |
|
108
|
|
|
*/ |
|
109
|
1 |
|
public function weeklyRetainInfo(string $from, string $to) |
|
110
|
|
|
{ |
|
111
|
1 |
|
return $this->query('datacube/getweanalysisappidweeklyretaininfo', $from, $to); |
|
112
|
|
|
} |
|
113
|
|
|
|
|
114
|
|
|
/** |
|
115
|
|
|
* Get monthly retain info. |
|
116
|
|
|
* |
|
117
|
|
|
* @param string $from |
|
118
|
|
|
* @param string $to |
|
119
|
|
|
* |
|
120
|
|
|
* @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string |
|
121
|
|
|
*/ |
|
122
|
1 |
|
public function monthlyRetainInfo(string $from, string $to) |
|
123
|
|
|
{ |
|
124
|
1 |
|
return $this->query('datacube/getweanalysisappidmonthlyretaininfo', $from, $to); |
|
125
|
|
|
} |
|
126
|
|
|
|
|
127
|
|
|
/** |
|
128
|
|
|
* Get visit page. |
|
129
|
|
|
* |
|
130
|
|
|
* @param string $from |
|
131
|
|
|
* @param string $to |
|
132
|
|
|
* |
|
133
|
|
|
* @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string |
|
134
|
|
|
*/ |
|
135
|
1 |
|
public function visitPage(string $from, string $to) |
|
136
|
|
|
{ |
|
137
|
1 |
|
return $this->query('datacube/getweanalysisappidvisitpage', $from, $to); |
|
138
|
|
|
} |
|
139
|
|
|
|
|
140
|
|
|
/** |
|
141
|
|
|
* Get user portrait. |
|
142
|
|
|
* |
|
143
|
|
|
* @param string $from |
|
144
|
|
|
* @param string $to |
|
145
|
|
|
* |
|
146
|
|
|
* @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string |
|
147
|
|
|
*/ |
|
148
|
1 |
|
public function userPortrait(string $from, string $to) |
|
149
|
|
|
{ |
|
150
|
1 |
|
return $this->query('datacube/getweanalysisappiduserportrait', $from, $to); |
|
151
|
|
|
} |
|
152
|
|
|
|
|
153
|
|
|
/** |
|
154
|
|
|
* Unify query. |
|
155
|
|
|
* |
|
156
|
|
|
* @param string $api |
|
157
|
|
|
* @param string $from |
|
158
|
|
|
* @param string $to |
|
159
|
|
|
* |
|
160
|
|
|
* @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string |
|
161
|
|
|
* |
|
162
|
|
|
* @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException |
|
163
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
|
164
|
|
|
*/ |
|
165
|
1 |
|
protected function query(string $api, string $from, string $to) |
|
166
|
|
|
{ |
|
167
|
|
|
$params = [ |
|
168
|
1 |
|
'begin_date' => $from, |
|
169
|
1 |
|
'end_date' => $to, |
|
170
|
|
|
]; |
|
171
|
|
|
|
|
172
|
1 |
|
return $this->httpPostJson($api, $params); |
|
173
|
|
|
} |
|
174
|
|
|
} |
|
175
|
|
|
|