Test Failed
Pull Request — master (#1712)
by
unknown
03:06
created

Client::approvalDetail()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 7
ccs 0
cts 0
cp 0
crap 2
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 string $day
52
     * @param array  $userList
53
     *
54
     * @return mixed
55
     *
56
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
57
     * @throws \GuzzleHttp\Exception\GuzzleException
58
     */
59
    public function checkinRules(string $day,array $userList)
60 1
    {
61
        $params = [
62
            'datetime' => strtotime($day),
63 1
            'useridlist' => $userList,
64 1
        ];
65 1
66
        return $this->httpPostJson('cgi-bin/checkin/getcheckinoption', $params);
67
    }
68 1
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
    public function approvalNumbers(int $startTime, int $endTime, int $nextCursor = 0, int $size = 100, array $filters = [])
84
    {
85
        $params = [
86
            'starttime' => $startTime,
87
            'endtime' => $endTime,
88
            'cursor' => $nextCursor,
89
            'size' => $size > 100 ? 100 : $size,
90
            'filters' => $filters,
91
        ];
92
93
        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
    public function approvalDetail(int $number)
107
    {
108
        $params = [
109
            'sp_no' => $number,
110
        ];
111
112
        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
    public function approvalRecords(int $startTime, int $endTime, int $nextNumber = null)
128
    {
129
        $params = [
130
            'starttime' => $startTime,
131
            'endtime' => $endTime,
132
            'next_spnum' => $nextNumber,
133
        ];
134
135
        return $this->httpPostJson('cgi-bin/corp/getapprovaldata', $params);
136
    }
137
}
138