Test Failed
Pull Request — master (#1564)
by milkmeowo
04:45
created

DimissionClient   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 38
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getUnassignedList() 0 5 1
A transfer() 0 9 1
1
<?php
2
3
4
namespace EasyWeChat\Work\Crm;
5
6
7
use EasyWeChat\Kernel\BaseClient;
8
9
/**
10
 * Class DimissionClient.
11
 *
12
 * @author milkmeowo <[email protected]>
13
 */
14
class DimissionClient extends BaseClient
15
{
16
    /**
17
     * 获取离职成员的客户列表
18
     * @link https://work.weixin.qq.com/api/doc#90000/90135/91563
19
     *
20
     * @param int $pageId
21
     * @param int $pageSize
22
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
23
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
24
     */
25
    public function getUnassignedList(int $pageId = 0, int $pageSize = 1000)
26
    {
27
        return $this->httpPostJson('cgi-bin/externalcontact/get_unassigned_list', [
28
            'page_id' => $pageId,
29
            'page_size' => $pageSize
30
        ]);
31
    }
32
33
    /**
34
     * 离职成员的外部联系人再分配
35
     * @link https://work.weixin.qq.com/api/doc#90000/90135/91564
36
     *
37
     * @param string $externalUserId
38
     * @param string $handoverUserId
39
     * @param string $takeoverUserId
40
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
41
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
42
     */
43
    public function transfer(string $externalUserId, string $handoverUserId, string $takeoverUserId)
44
    {
45
        $params = [
46
            'external_userid' => $externalUserId,
47
            'handover_userid' => $handoverUserId,
48
            'takeover_userid' => $takeoverUserId
49
        ];
50
51
        return $this->httpPostJson('cgi-bin/externalcontact/transfer', $params);
52
    }
53
54
55
}