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 template details. |
71
|
|
|
* |
72
|
|
|
* @param string $templateId |
73
|
|
|
* |
74
|
|
|
* @return mixed |
75
|
|
|
* |
76
|
|
|
* @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException |
77
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
78
|
|
|
*/ |
79
|
1 |
|
public function approvalTemplate(string $templateId) |
80
|
|
|
{ |
81
|
|
|
$params = [ |
82
|
1 |
|
'template_id' => $templateId, |
83
|
|
|
]; |
84
|
|
|
|
85
|
1 |
|
return $this->httpPostJson('cgi-bin/oa/gettemplatedetail', $params); |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* Submit an application for approval. |
90
|
|
|
* |
91
|
|
|
* @param array $data |
92
|
|
|
* |
93
|
|
|
* @return mixed |
94
|
|
|
* |
95
|
|
|
* @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException |
96
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
97
|
|
|
*/ |
98
|
1 |
|
public function createApproval(array $data) |
99
|
|
|
{ |
100
|
1 |
|
return $this->httpPostJson('cgi-bin/oa/applyevent', $data); |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* Get Approval number. |
105
|
|
|
* |
106
|
|
|
* @param int $startTime |
107
|
|
|
* @param int $endTime |
108
|
|
|
* @param int $nextCursor |
109
|
|
|
* @param int $size |
110
|
|
|
* @param array $filters |
111
|
|
|
* |
112
|
|
|
* @return mixed |
113
|
|
|
* |
114
|
|
|
* @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException |
115
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
116
|
|
|
*/ |
117
|
1 |
|
public function approvalNumbers(int $startTime, int $endTime, int $nextCursor = 0, int $size = 100, array $filters = []) |
118
|
|
|
{ |
119
|
|
|
$params = [ |
120
|
1 |
|
'starttime' => $startTime, |
121
|
1 |
|
'endtime' => $endTime, |
122
|
1 |
|
'cursor' => $nextCursor, |
123
|
1 |
|
'size' => $size > 100 ? 100 : $size, |
124
|
1 |
|
'filters' => $filters, |
125
|
|
|
]; |
126
|
|
|
|
127
|
1 |
|
return $this->httpPostJson('cgi-bin/oa/getapprovalinfo', $params); |
128
|
|
|
} |
129
|
|
|
|
130
|
|
|
/** |
131
|
|
|
* Get approval detail. |
132
|
|
|
* |
133
|
|
|
* @param int $number |
134
|
|
|
* |
135
|
|
|
* @return mixed |
136
|
|
|
* |
137
|
|
|
* @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException |
138
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
139
|
|
|
*/ |
140
|
1 |
|
public function approvalDetail(int $number) |
141
|
|
|
{ |
142
|
|
|
$params = [ |
143
|
1 |
|
'sp_no' => $number, |
144
|
|
|
]; |
145
|
|
|
|
146
|
1 |
|
return $this->httpPostJson('cgi-bin/oa/getapprovaldetail', $params); |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
/** |
150
|
|
|
* Get Approval Data. |
151
|
|
|
* |
152
|
|
|
* @param int $startTime |
153
|
|
|
* @param int $endTime |
154
|
|
|
* @param int $nextNumber |
155
|
|
|
* |
156
|
|
|
* @return mixed |
157
|
|
|
* |
158
|
|
|
* @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException |
159
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
160
|
|
|
*/ |
161
|
1 |
|
public function approvalRecords(int $startTime, int $endTime, int $nextNumber = null) |
162
|
|
|
{ |
163
|
|
|
$params = [ |
164
|
1 |
|
'starttime' => $startTime, |
165
|
1 |
|
'endtime' => $endTime, |
166
|
1 |
|
'next_spnum' => $nextNumber, |
167
|
|
|
]; |
168
|
|
|
|
169
|
1 |
|
return $this->httpPostJson('cgi-bin/corp/getapprovaldata', $params); |
170
|
|
|
} |
171
|
|
|
|
172
|
|
|
|
173
|
|
|
/** |
174
|
|
|
* 获取公费电话拨打记录. |
175
|
|
|
* |
176
|
|
|
* @param int $startTime |
177
|
|
|
* @param int $endTime |
178
|
|
|
* @param int $offset |
179
|
|
|
* @param int $limit |
180
|
|
|
* |
181
|
|
|
* @return mixed |
182
|
|
|
* |
183
|
|
|
* @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException |
184
|
|
|
* @throws \GuzzleHttp\Exception\GuzzleException |
185
|
|
|
*/ |
186
|
|
|
public function dialRecords(int $startTime, int $endTime, int $offset = 0, $limit = 100) |
187
|
|
|
{ |
188
|
|
|
$params = [ |
189
|
|
|
'start_time' => $startTime, |
190
|
|
|
'end_time' => $endTime, |
191
|
|
|
'offset' => $offset, |
192
|
|
|
'limit' => $limit |
193
|
|
|
]; |
194
|
|
|
|
195
|
|
|
return $this->httpPostJson('cgi-bin/dial/get_dial_record', $params); |
196
|
|
|
} |
197
|
|
|
} |
198
|
|
|
|