Client::realtime()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Freyo\MtaH5\Trend;
4
5
use Freyo\MtaH5\Kernel\BaseClient;
6
7
class Client extends BaseClient
8
{
9
    /**
10
     * 应用每天的pv\uv\vv\iv数据.
11
     *
12
     * @see https://mta.qq.com/docs/h5_api.html#%E5%BA%94%E7%94%A8%E5%8E%86%E5%8F%B2%E8%B6%8B%E5%8A%BF
13
     *
14
     * @param string $startDate 开始时间(Y-m-d)
15
     * @param string $endDate   结束时间(Y-m-d)
16
     *
17
     * @throws \Freyo\MtaH5\Kernel\Exceptions\InvalidConfigException
18
     *
19
     * @return array|\Freyo\MtaH5\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
20
     */
21
    public function query($startDate, $endDate)
22
    {
23
        $params = [
24
            'start_date' => $startDate,
25
            'end_date'   => $endDate,
26
            'idx'        => 'pv,uv,vv,iv',
27
        ];
28
29
        return $this->httpGet('ctr_core_data', $params);
30
    }
31
32
    /**
33
     * 应用当天每小时的pv\uv\vv\iv数据.
34
     *
35
     * @see https://mta.qq.com/docs/h5_api.html#%E5%BA%94%E7%94%A8%E5%AE%9E%E6%97%B6%E5%B0%8F%E6%97%B6%E6%95%B0%E6%8D%AE
36
     *
37
     * @throws \Freyo\MtaH5\Kernel\Exceptions\InvalidConfigException
38
     *
39
     * @return array|\Freyo\MtaH5\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
40
     */
41
    public function realtime()
42
    {
43
        $params = [
44
            'idx' => 'pv,uv,vv,iv',
45
        ];
46
47
        return $this->httpGet('ctr_realtime/get_by_hour', $params);
48
    }
49
50
    /**
51
     * 应用当前pv\uv\vv\iv心跳数据数据.
52
     *
53
     * @see https://mta.qq.com/docs/h5_api.html#%E5%BA%94%E7%94%A8%E5%BF%83%E8%B7%B3%E6%95%B0%E6%8D%AE
54
     *
55
     * @throws \Freyo\MtaH5\Kernel\Exceptions\InvalidConfigException
56
     *
57
     * @return array|\Freyo\MtaH5\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
58
     */
59
    public function heartbeat()
60
    {
61
        return $this->httpGet('ctr_realtime/heartbeat');
62
    }
63
}
64