Test Failed
Pull Request — master (#1970)
by
unknown
03:17
created

Client   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Importance

Changes 4
Bugs 0 Features 4
Metric Value
eloc 15
c 4
b 0
f 4
dl 0
loc 62
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getUserLivingId() 0 11 1
A getWatchStat() 0 8 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 = '0', int $limit = 100)
34
    {
35
        $params = [
36
            'userid' => $userId,
37
            'begin_time' => $beginTime,
38
            'end_time' => $endTime,
39
            'next_key' => $nextKey,
40
			'limit' => $limit
41
        ];
42
43
        return $this->httpPostJson('cgi-bin/living/get_user_livingid', $params);
44
    }
45
46
    /**
47
     * 获取直播详情
48
     *
49
     * @see https://work.weixin.qq.com/api/doc/90000/90135/92734
50
     *
51
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
52
     *
53
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
54
     * @throws \GuzzleHttp\Exception\GuzzleException
55
     */
56
    public function getLiving(string $livingId)
57
    {
58
        $params = [
59
            'livingid' => $livingId,
60
        ];
61
62
        return $this->httpPostJson('cgi-bin/living/get_living_info', $params);
63
    }
64
65
    /**
66
     * 获取看直播统计
67
     *
68
     * @see https://work.weixin.qq.com/api/doc/90000/90135/92736
69
     *
70
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
71
     *
72
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
73
     * @throws \GuzzleHttp\Exception\GuzzleException
74
     */
75
    public function getWatchStat(string $livingId, string $nextKey = '0')
76
    {
77
        $params = [
78
            'livingid' => $livingId,
79
            'next_key' => $nextKey,
80
        ];
81
82
        return $this->httpPostJson('cgi-bin/living/get_watch_stat', $params);
83
    }
84
}
85