Completed
Push — master ( e39fed...4b4c12 )
by mingyoung
18s queued 11s
created

Client::statisticsByType()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 4
dl 0
loc 4
rs 10
c 0
b 0
f 0
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\Report;
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 list($params)
26
    {
27
        return $this->client->postJson('topapi/report/list', $params);
28
    }
29
30
    /**
31
     * 获取用户可见的日志模板
32
     *
33
     * @param string|null $userId
34
     * @param int $offset
35
     * @param int $size
36
     *
37
     * @return mixed
38
     */
39
    public function templates($userId = null, $offset = 0, $size = 100)
40
    {
41
        return $this->client->postJson('topapi/report/template/listbyuserid', [
42
            'userid' => $userId, 'offset' => $offset, 'size' => $size,
43
        ]);
44
    }
45
46
    /**
47
     * 获取用户日志未读数
48
     *
49
     * @param string $userid
50
     *
51
     * @return mixed
52
     */
53
    public function unreadCount($userid)
54
    {
55
        return $this->client->postJson('topapi/report/getunreadcount', compact('userid'));
56
    }
57
58
    /**
59
     * 获取日志的已读人数、评论条数、评论人数、点赞人数。
60
     *
61
     * @param $report_id
62
     *
63
     * @return mixed
64
     */
65
    public function statistics($report_id)
66
    {
67
        return $this->client->postJson('topapi/report/statistics', compact('report_id'));
68
    }
69
70
    /**
71
     * 获取日志相关人员列表,包括已读人员列表、评论人员列表、点赞人员列表
72
     *
73
     * @param string $report_id
74
     * @param int $type
75
     * @param int $offset
76
     * @param int $size
77
     *
78
     * @return mixed
79
     */
80
    public function statisticsByType($report_id, $type, $offset = 0, $size = 100)
81
    {
82
        return $this->client->postJson('topapi/report/statistics/listbytype', [
83
            'report_id' => $report_id, 'type' => $type, 'offset' => $offset, 'size' => $size
84
        ]);
85
    }
86
87
    /**
88
     * 获取日志接收人员列表
89
     *
90
     * @param string $report_id
91
     * @param int $offset
92
     * @param int $size
93
     *
94
     * @return mixed
95
     */
96
    public function getReceivers($report_id, $offset = 0, $size = 100)
97
    {
98
        return $this->client->postJson('topapi/report/receiver/list', [
99
            'report_id' => $report_id, 'offset' => $offset, 'size' => $size
100
        ]);
101
    }
102
103
    /**
104
     * 获取日志评论详情,包括评论人userid、评论内容、评论时间
105
     *
106
     * @param string $report_id
107
     * @param int $offset
108
     * @param int $size
109
     *
110
     * @return mixed
111
     */
112
    public function getComments($report_id, $offset = 0, $size = 100)
113
    {
114
        return $this->client->postJson('topapi/report/comment/list', [
115
            'report_id' => $report_id, 'offset' => $offset, 'size' => $size
116
        ]);
117
    }
118
119
}
120