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
|
|
|
|