Client::get()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
/*
4
 * This file is part of the mingyoung/dingtalk.
5
 *
6
 * (c) 张铭阳 <[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 EasyDingTalk\Process;
13
14
use EasyDingTalk\Kernel\BaseClient;
15
16
class Client extends BaseClient
17
{
18
    /**
19
     * 发起审批实例
20
     *
21
     * @param array $params
22
     *
23
     * @return mixed
24
     */
25
    public function create($params)
26
    {
27
        return $this->client->postJson('topapi/processinstance/create', $params);
28
    }
29
30
    /**
31
     * 批量获取审批实例 ID
32
     *
33
     * @param array $params
34
     *
35
     * @return mixed
36
     */
37
    public function getIds($params)
38
    {
39
        return $this->client->postJson('topapi/processinstance/listids', $params);
40
    }
41
42
    /**
43
     * 获取单个审批实例
44
     *
45
     * @param string $id
46
     *
47
     * @return mixed
48
     */
49
    public function get($id)
50
    {
51
        return $this->client->postJson('topapi/processinstance/get', ['process_instance_id' => $id]);
52
    }
53
54
    /**
55
     * 获取用户待审批数量
56
     *
57
     * @param string $userId
58
     *
59
     * @return mixed
60
     */
61
    public function count($userId)
62
    {
63
        return $this->client->postJson('topapi/process/gettodonum', ['userid' => $userId]);
64
    }
65
66
    /**
67
     * 获取用户可见的审批模板
68
     *
69
     * @param string|null $userId
70
     * @param int         $offset
71
     * @param int         $size
72
     *
73
     * @return mixed
74
     */
75
    public function listByUserId($userId = null, $offset = 0, $size = 100)
76
    {
77
        return $this->client->postJson('topapi/process/listbyuserid', ['userid' => $userId, 'offset' => $offset, 'size' => $size]);
78
    }
79
}
80