|
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\ExternalContact; |
|
13
|
|
|
|
|
14
|
|
|
use EasyWeChat\Kernel\BaseClient; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* Class Client. |
|
18
|
|
|
* |
|
19
|
|
|
* @author mingyoung <[email protected]> |
|
20
|
|
|
*/ |
|
21
|
|
|
class Client extends BaseClient |
|
22
|
|
|
{ |
|
23
|
|
|
/** |
|
24
|
|
|
* 获取配置了客户联系功能的成员列表. |
|
25
|
|
|
* |
|
26
|
|
|
* @see https://work.weixin.qq.com/api/doc#90000/90135/91554 |
|
27
|
|
|
* |
|
28
|
|
|
* @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string |
|
29
|
|
|
* |
|
30
|
|
|
* @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException |
|
31
|
|
|
*/ |
|
32
|
1 |
|
public function getFollowUsers() |
|
33
|
|
|
{ |
|
34
|
1 |
|
return $this->httpGet('cgi-bin/externalcontact/get_follow_user_list'); |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* 获取外部联系人列表. |
|
39
|
|
|
* |
|
40
|
|
|
* @see https://work.weixin.qq.com/api/doc#90000/90135/91555 |
|
41
|
|
|
* |
|
42
|
|
|
* @param $userId |
|
43
|
|
|
* |
|
44
|
|
|
* @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string |
|
45
|
|
|
* |
|
46
|
|
|
* @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException |
|
47
|
|
|
*/ |
|
48
|
1 |
|
public function list(string $userId) |
|
49
|
|
|
{ |
|
50
|
1 |
|
return $this->httpGet('cgi-bin/externalcontact/list', [ |
|
51
|
1 |
|
'userid' => $userId, |
|
52
|
|
|
]); |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* 获取外部联系人详情. |
|
57
|
|
|
* |
|
58
|
|
|
* @see https://work.weixin.qq.com/api/doc#90000/90135/91556 |
|
59
|
|
|
* |
|
60
|
|
|
* @param $externalUserId |
|
61
|
|
|
* |
|
62
|
|
|
* @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string |
|
63
|
|
|
* |
|
64
|
|
|
* @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException |
|
65
|
|
|
*/ |
|
66
|
1 |
|
public function get(string $externalUserId) |
|
67
|
|
|
{ |
|
68
|
1 |
|
return $this->httpGet('cgi-bin/externalcontact/get', [ |
|
69
|
1 |
|
'external_userid' => $externalUserId, |
|
70
|
|
|
]); |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
/** |
|
74
|
|
|
* 获取离职成员的客户列表. |
|
75
|
|
|
* |
|
76
|
|
|
* @see https://work.weixin.qq.com/api/doc#90000/90135/91563 |
|
77
|
|
|
* |
|
78
|
|
|
* @param int $pageId |
|
79
|
|
|
* @param int $pageSize |
|
80
|
|
|
* |
|
81
|
|
|
* @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string |
|
82
|
|
|
* |
|
83
|
|
|
* @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException |
|
84
|
|
|
*/ |
|
85
|
1 |
|
public function getUnassigned(int $pageId = 0, int $pageSize = 1000) |
|
86
|
|
|
{ |
|
87
|
1 |
|
return $this->httpPostJson('cgi-bin/externalcontact/get_unassigned_list', [ |
|
88
|
1 |
|
'page_id' => $pageId, |
|
89
|
1 |
|
'page_size' => $pageSize, |
|
90
|
|
|
]); |
|
91
|
|
|
} |
|
92
|
|
|
|
|
93
|
|
|
/** |
|
94
|
|
|
* 离职成员的外部联系人再分配. |
|
95
|
|
|
* |
|
96
|
|
|
* @see https://work.weixin.qq.com/api/doc#90000/90135/91564 |
|
97
|
|
|
* |
|
98
|
|
|
* @param string $externalUserId |
|
99
|
|
|
* @param string $handoverUserId |
|
100
|
|
|
* @param string $takeoverUserId |
|
101
|
|
|
* |
|
102
|
|
|
* @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string |
|
103
|
|
|
* |
|
104
|
|
|
* @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException |
|
105
|
|
|
*/ |
|
106
|
1 |
|
public function transfer(string $externalUserId, string $handoverUserId, string $takeoverUserId) |
|
107
|
|
|
{ |
|
108
|
|
|
$params = [ |
|
109
|
1 |
|
'external_userid' => $externalUserId, |
|
110
|
1 |
|
'handover_userid' => $handoverUserId, |
|
111
|
1 |
|
'takeover_userid' => $takeoverUserId, |
|
112
|
|
|
]; |
|
113
|
|
|
|
|
114
|
1 |
|
return $this->httpPostJson('cgi-bin/externalcontact/transfer', $params); |
|
115
|
|
|
} |
|
116
|
|
|
} |
|
117
|
|
|
|