Passed
Pull Request — master (#1970)
by
unknown
02:49
created

Client   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 4
Bugs 0 Features 4
Metric Value
eloc 14
c 4
b 0
f 4
dl 0
loc 61
ccs 0
cts 9
cp 0
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getWatchStat() 0 8 1
A getUserLivingId() 0 10 1
A getLiving() 0 7 1
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\Work\Live;
13
14
use EasyWeChat\Kernel\BaseClient;
15
16
/**
17
 * Class Client.
18
 *
19
 * @author arthasking <[email protected]>
20
 */
21
class Client extends BaseClient
22
{
23
    /**
24
     * 获取成员直播ID列表
25
     *
26
     * @see https://work.weixin.qq.com/api/doc/90000/90135/92735
27
     *
28
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
29
     *
30
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
31
     * @throws \GuzzleHttp\Exception\GuzzleException
32
     */
33
    public function getUserLivingId(string $userId, int $beginTime, int $endTime, string $nextKey)
34
    {
35
        $params = [
36
            'userid' => $userId,
37
            'begin_time' => $beginTime,
38
            'end_time' => $endTime,
39
            'next_key' => $nextKey,
40
        ];
41
42
        return $this->httpPostJson('cgi-bin/living/get_user_livingid', $params);
43
    }
44
45
    /**
46
     * 获取直播详情
47
     *
48
     * @see https://work.weixin.qq.com/api/doc/90000/90135/92734
49
     *
50
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
51
     *
52
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
53
     * @throws \GuzzleHttp\Exception\GuzzleException
54
     */
55
    public function getLiving(string $livingId)
56
    {
57
        $params = [
58
            'livingid' => $livingId,
59
        ];
60
61
        return $this->httpPostJson('cgi-bin/living/get_living_info', $params);
62
    }
63
64
    /**
65
     * 获取看直播统计
66
     *
67
     * @see https://work.weixin.qq.com/api/doc/90000/90135/92736
68
     *
69
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
70
     *
71
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
72
     * @throws \GuzzleHttp\Exception\GuzzleException
73
     */
74
    public function getWatchStat(string $livingId, string $nextKey)
75
    {
76
        $params = [
77
            'livingid' => $livingId,
78
            'next_key' => $nextKey,
79
        ];
80
81
        return $this->httpPostJson('cgi-bin/living/get_watch_stat', $params);
82
    }
83
}
84