Passed
Push — master ( 2c9fcc...4a9705 )
by Carlos
04:25 queued 01:21
created

Client::getUserLivingId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 7
c 1
b 0
f 0
nc 1
nop 5
dl 0
loc 11
rs 10
ccs 7
cts 7
cp 1
crap 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 1
    public function getUserLivingId(string $userId, int $beginTime, int $endTime, string $nextKey = '0', int $limit = 100)
34
    {
35
        $params = [
36 1
            'userid' => $userId,
37 1
            'begin_time' => $beginTime,
38 1
            'end_time' => $endTime,
39 1
            'next_key' => $nextKey,
40 1
            'limit' => $limit
41
        ];
42
43 1
        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 1
    public function getLiving(string $livingId)
57
    {
58
        $params = [
59 1
            'livingid' => $livingId,
60
        ];
61
62 1
        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 1
    public function getWatchStat(string $livingId, string $nextKey = '0')
76
    {
77
        $params = [
78 1
            'livingid' => $livingId,
79 1
            'next_key' => $nextKey,
80
        ];
81
82 1
        return $this->httpPostJson('cgi-bin/living/get_watch_stat', $params);
83
    }
84
}
85