work/oa/meetingroom/bookinfo.pm untested

filter: Statementstmt 0.0% 0 / 31 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 52 CC 3 SCAR 16.7
CC
3
Cov
0%
get
12.0
BEGIN
2.0
BEGIN
2.0
CRAP 5.3
1 package QQ::weixin::work::oa::meetingroom::bookinfo;
2
3 =encoding utf8
4
5 =head1 Name
6
7 QQ::weixin::work::oa::meetingroom::bookinfo
8
9 =head1 DESCRIPTION
10
11 会议室
12
13 =cut
14
15 use strict;
16 use base qw(QQ::weixin::work::oa::meetingroom);
17 use Encode;
18 use LWP::UserAgent;
19 use JSON;
20 use utf8;
21
22 our $VERSION = '0.10';
23 our @EXPORT = qw/ get /;
24
25 =head1 FUNCTION
26
27 =head2 会议室预定管理
28
29 最后更新:2023/12/01
30
31 =head3 SYNOPSIS
32
33 L<https://developer.work.weixin.qq.com/document/path/93620>
34
35 =head3 权限说明
36
37 应用类型 权限要求
38 自建应用 配置到「应用管理 - 会议室 - 可调用接口的应用」中
39 代开发应用 暂不支持
40 第三方应用 暂不支持
41
42 注: 从2023年12月1日0点起,不再支持通过系统应用secret调用接口,存量企业暂不受影响 查看详情
43
44 =head2 get(access_token, hash);
45
46 根据会议室预定ID查询预定详情
47
48 =head2 SYNOPSIS
49
50 L<https://developer.work.weixin.qq.com/document/path/93620#根据会议室预定id查询预定详情>
51
52 =head3 请求说明:
53
54 企业可通过此接口根据预定id查询相关会议室的预定情况
55
56 =head4 请求包体:
57
58 {
59 "meetingroom_id":1,
60 "booking_id": "bkebsada6e027c123cbafAAA",
61 }
62
63 =head4 参数说明:
64
65 参数 必须 说明
66 access_token 是 调用接口凭证
67 meetingroom_id 是 会议室id
68 booking_id 是 会议室的预定id
69
70 =head3 权限说明
71
72 =head3 RETURN 返回结果
73
74 {
75 "errcode": 0,
76 "errmsg": "ok",
77 "meetingroom_id": 1,
78 "schedule": {
79 "booking_id": "bkebsada6e027c123cbafAAA",
80 "master_booking_id":"rbsho97cbidajgixnyk8eAA",
81 "schedule_id": "17c7d2bd9f20d652840f72f59e796AAA",
82 "start_time": 1593532800,
83 "end_time": 1593662400,
84 "booker": "zhangsan",
85 "status":0
86 }
87 }
88
89 =head3 RETURN 参数说明
90
91 参数 说明
92 errcode 返回码
93 errmsg 对返回码的文本描述内容
94 meetingroom_id 会议室id
95 schedule 该会议室的预定情况
96 schedule.start_time 开始时间的时间戳
97 schedule.end_time 结束时间的时间戳
98 schedule.booker 预定人的userid
99 schedule.booking_id 会议室的预定id
100 schedule.master_booking_id 如果该预定是某个周期性预定的一部分,则返回对应周期性预定的booking_id
101 schedule.schedule_id 会议关联日程的id,若会议室已取消预定(未保留日历),则schedule_id将无法再获取到日程详情
102 schedule.status 会议室的预定状态,0:已预定、1:已取消、2:申请中、3:审批中
103
104 =cut
105
106 sub get {
107 if ( @_ && $_[0] && ref $_[1] eq 'HASH' ) {
108 my $access_token = $_[0];
109 my $json = $_[1];
110 my $ua = LWP::UserAgent->new;
111 $ua->timeout(30);
112 $ua->env_proxy;
113
114 my $response = $ua->post("https://qyapi.weixin.qq.com/cgi-bin/oa/meetingroom/bookinfo/get?access_token=$access_token",Content => to_json($json,{allow_nonref=>1}),Content_type =>'application/json');
115 if ($response->is_success) {
116 return from_json($response->decoded_content,{utf8 => 1, allow_nonref => 1});
117 }
118
119 }
120 return 0;
121 }
122
123 1;
124 __END__