Passed
Push — master ( 8bf420...770c52 )
by Carlos
03:12
created

Client::approvalDetail()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 7
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
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\OA;
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
     * Get the checkin data.
25
     *
26
     * @param int   $startTime
27
     * @param int   $endTime
28
     * @param array $userList
29
     * @param int   $type
30
     *
31
     * @return mixed
32
     *
33
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
34
     * @throws \GuzzleHttp\Exception\GuzzleException
35
     */
36 1
    public function checkinRecords(int $startTime, int $endTime, array $userList, int $type = 3)
37
    {
38
        $params = [
39 1
            'opencheckindatatype' => $type,
40 1
            'starttime' => $startTime,
41 1
            'endtime' => $endTime,
42 1
            'useridlist' => $userList,
43
        ];
44
45 1
        return $this->httpPostJson('cgi-bin/checkin/getcheckindata', $params);
46
    }
47
48
    /**
49
     * Get the checkin rules.
50
     *
51
     * @param int   $datetime
52
     * @param array $userList
53
     *
54
     * @return mixed
55
     *
56
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
57
     * @throws \GuzzleHttp\Exception\GuzzleException
58
     */
59 1
    public function checkinRules(int $datetime, array $userList)
60
    {
61
        $params = [
62 1
            'datetime' => $datetime,
63 1
            'useridlist' => $userList,
64
        ];
65
66 1
        return $this->httpPostJson('cgi-bin/checkin/getcheckinoption', $params);
67
    }
68
69
    /**
70
     * Get Approval number.
71
     *
72
     * @param int   $startTime
73
     * @param int   $endTime
74
     * @param int   $nextCursor
75
     * @param int   $size
76
     * @param array $filters
77
     *
78
     * @return mixed
79
     *
80
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
81
     * @throws \GuzzleHttp\Exception\GuzzleException
82
     */
83 1
    public function approvalNumbers(int $startTime, int $endTime, int $nextCursor = 0, int $size = 100, array $filters = [])
84
    {
85
        $params = [
86 1
            'starttime' => $startTime,
87 1
            'endtime' => $endTime,
88 1
            'cursor' => $nextCursor,
89 1
            'size' => $size > 100 ? 100 : $size,
90 1
            'filters' => $filters,
91
        ];
92
93 1
        return $this->httpPostJson('cgi-bin/oa/getapprovalinfo', $params);
94
    }
95
96
    /**
97
     * Get approval detail.
98
     *
99
     * @param int $number
100
     *
101
     * @return mixed
102
     *
103
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
104
     * @throws \GuzzleHttp\Exception\GuzzleException
105
     */
106 1
    public function approvalDetail(int $number)
107
    {
108
        $params = [
109 1
            'sp_no' => $number,
110
        ];
111
112 1
        return $this->httpPostJson('cgi-bin/oa/getapprovaldetail', $params);
113
    }
114
115
    /**
116
     * Get Approval Data.
117
     *
118
     * @param int $startTime
119
     * @param int $endTime
120
     * @param int $nextNumber
121
     *
122
     * @return mixed
123
     *
124
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
125
     * @throws \GuzzleHttp\Exception\GuzzleException
126
     */
127 1
    public function approvalRecords(int $startTime, int $endTime, int $nextNumber = null)
128
    {
129
        $params = [
130 1
            'starttime' => $startTime,
131 1
            'endtime' => $endTime,
132 1
            'next_spnum' => $nextNumber,
133
        ];
134
135 1
        return $this->httpPostJson('cgi-bin/corp/getapprovaldata', $params);
136
    }
137
}
138