Completed
Push — master ( 017947...8f5b55 )
by frey
13s
created

API   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 47
rs 10
wmc 2
lcom 0
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getCheckinData() 0 11 1
A getApprovalData() 0 10 1
1
<?php
2
3
namespace EntWeChat\OA;
4
5
use EntWeChat\Core\AbstractAPI;
6
7
class API extends AbstractAPI
8
{
9
    const API_CHECKIN_DATA = 'https://qyapi.weixin.qq.com/cgi-bin/checkin/getcheckindata';
10
    const API_APPROVAL_DATA = 'https://qyapi.weixin.qq.com/cgi-bin/corp/getapprovaldata';
11
12
    /**
13
     * Get checkin data.
14
     *
15
     * @param     $startTime
16
     * @param     $endTime
17
     * @param     $userIdList
18
     * @param int $openCheckinDataType
19
     *
20
     * @return \EntWeChat\Support\Collection
21
     */
22
    public function getCheckinData($startTime, $endTime, $userIdList, $openCheckinDataType = 3)
23
    {
24
        $params = [
25
            'opencheckindatatype' => $openCheckinDataType,
26
            'starttime'           => $startTime,
27
            'endtime'             => $endTime,
28
            'useridlist'          => (array) $userIdList,
29
        ];
30
31
        return $this->parseJSON('json', [self::API_CHECKIN_DATA, $params]);
32
    }
33
34
    /**
35
     * Get approval data.
36
     *
37
     * @param      $startTime
38
     * @param      $endTime
39
     * @param null $nextSpNum
40
     *
41
     * @return \EntWeChat\Support\Collection
42
     */
43
    public function getApprovalData($startTime, $endTime, $nextSpNum = null)
44
    {
45
        $params = [
46
            'starttime'  => $startTime,
47
            'endtime'    => $endTime,
48
            'next_spnum' => $nextSpNum,
49
        ];
50
51
        return $this->parseJSON('json', [self::API_APPROVAL_DATA, $params]);
52
    }
53
}
54