work/oa/meetingroom.pm untested

filter: Statementstmt 0.0% 0 / 121 Branchbran 0.0% 0 / 40 Conditioncond 0.0% 0 / 60 MC/DCmcdc 0.0% 0 / 30 Subroutinesub 0.0% 0 / 16 Podpod 0.0% 0 / 10 totaltotal 0.0% 0 / 277 CC 21 SCAR 23.4
CC
21
Cov
0%
add
12.0
list
12.0
edit
12.0
CRAP 10.3
1 package QQ::weixin::work::oa::meetingroom;
2
3 =encoding utf8
4
5 =head1 Name
6
7 QQ::weixin::work::oa::meetingroom
8
9 =head1 DESCRIPTION
10
11 会议室
12
13 =cut
14
15 use strict;
16 use base qw(QQ::weixin::work::oa);
17 use Encode;
18 use LWP::UserAgent;
19 use JSON;
20 use utf8;
21
22 our $VERSION = '0.10';
23 our @EXPORT = qw/ add list edit del
24 get_booking_info book book_by_schedule book_by_meeting
25 cancel_book get_booking_info_by_meeting_id /;
26
27 =head1 FUNCTION
28
29 =head2 会议室管理
30
31 最后更新:2023/11/30
32
33 =head3 权限说明
34
35 调用会议室相关接口的应用有如下的权限要求:
36
37 应用类型 权限要求
38 自建应用 配置到「应用管理 - 会议室 - 可调用接口的应用」中
39 代开发应用 暂不支持
40 第三方应用 暂不支持
41
42 注: 从2023年12月1日0点起,不再支持通过系统应用secret调用接口,存量企业暂不受影响 查看详情
43
44 =head2 add(access_token, hash);
45
46 添加会议室
47
48 =head2 SYNOPSIS
49
50 L<https://developer.work.weixin.qq.com/document/path/93619#添加会议室>
51
52 =head3 请求说明:
53
54 企业可通过此接口添加一个会议室。
55
56 =head4 请求包结构体为:
57
58 {
59 "name":"18F-会议室",
60 "capacity":10,
61 "city":"深圳",
62 "building":"腾讯大厦",
63 "floor":"18F",
64 "equipment":[1,2,3],
65 "coordinate":
66 {
67 "latitude":"22.540503",
68 "longitude":"113.934528"
69 },
70 "range":
71 {
72 "user_list":["zhangsan","lisi"],
73 "department_list":[1]
74 }
75 }
76
77 =head4 参数说明:
78
79 参数 必须 说明
80 access_token 是 调用接口凭证
81 name 是 会议室名称,最多30个字符
82 capacity 是 会议室所能容纳的人数
83 city 否 会议室所在城市
84 building 否 会议室所在楼宇
85 floor 否 会议室所在楼层
86 equipment 否 会议室支持的设备列表,参数详细含义见附录
87 coordinate.latitude 否 会议室所在建筑纬度,可通过腾讯地图坐标拾取器获取
88 coordinate.longitude 否 会议室所在建筑经度,可通过腾讯地图坐标拾取器获取
89 range.user_list 否 会议室使用范围的userid列表,最多指定1000个成员
90 range.department_list 否 会议室使用范围的部门id列表,最多指定1000个部门
91
92 如果不填写range参数,则默认为全公司可用。
93 如果需要为会议室设置位置信息,则必须同时填写城市(city),楼宇(building)和楼层(floor)三个参数。
94
95 =head3 权限说明
96
97 =head3 RETURN 返回结果
98
99 {
100 "errcode": 0,
101 "errmsg": "ok",
102 "meetingroom_id":1
103 }
104
105 =head3 RETURN 参数说明
106
107 参数 说明
108 errcode 返回码
109 errmsg 对返回码的文本描述内容
110 meetingroom_id 会议室的id
111
112 =cut
113
114 sub add {
115 if ( @_ && $_[0] && ref $_[1] eq 'HASH' ) {
116 my $access_token = $_[0];
117 my $json = $_[1];
118 my $ua = LWP::UserAgent->new;
119 $ua->timeout(30);
120 $ua->env_proxy;
121
122 my $response = $ua->post("https://qyapi.weixin.qq.com/cgi-bin/oa/meetingroom/add?access_token=$access_token",Content => to_json($json,{allow_nonref=>1}),Content_type =>'application/json');
123 if ($response->is_success) {
124 return from_json($response->decoded_content,{utf8 => 1, allow_nonref => 1});
125 }
126
127 }
128 return 0;
129 }
130
131 =head2 list(access_token, hash);
132
133 查询会议室
134
135 =head2 SYNOPSIS
136
137 L<https://developer.work.weixin.qq.com/document/path/93619#查询会议室>
138
139 =head3 请求说明:
140
141 企业可通过此接口查询满足条件的会议室。
142
143 =head4 请求包结构体为:
144
145 {
146 "city":"深圳",
147 "building":"腾讯大厦",
148 "floor":"18F",
149 "equipment":[1,2,3]
150 }
151
152 =head4 参数说明:
153
154 参数 是否必须 说明
155 access_token 是 调用接口凭证
156 city 否 会议室所在城市
157 building 否 会议室所在楼宇
158 floor 否 会议室所在楼层
159 equipment 否 会议室支持的设备列表,参数详细含义见附录
160
161 如果需要使用某个位置信息进行查询,则需要保证其上一级的位置信息已填写,即如需使用楼宇进行过滤,则必须同时填写城市字段
162
163 =head3 权限说明
164
165 =head3 RETURN 返回结果
166
167 {
168 "errcode": 0,
169 "errmsg": "ok",
170 "meetingroom_list":
171 [
172 {
173 "meetingroom_id":1,
174 "name":"18F-会议室",
175 "capacity":10,
176 "city":"深圳",
177 "building":"腾讯大厦",
178 "floor":"18F",
179 "equipment":[1,2,3],
180 "coordinate":
181 {
182 "latitude":"22.540503",
183 "longitude":"113.934528"
184 },
185 "need_approval":1
186 },
187 {
188 "meetingroom_id":2,
189 "name":"19F-会议室",
190 "capacity":20,
191 "city":"深圳",
192 "building":"腾讯大厦",
193 "floor":"19F",
194 "equipment":[2,3],
195 "coordinate":
196 {
197 "latitude":"22.540503",
198 "longitude":"113.934528"
199 },
200 "range":
201 {
202 "user_list":["zhangsan","lisi"],
203 "department_list":[1]
204 }
205 },
206 ]
207 }
208
209 =head3 RETURN 参数说明
210
211 参数 说明
212 errcode 返回码
213 errmsg 对返回码的文本描述内容
214 meetingroom_list 满足条件的会议室列表
215 meetingroom_list.meetingroom_id 会议室id
216 meetingroom_list.name 会议室名称
217 meetingroom_list.capacity 会议室容纳人数
218 meetingroom_list.city 会议室所在城市
219 meetingroom_list.building 会议室所在楼宇
220 meetingroom_list.floor 会议室所在楼层
221 meetingroom_list.equipment 会议室支持的设备列表
222 meetingroom_list.coordinate.latitude 会议室所在楼宇的纬度
223 meetingroom_list.coordinate.longitude 会议室所在楼宇的经度
224 meetingroom_list.need_approval 是否需要审批 0-无需审批 1-需要审批
225 range.user_list 会议室使用范围的userid列表(仅会议室系统应用查询时返回)
226 range.department_list 会议室使用范围的部门id列表,(仅会议室系统应用查询时返回)
227
228 =cut
229
230 sub list {
231 if ( @_ && $_[0] && ref $_[1] eq 'HASH' ) {
232 my $access_token = $_[0];
233 my $json = $_[1];
234 my $ua = LWP::UserAgent->new;
235 $ua->timeout(30);
236 $ua->env_proxy;
237
238 my $response = $ua->post("https://qyapi.weixin.qq.com/cgi-bin/oa/meetingroom/list?access_token=$access_token",Content => to_json($json,{allow_nonref=>1}),Content_type =>'application/json');
239 if ($response->is_success) {
240 return from_json($response->decoded_content,{utf8 => 1, allow_nonref => 1});
241 }
242
243 }
244 return 0;
245 }
246
247 =head2 edit(access_token, hash);
248
249 编辑会议室
250
251 =head2 SYNOPSIS
252
253 L<https://developer.work.weixin.qq.com/document/path/93619#编辑会议室>
254
255 =head3 请求说明:
256
257 企业可通过此接口编辑相关会议室的基本信息。
258
259 注意,会议室使用范围(range)为覆盖操作,而非增量添加。
260
261 =head4 请求包结构体为:
262
263 {
264 "meetingroom_id":2,
265 "name":"18F-会议室",
266 "capacity":10,
267 "city":"深圳",
268 "building":"腾讯大厦",
269 "floor":"18F",
270 "equipment":[1,2,3],
271 "coordinate":
272 {
273 "latitude":"22.540503",
274 "longitude":"113.934528"
275 },
276 "range":
277 {
278 "user_list":["zhangsan","lisi"],
279 "department_list":[1]
280 }
281 }
282
283 =head4 参数说明:
284
285 参数 必须 说明
286 access_token 是 调用接口凭证
287 meetingroom_id 是 会议室的id
288 name 否 会议室名称,最多30个字符
289 capacity 否 会议室所能容纳的人数
290 city 否 会议室所在城市
291 building 否 会议室所在楼宇
292 floor 否 会议室所在楼层
293 equipment 否 会议室支持的设备列表,参数详细含义见附录
294 coordinate.latitude 否 会议室所在建筑纬度,可通过腾讯地图坐标拾取器获取
295 coordinate.longitude 否 会议室所在建筑经度,可通过腾讯地图坐标拾取器获取
296 range.user_list 否 会议室使用范围的userid列表,最多指定1000个成员,填写后将覆盖整个使用范围
297 range.department_list 否 会议室使用范围的部门id列表,最多指定1000个部门,填写后将覆盖整个使用范围
298
299 如果需要修改位置信息,请同时输入城市,楼宇和楼层三个参数,已经生成的建筑,暂不支持修改经纬度。
300
301 =head3 权限说明
302
303 =head3 RETURN 返回结果
304
305 {
306 "errcode": 0,
307 "errmsg": "ok"
308 }
309
310 =head3 RETURN 参数说明
311
312 参数 说明
313 errcode 返回码
314 errmsg 对返回码的文本描述内容
315
316 =cut
317
318 sub edit {
319 if ( @_ && $_[0] && ref $_[1] eq 'HASH' ) {
320 my $access_token = $_[0];
321 my $json = $_[1];
322 my $ua = LWP::UserAgent->new;
323 $ua->timeout(30);
324 $ua->env_proxy;
325
326 my $response = $ua->post("https://qyapi.weixin.qq.com/cgi-bin/oa/meetingroom/edit?access_token=$access_token",Content => to_json($json,{allow_nonref=>1}),Content_type =>'application/json');
327 if ($response->is_success) {
328 return from_json($response->decoded_content,{utf8 => 1, allow_nonref => 1});
329 }
330
331 }
332 return 0;
333 }
334
335 =head2 del(access_token, hash);
336
337 删除会议室
338
339 =head2 SYNOPSIS
340
341 L<https://developer.work.weixin.qq.com/document/path/93619#删除会议室>
342
343 =head3 请求说明:
344
345 企业可通过此接口删除指定的会议室。
346
347 =head4 请求包体:
348
349 {
350 "meetingroom_id":1,
351 }
352
353 =head4 参数说明:
354
355 参数 必须 说明
356 access_token 是 调用接口凭证
357 meetingroom_id 是 会议室的id
358
359 =head3 权限说明
360
361 =head3 RETURN 返回结果
362
363 {
364 "errcode": 0,
365 "errmsg": "ok"
366 }
367
368 =head3 RETURN 参数说明
369
370 参数 说明
371 errcode 返回码
372 errmsg 对返回码的文本描述内容
373
374 =head4 附录
375
376 当前支持的会议室设备如下
377
378 设备id 设备名称
379 1 电视
380 2 电话
381 3 投影
382 4 白板
383 5 视频
384
385 =cut
386
387 sub del {
388 if ( @_ && $_[0] && ref $_[1] eq 'HASH' ) {
389 my $access_token = $_[0];
390 my $json = $_[1];
391 my $ua = LWP::UserAgent->new;
392 $ua->timeout(30);
393 $ua->env_proxy;
394
395 my $response = $ua->post("https://qyapi.weixin.qq.com/cgi-bin/oa/meetingroom/del?access_token=$access_token",Content => to_json($json,{allow_nonref=>1}),Content_type =>'application/json');
396 if ($response->is_success) {
397 return from_json($response->decoded_content,{utf8 => 1, allow_nonref => 1});
398 }
399
400 }
401 return 0;
402 }
403
404 =head2 会议室预定管理
405
406 最后更新:2023/12/01
407
408 =head3 SYNOPSIS
409
410 L<https://developer.work.weixin.qq.com/document/path/93620>
411
412 =head3 权限说明
413
414 应用类型 权限要求
415 自建应用 配置到「应用管理 - 会议室 - 可调用接口的应用」中
416 代开发应用 暂不支持
417 第三方应用 暂不支持
418
419 注: 从2023年12月1日0点起,不再支持通过系统应用secret调用接口,存量企业暂不受影响 查看详情
420
421 =head2 get_booking_info(access_token, hash);
422
423 查询会议室的预定信息
424
425 =head2 SYNOPSIS
426
427 L<https://developer.work.weixin.qq.com/document/path/93620#查询会议室的预定信息>
428
429 =head3 请求说明:
430
431 企业可通过此接口查询相关会议室在指定时间段的预定情况,如是否已被预定,预定者的userid等信息,不支持跨天查询。
432
433 =head4 请求包体:
434
435 {
436 "meetingroom_id":1,
437 "start_time":1593532800,
438 "end_time":1593619200,
439 "city":"深圳",
440 "building":"腾讯大厦",
441 "floor":"18F"
442 }
443
444 =head4 参数说明:
445
446 参数 必须 说明
447 access_token 是 调用接口凭证
448 meetingroom_id 否 会议室id
449 start_time 否 查询预定的起始时间,默认为当前时间
450 end_time 否 查询预定的结束时间, 默认为明日0时
451 city 否 会议室所在城市
452 building 否 会议室所在楼宇
453 floor 否 会议室所在楼层
454
455 如果需要根据位置信息查询,则需要保证其上一级的位置信息已填写,即如需使用楼宇进行过滤,则必须同时填写城市字段。
456
457 =head3 权限说明
458
459 =head3 RETURN 返回结果
460
461 {
462 "errcode": 0,
463 "errmsg": "ok",
464 "booking_list": [{
465 "meetingroom_id": 1,
466 "schedule": [{
467 "booking_id": "bkebsada6e027c123cbafAAA",
468 "schedule_id": "17c7d2bd9f20d652840f72f59e796AAA",
469 "start_time": 1593532800,
470 "end_time": 1593662400,
471 "booker": "zhangsan",
472 "status":0
473 }]
474 },
475 {
476 "meetingroom_id": 2,
477 "schedule": []
478 }
479 ]
480 }
481
482 =head3 RETURN 参数说明
483
484 参数 说明
485 errcode 返回码
486 errmsg 对返回码的文本描述内容
487 booking_list 会议室预订信息列表
488 booking_list.meetingroom_id 会议室id
489 booking_list.schedule 该会议室查询时间段内的预定情况
490 booking_list.schedule.start_time 开始时间的时间戳
491 booking_list.schedule.end_time 结束时间的时间戳
492 booking_list.schedule.booker 预定人的userid
493 booking_list.schedule.status 会议室的预定状态,0:已预定、1:已取消、2:申请中、3:审批中
494 booking_list.schedule.booking_id 会议室的预定id
495 booking_list.schedule.schedule_id 会议关联日程的id,若会议室已取消预定(未保留日历),则schedule_id将无法再获取到日程详情
496
497 =cut
498
499 sub get_booking_info {
500 if ( @_ && $_[0] && ref $_[1] eq 'HASH' ) {
501 my $access_token = $_[0];
502 my $json = $_[1];
503 my $ua = LWP::UserAgent->new;
504 $ua->timeout(30);
505 $ua->env_proxy;
506
507 my $response = $ua->post("https://qyapi.weixin.qq.com/cgi-bin/oa/meetingroom/get_booking_info?access_token=$access_token",Content => to_json($json,{allow_nonref=>1}),Content_type =>'application/json');
508 if ($response->is_success) {
509 return from_json($response->decoded_content,{utf8 => 1, allow_nonref => 1});
510 }
511
512 }
513 return 0;
514 }
515
516 =head2 book(access_token, hash);
517
518 预定会议室
519
520 =head2 SYNOPSIS
521
522 L<https://developer.work.weixin.qq.com/document/path/93620#预定会议室>
523
524 =head3 请求说明:
525
526 企业可通过此接口预定会议室并自动关联日程。
527
528 =head4 请求包体:
529
530 {
531 "meetingroom_id":1,
532 "subject":"周会",
533 "start_time":1593532800,
534 "end_time":1593619200,
535 "booker":"zhangsan",
536 "attendees":["lisi", "wangwu"]
537 }
538
539 =head4 参数说明:
540
541 参数 必须 说明
542 access_token 是 调用接口凭证
543 subject 否 会议主题
544 meetingroom_id 是 会议室id
545 start_time 是 预定开始时间
546 end_time 是 预定结束时间
547 booker 是 预定人的userid
548 attendees 否 参与人的userid列表
549
550 最小预定时长为30分钟;
551 预定时间和结束时间会自动按30分钟取整,即如果传入的开始和结束时间戳分别对应时间为15:15和15:45,则预定时会自动取整为15:00和16:00;
552 此API仅可预定无需审批的会议室;
553 如果当前时间已经晚于预定时间,则按以下情况进行处理:
554 1.当前已过预定结束时间,则不允许预定
555 2.当前在预定开始时间15分钟内,则允许预定
556 3.当前已超过预定开始时间15分钟,则自动转换预定开始时间到下一个时间窗口,即增加30分钟到开始时间
557
558 =head3 权限说明
559
560 =head3 RETURN 返回结果
561
562 {
563 "errcode": 0,
564 "errmsg": "ok"
565 "meeting_id":"mtgsaseb6e027c123cbafAAA",
566 "schedule_id":"17c7d2bd9f20d652840f72f59e796AAA"
567 }
568
569 =head3 RETURN 参数说明
570
571 参数 说明
572 errcode 返回码
573 errmsg 对返回码的文本描述内容
574 meeting_id 会议的id
575 schedule_id 会议关联日程的id
576
577 =cut
578
579 sub book {
580 if ( @_ && $_[0] && ref $_[1] eq 'HASH' ) {
581 my $access_token = $_[0];
582 my $json = $_[1];
583 my $ua = LWP::UserAgent->new;
584 $ua->timeout(30);
585 $ua->env_proxy;
586
587 my $response = $ua->post("https://qyapi.weixin.qq.com/cgi-bin/oa/meetingroom/book?access_token=$access_token",Content => to_json($json,{allow_nonref=>1}),Content_type =>'application/json');
588 if ($response->is_success) {
589 return from_json($response->decoded_content,{utf8 => 1, allow_nonref => 1});
590 }
591
592 }
593 return 0;
594 }
595
596 =head2 book_by_schedule(access_token, hash);
597
598 通过日程预定会议室
599
600 =head2 SYNOPSIS
601
602 L<https://developer.work.weixin.qq.com/document/path/93620#通过日程预定会议室>
603
604 =head3 请求说明:
605
606 企业可通过此接口为指定日程预定会议室,支持重复日程预定。
607
608 注意:通过日程预定会议室后,该日程将不能通过更新日程接口进行编辑,而只能调用新增日程参与者与删除日程参与者接口。如果需要更新日程的时间等字段,可以先取消会议室预定,再调用更新日程接口,之后再重新预定会议室。
609
610 =head4 请求包体:
611
612 {
613 "meetingroom_id":1,
614 "schedule_id":"1c7e7226edae66468bc48e9859812402",
615 "booker":"rocky"
616 }
617
618 =head4 参数说明:
619
620 参数 必须 说明
621 access_token 是 调用接口凭证
622 meetingroom_id 是 会议室id
623 schedule_id 是 日程id,仅可使用同应用创建的日程
624 booker 是 预定人的userid
625
626 此API仅可预定无需审批的会议室;
627
628 =head3 权限说明
629
630 =head3 RETURN 返回结果
631
632 {
633 "errcode": 0,
634 "errmsg": "ok"
635 "booking_id":"bkgsaseb6e027c123cbafAAA",
636 "conflict_date":[1672502400,1675180800,1677600000]
637 }
638
639 =head3 RETURN 参数说明
640
641 参数 说明
642 errcode 返回码
643 errmsg 对返回码的文本描述内容
644 booking_id 会议室的预定的id
645 conflict_date 会议室冲突日期列表,为当天0点的时间戳;使用重复日程预定会议室,部分日期与会议室预定情况冲突时返回
646
647 =cut
648
649 sub book_by_schedule {
650 if ( @_ && $_[0] && ref $_[1] eq 'HASH' ) {
651 my $access_token = $_[0];
652 my $json = $_[1];
653 my $ua = LWP::UserAgent->new;
654 $ua->timeout(30);
655 $ua->env_proxy;
656
657 my $response = $ua->post("https://qyapi.weixin.qq.com/cgi-bin/oa/meetingroom/book_by_schedule?access_token=$access_token",Content => to_json($json,{allow_nonref=>1}),Content_type =>'application/json');
658 if ($response->is_success) {
659 return from_json($response->decoded_content,{utf8 => 1, allow_nonref => 1});
660 }
661
662 }
663 return 0;
664 }
665
666 =head2 book_by_meeting(access_token, hash);
667
668 通过会议预定会议室
669
670 =head2 SYNOPSIS
671
672 L<https://developer.work.weixin.qq.com/document/path/93620#通过会议预定会议室>
673
674 =head3 请求说明:
675
676 企业可通过此接口为指定会议预定会议室,支持重复会议预定。
677
678 =head4 请求包体:
679
680 {
681 "meetingroom_id":1,
682 "meetingid":"hy7e7226edae66468bc48e9859812402",
683 "booker":"rocky"
684 }
685
686 =head4 参数说明:
687
688 参数 必须 说明
689 access_token 是 调用接口凭证
690 meetingroom_id 是 会议室id
691 meetingid 是 会议id,仅可使用同应用创建的会议
692 booker 是 预定人的userid
693
694 此API仅可预定无需审批的会议室;
695
696 =head3 权限说明
697
698 =head3 RETURN 返回结果
699
700 {
701 "errcode": 0,
702 "errmsg": "ok"
703 "booking_id":"bkgsaseb6e027c123cbafAAA",
704 "conflict_date":[1672502400,1675180800,1677600000]
705 }
706
707 =head3 RETURN 参数说明
708
709 参数 说明
710 errcode 返回码
711 errmsg 对返回码的文本描述内容
712 booking_id 会议室的预定的id
713 conflict_date 会议室冲突日期列表,为当天0点的时间戳;使用重复日程预定会议室,部分日期与会议室预定情况冲突时返回
714
715 =cut
716
717 sub book_by_meeting {
718 if ( @_ && $_[0] && ref $_[1] eq 'HASH' ) {
719 my $access_token = $_[0];
720 my $json = $_[1];
721 my $ua = LWP::UserAgent->new;
722 $ua->timeout(30);
723 $ua->env_proxy;
724
725 my $response = $ua->post("https://qyapi.weixin.qq.com/cgi-bin/oa/meetingroom/book_by_meeting?access_token=$access_token",Content => to_json($json,{allow_nonref=>1}),Content_type =>'application/json');
726 if ($response->is_success) {
727 return from_json($response->decoded_content,{utf8 => 1, allow_nonref => 1});
728 }
729
730 }
731 return 0;
732 }
733
734 =head2 cancel_book(access_token, hash);
735
736 取消预定会议室
737
738 =head2 SYNOPSIS
739
740 L<https://developer.work.weixin.qq.com/document/path/93620#取消预定会议室>
741
742 =head3 请求说明:
743
744 企业可通过此接口取消会议室的预定。
745
746 =head4 请求包体:
747
748 {
749 "booking_id":"bk42b34949gsaseb6e027c123cbafAAA",
750 "keep_schedule":1,
751 "cancel_date":1672502400
752 }
753
754 =head4 参数说明:
755
756 参数 必须 说明
757 access_token 是 调用接口凭证
758 booking_id 是 会议室的预定id
759 keep_schedule 否 是否保留日程,0-同步删除 1-保留,仅对非重复日程有效
760 cancel_date 否 对于重复日程,如果不填写此参数,表示取消所有重复预定;如果填写,则表示取消对应日期当天的会议室预定
761
762 =head3 权限说明
763
764 =head3 RETURN 返回结果
765
766 {
767 "errcode": 0,
768 "errmsg": "ok"
769 }
770
771 =head3 RETURN 参数说明
772
773 参数 说明
774 errcode 返回码
775 errmsg 对返回码的文本描述内容
776
777 =cut
778
779 sub cancel_book {
780 if ( @_ && $_[0] && ref $_[1] eq 'HASH' ) {
781 my $access_token = $_[0];
782 my $json = $_[1];
783 my $ua = LWP::UserAgent->new;
784 $ua->timeout(30);
785 $ua->env_proxy;
786
787 my $response = $ua->post("https://qyapi.weixin.qq.com/cgi-bin/oa/meetingroom/cancel_book?access_token=$access_token",Content => to_json($json,{allow_nonref=>1}),Content_type =>'application/json');
788 if ($response->is_success) {
789 return from_json($response->decoded_content,{utf8 => 1, allow_nonref => 1});
790 }
791
792 }
793 return 0;
794 }
795
796 =head2 get_booking_info_by_meeting_id(access_token, hash);
797
798 根据会议ID查询会议室的预定信息
799
800 =head2 SYNOPSIS
801
802 L<https://developer.work.weixin.qq.com/document/path/93620#根据会议id查询会议室的预定信息>
803
804 =head3 请求说明:
805
806 企业可通过此接口按照会议ID查询相关会议室的预定情况。
807
808 =head4 请求包体:
809
810 {
811 "meetingroom_id":1,
812 "meeting_id": "mtebsada6e027c123cbafAAA",
813 }
814
815 =head4 参数说明:
816
817 参数 必须 说明
818 access_token 是 调用接口凭证
819 meetingroom_id 是 会议室id
820 meeting_id 是 会议的id
821
822 =head3 权限说明
823
824 企业需要使用“会议室”secret所获取的accesstoken来调用(accesstoken如何获取?)。
825 暂不支持第三方调用
826
827 =head3 RETURN 返回结果
828
829 {
830 "errcode": 0,
831 "errmsg": "ok",
832 "meetingroom_id": 1,
833 "schedule": [
834 {
835 "meeting_id": "mtebsada6e027c123cbafAAA",
836 "schedule_id": "17c7d2bd9f20d652840f72f59e796AAA",
837 "start_time": 1593532800,
838 "end_time": 1593662400,
839 "booker": "zhangsan"
840 }
841 ]
842 }
843
844 =head3 RETURN 参数说明
845
846 参数 说明
847 errcode 返回码
848 errmsg 对返回码的文本描述内容
849 meetingroom_id 会议室id
850 schedule 该会议室的预定情况
851 schedule.start_time 开始时间的时间戳
852 schedule.end_time 结束时间的时间戳
853 schedule.booker 预定人的userid,仅在已预定时返回
854 schedule.meeting_id 会议的id,仅在已预定的时返回
855 schedule.schedule_id 会议关联日程的id,仅在已预定时返回
856
857 =cut
858
859 sub get_booking_info_by_meeting_id {
860 if ( @_ && $_[0] && ref $_[1] eq 'HASH' ) {
861 my $access_token = $_[0];
862 my $json = $_[1];
863 my $ua = LWP::UserAgent->new;
864 $ua->timeout(30);
865 $ua->env_proxy;
866
867 my $response = $ua->post("https://qyapi.weixin.qq.com/cgi-bin/oa/meetingroom/get_booking_info_by_meeting_id?access_token=$access_token",Content => to_json($json,{allow_nonref=>1}),Content_type =>'application/json');
868 if ($response->is_success) {
869 return from_json($response->decoded_content,{utf8 => 1, allow_nonref => 1});
870 }
871
872 }
873 return 0;
874 }
875
876
877 1;
878 __END__