1 package com.foxinmy.weixin4j.mp;
2
3 import java.io.InputStream;
4 import java.util.Date;
5 import java.util.List;
6
7 import com.alibaba.fastjson.JSONObject;
8 import com.foxinmy.weixin4j.cache.CacheStorager;
9 import com.foxinmy.weixin4j.cache.FileCacheStorager;
10 import com.foxinmy.weixin4j.exception.WeixinException;
11 import com.foxinmy.weixin4j.http.weixin.ApiResult;
12 import com.foxinmy.weixin4j.model.Button;
13 import com.foxinmy.weixin4j.model.Token;
14 import com.foxinmy.weixin4j.model.WeixinAccount;
15 import com.foxinmy.weixin4j.model.card.*;
16 import com.foxinmy.weixin4j.model.media.MediaCounter;
17 import com.foxinmy.weixin4j.model.media.MediaDownloadResult;
18 import com.foxinmy.weixin4j.model.media.MediaItem;
19 import com.foxinmy.weixin4j.model.media.MediaRecord;
20 import com.foxinmy.weixin4j.model.media.MediaUploadResult;
21 import com.foxinmy.weixin4j.model.paging.Pageable;
22 import com.foxinmy.weixin4j.model.paging.Pagedata;
23 import com.foxinmy.weixin4j.model.qr.QRParameter;
24 import com.foxinmy.weixin4j.model.qr.QRResult;
25 import com.foxinmy.weixin4j.mp.api.CardApi;
26 import com.foxinmy.weixin4j.mp.api.CommentApi;
27 import com.foxinmy.weixin4j.mp.api.CustomApi;
28 import com.foxinmy.weixin4j.mp.api.DataApi;
29 import com.foxinmy.weixin4j.mp.api.GroupApi;
30 import com.foxinmy.weixin4j.mp.api.HelperApi;
31 import com.foxinmy.weixin4j.mp.api.MassApi;
32 import com.foxinmy.weixin4j.mp.api.MediaApi;
33 import com.foxinmy.weixin4j.mp.api.MenuApi;
34 import com.foxinmy.weixin4j.mp.api.NotifyApi;
35 import com.foxinmy.weixin4j.mp.api.OauthApi;
36 import com.foxinmy.weixin4j.mp.api.QrApi;
37 import com.foxinmy.weixin4j.mp.api.TagApi;
38 import com.foxinmy.weixin4j.mp.api.TmplApi;
39 import com.foxinmy.weixin4j.mp.api.UserApi;
40 import com.foxinmy.weixin4j.mp.component.WeixinTokenComponentCreator;
41 import com.foxinmy.weixin4j.mp.message.NotifyMessage;
42 import com.foxinmy.weixin4j.mp.message.TemplateMessage;
43 import com.foxinmy.weixin4j.mp.model.ArticleComment;
44 import com.foxinmy.weixin4j.mp.model.ArticleComment.ArticleCommentType;
45 import com.foxinmy.weixin4j.mp.model.AutoReplySetting;
46 import com.foxinmy.weixin4j.mp.model.Following;
47 import com.foxinmy.weixin4j.mp.model.Group;
48 import com.foxinmy.weixin4j.mp.model.KfAccount;
49 import com.foxinmy.weixin4j.mp.model.KfChatRecord;
50 import com.foxinmy.weixin4j.mp.model.KfOnlineAccount;
51 import com.foxinmy.weixin4j.mp.model.KfSession;
52 import com.foxinmy.weixin4j.mp.model.KfSession.KfSessionCounter;
53 import com.foxinmy.weixin4j.mp.model.Menu;
54 import com.foxinmy.weixin4j.mp.model.MenuMatchRule;
55 import com.foxinmy.weixin4j.mp.model.MenuSetting;
56 import com.foxinmy.weixin4j.mp.model.SemQuery;
57 import com.foxinmy.weixin4j.mp.model.SemResult;
58 import com.foxinmy.weixin4j.mp.model.Tag;
59 import com.foxinmy.weixin4j.mp.model.TemplateMessageInfo;
60 import com.foxinmy.weixin4j.mp.model.User;
61 import com.foxinmy.weixin4j.mp.model.ChangeOpenidResult;
62 import com.foxinmy.weixin4j.mp.token.WeixinTicketCreator;
63 import com.foxinmy.weixin4j.mp.token.WeixinTokenCreator;
64 import com.foxinmy.weixin4j.mp.type.DatacubeType;
65 import com.foxinmy.weixin4j.mp.type.IndustryType;
66 import com.foxinmy.weixin4j.mp.type.Lang;
67 import com.foxinmy.weixin4j.token.PerTicketManager;
68 import com.foxinmy.weixin4j.token.TokenCreator;
69 import com.foxinmy.weixin4j.token.TokenManager;
70 import com.foxinmy.weixin4j.tuple.MassTuple;
71 import com.foxinmy.weixin4j.tuple.MpArticle;
72 import com.foxinmy.weixin4j.tuple.MpVideo;
73 import com.foxinmy.weixin4j.type.MediaType;
74 import com.foxinmy.weixin4j.type.TicketType;
75 import com.foxinmy.weixin4j.util.Consts;
76 import com.foxinmy.weixin4j.util.Weixin4jConfigUtil;
77
78 /**
79 * 微信公众平台接口实现
80 *
81 * @className WeixinProxy
82 * @author jinyu(foxinmy@gmail.com)
83 * @date 2014年3月23日
84 * @since JDK 1.6
85 * @see <a href="http://mp.weixin.qq.com/wiki/index.php">api文档</a>
86 */
87 public class WeixinProxy {
88 /**
89 * 授权API
90 */
91 private final OauthApi oauthApi;
92 /**
93 * 媒体素材API
94 */
95 private final MediaApi mediaApi;
96 /**
97 * 客服消息API
98 */
99 private final NotifyApi notifyApi;
100 /**
101 * 多客服API
102 */
103 private final CustomApi customApi;
104 /**
105 * 群发消息API
106 */
107 private final MassApi massApi;
108 /**
109 * 用户API
110 */
111 private final UserApi userApi;
112 /**
113 * 分组API
114 */
115 private final GroupApi groupApi;
116 /**
117 * 菜单API
118 */
119 private final MenuApi menuApi;
120 /**
121 * 二维码API
122 */
123 private final QrApi qrApi;
124 /**
125 * 模板消息API
126 */
127 private final TmplApi tmplApi;
128 /**
129 * 辅助API
130 */
131 private final HelperApi helperApi;
132 /**
133 * 数据统计API
134 */
135 private final DataApi dataApi;
136 /**
137 * 标签API
138 */
139 private final TagApi tagApi;
140 /**
141 * 卡券API
142 */
143 private final CardApi cardApi;
144 /**
145 * 文章评论API
146 */
147 private final CommentApi commentApi;
148 /**
149 * token管理
150 */
151 private final TokenManager tokenManager;
152 /**
153 * 账号信息
154 */
155 private final WeixinAccount weixinAccount;
156 /**
157 * token存储
158 */
159 private final CacheStorager<Token> cacheStorager;
160
161 /**
162 * 微信接口实现(使用weixin4j.properties配置的account账号信息,
163 * 使用FileCacheStorager文件方式缓存TOKEN)
164 */
165 public WeixinProxy() {
166 this(new FileCacheStorager<Token>());
167 }
168
169 /**
170 * 微信接口实现(使用weixin4j.properties配置的account账号信息)
171 *
172 * @param cacheStorager
173 * token管理
174 */
175 public WeixinProxy(CacheStorager<Token> cacheStorager) {
176 this(Weixin4jConfigUtil.getWeixinAccount(), cacheStorager);
177 }
178
179 /**
180 * 微信接口实现
181 *
182 * @param weixinAccount
183 * 账号信息
184 * @param cacheStorager
185 * token管理
186 */
187 public WeixinProxy(WeixinAccount weixinAccount, CacheStorager<Token> cacheStorager) {
188 this(weixinAccount, new WeixinTokenCreator(weixinAccount.getId(), weixinAccount.getSecret()), cacheStorager);
189 }
190
191 /**
192 * 第三方组件方式创建微信接口实现(永久刷新令牌机制)
193 *
194 * @param perTicketManager
195 * 第三方组件永久刷新token
196 * @param componentTokenManager
197 * 第三方组件凭证token
198 * @see com.foxinmy.weixin4j.mp.api.ComponentApi
199 * @see com.foxinmy.weixin4j.mp.api.ComponentApi#getPreCodeManager
200 * @see com.foxinmy.weixin4j.mp.api.ComponentApi#getTokenManager
201 */
202 public WeixinProxy(PerTicketManager perTicketManager, TokenManager componentTokenManager) {
203 this(new WeixinAccount(perTicketManager.getThirdId(), perTicketManager.getThirdSecret()),
204 new WeixinTokenComponentCreator(perTicketManager, componentTokenManager),
205 perTicketManager.getCacheStorager());
206 }
207
208 /**
209 * 微信接口实现
210 *
211 * @param weixinAccount
212 * 微信账号
213 * @param tokenCreator
214 * token的创建
215 * @param cacheStorager
216 * token的存储
217 */
218 private WeixinProxy(WeixinAccount weixinAccount, TokenCreator tokenCreator, CacheStorager<Token> cacheStorager) {
219 if (weixinAccount == null) {
220 throw new IllegalArgumentException("weixinAccount must not be empty");
221 }
222 if (tokenCreator == null) {
223 throw new IllegalArgumentException("tokenCreator must not be empty");
224 }
225 if (cacheStorager == null) {
226 throw new IllegalArgumentException("cacheStorager must not be empty");
227 }
228 this.tokenManager = new TokenManager(tokenCreator, cacheStorager);
229 this.weixinAccount = weixinAccount;
230 this.cacheStorager = cacheStorager;
231 this.oauthApi = new OauthApi(weixinAccount);
232 this.mediaApi = new MediaApi(tokenManager);
233 this.notifyApi = new NotifyApi(tokenManager);
234 this.customApi = new CustomApi(tokenManager);
235 this.massApi = new MassApi(tokenManager);
236 this.userApi = new UserApi(tokenManager);
237 this.groupApi = new GroupApi(tokenManager);
238 this.menuApi = new MenuApi(tokenManager);
239 this.qrApi = new QrApi(tokenManager);
240 this.tmplApi = new TmplApi(tokenManager);
241 this.helperApi = new HelperApi(tokenManager);
242 this.dataApi = new DataApi(tokenManager);
243 this.tagApi = new TagApi(tokenManager);
244 this.cardApi = new CardApi(tokenManager);
245 this.commentApi = new CommentApi(tokenManager);
246 }
247
248 /**
249 * 获取微信账号信息
250 *
251 * @return
252 */
253 public WeixinAccount getWeixinAccount() {
254 return weixinAccount;
255 }
256
257 /**
258 * token管理
259 *
260 * @return
261 */
262 public TokenManager getTokenManager() {
263 return this.tokenManager;
264 }
265
266 /**
267 * 获取oauth授权API
268 *
269 * @see com.foxinmy.weixin4j.mp.api.OauthApi
270 * @return
271 */
272 public OauthApi getOauthApi() {
273 return oauthApi;
274 }
275
276 /**
277 * 获取JSSDK Ticket的tokenManager
278 *
279 * @param ticketType
280 * 票据类型
281 * @return
282 */
283 public TokenManager getTicketManager(TicketType ticketType) {
284 return new TokenManager(new WeixinTicketCreator(ticketType, this.tokenManager), this.cacheStorager);
285 }
286
287 /**
288 * 上传图文消息内的图片获取URL
289 * 请注意,本接口所上传的图片不占用公众号的素材库中图片数量的5000个的限制。图片仅支持jpg/png格式,大小必须在1MB以下。
290 *
291 * @param is
292 * 图片数据流
293 * @param fileName
294 * 文件名 为空时将自动生成
295 * @return 图片URL 可用于后续群发中,放置到图文消息中
296 * @see com.foxinmy.weixin4j.mp.api.MediaApi
297 * @throws WeixinException
298 */
299 public String uploadImage(InputStream is, String fileName) throws WeixinException {
300 return mediaApi.uploadImage(is, fileName);
301 }
302
303 /**
304 * 上传群发中的视频素材
305 *
306 * @param is
307 * 图片数据流
308 * @param fileName
309 * 文件名 为空时将自动生成
310 * @param title
311 * 视频标题 非空
312 * @param description
313 * 视频描述 可为空
314 * @return 群发视频消息对象
315 * @throws WeixinException
316 * @see com.foxinmy.weixin4j.mp.api.MediaApi
317 * @see <a href=
318 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140549&token=&lang=zh_CN">
319 * 高级群发</a>
320 * @see com.foxinmy.weixin4j.tuple.MpVideo
321 */
322 public MpVideo uploadVideo(InputStream is, String fileName, String title, String description)
323 throws WeixinException {
324 return mediaApi.uploadVideo(is, fileName, title, description);
325 }
326
327 /**
328 * 上传媒体文件 </br>
329 * <font color="red">此接口只包含图片、语音、缩略图、视频(临时)四种媒体类型的上传</font>
330 * </p>
331 *
332 * @param isMaterial
333 * 是否永久上传
334 * @param is
335 * 媒体数据流
336 * @param fileName
337 * 文件名 为空时将自动生成
338 * @return 上传到微信服务器返回的媒体标识
339 * @see <a href=
340 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444738726&token=&lang=zh_CN">
341 * 上传临时素材</a>
342 * @see <a href=
343 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444738729&token=&lang=zh_CN">
344 * 上传永久素材</a>
345 * @see com.foxinmy.weixin4j.model.media.MediaUploadResult
346 * @see com.foxinmy.weixin4j.type.MediaType
347 * @see com.foxinmy.weixin4j.mp.api.MediaApi
348 * @throws WeixinException
349 */
350 public MediaUploadResult uploadMedia(boolean isMaterial, InputStream is, String fileName) throws WeixinException {
351 return mediaApi.uploadMedia(isMaterial, is, fileName);
352 }
353
354 /**
355 * 下载媒体文件
356 *
357 * @param mediaId
358 * 媒体ID
359 * @param isMaterial
360 * 是否永久素材
361 * @return 媒体文件下载结果
362 * @throws WeixinException
363 * @see com.foxinmy.weixin4j.mp.api.MediaApi
364 * @see com.foxinmy.weixin4j.model.media.MediaDownloadResult
365 * @see <a href=
366 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444738727&token=&lang=zh_CN">
367 * 下载临时媒体素材</a>
368 * @see <a href=
369 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444738730&token=&lang=zh_CN">
370 * 下载永久媒体素材</a>
371 */
372 public MediaDownloadResult downloadMedia(String mediaId, boolean isMaterial) throws WeixinException {
373 return mediaApi.downloadMedia(mediaId, isMaterial);
374 }
375
376 /**
377 * 上传永久图文素材
378 * <p>
379 * 、新增的永久素材也可以在公众平台官网素材管理模块中看到,永久素材的数量是有上限的,请谨慎新增。图文消息素材和图片素材的上限为5000,
380 * 其他类型为1000
381 * </P>
382 *
383 * @param articles
384 * 图文列表
385 * @return 上传到微信服务器返回的媒体标识
386 * @throws WeixinException
387 * @see com.foxinmy.weixin4j.mp.api.MediaApi
388 * @see com.foxinmy.weixin4j.tuple.MpArticle
389 * @see <a href=
390 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444738729&token=&lang=zh_CN">
391 * 上传永久媒体素材</a>
392 */
393 public String uploadMaterialArticle(List<MpArticle> articles) throws WeixinException {
394 return mediaApi.uploadMaterialArticle(articles);
395 }
396
397 /**
398 * 下载永久图文素材
399 *
400 * @param mediaId
401 * 媒体ID
402 * @return 图文列表
403 * @throws WeixinException
404 * @see {@link #downloadMedia(String, boolean)}
405 * @see com.foxinmy.weixin4j.tuple.MpArticle
406 * @see com.foxinmy.weixin4j.mp.api.MediaApi
407 */
408 public List<MpArticle> downloadArticle(String mediaId) throws WeixinException {
409 return mediaApi.downloadArticle(mediaId);
410 }
411
412 /**
413 * 更新永久图文素材
414 *
415 * @param mediaId
416 * 要修改的图文消息的id
417 * @param index
418 * 要更新的文章在图文消息中的位置(多图文消息时,此字段才有意义),第一篇为0
419 * @param article
420 * 图文对象
421 * @return 处理结果
422 * @throws WeixinException
423 * @see com.foxinmy.weixin4j.mp.api.MediaApi
424 * @see com.foxinmy.weixin4j.tuple.MpArticle
425 * @see <a href=
426 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444738732&token=&lang=zh_CN">
427 * 更新永久图文素材</a>
428 */
429 public ApiResult updateMaterialArticle(String mediaId, int index, MpArticle article) throws WeixinException {
430 return mediaApi.updateMaterialArticle(mediaId, index, article);
431 }
432
433 /**
434 * 删除永久媒体素材
435 *
436 * @param mediaId
437 * 媒体素材的media_id
438 * @return 处理结果
439 * @throws WeixinException
440 * @see com.foxinmy.weixin4j.mp.api.MediaApi
441 * @see <a href=
442 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444738731&token=&lang=zh_CN">
443 * 删除永久媒体素材</a>
444 */
445 public ApiResult deleteMaterialMedia(String mediaId) throws WeixinException {
446 return mediaApi.deleteMaterialMedia(mediaId);
447 }
448
449 /**
450 * 上传永久视频素材
451 *
452 * @param is
453 * 大小不超过1M且格式为MP4的视频文件
454 * @param fileName
455 * 文件名 为空时将自动生成
456 * @param title
457 * 视频标题
458 * @param introduction
459 * 视频描述
460 * @return 上传到微信服务器返回的媒体标识
461 * @see <a href=
462 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444738729&token=&lang=zh_CN">
463 * 上传永久媒体素材</a>
464 * @see com.foxinmy.weixin4j.mp.api.MediaApi
465 * @throws WeixinException
466 */
467 public String uploadMaterialVideo(InputStream is, String fileName, String title, String introduction)
468 throws WeixinException {
469 return mediaApi.uploadMaterialVideo(is, fileName, title, introduction);
470 }
471
472 /**
473 * 获取永久媒体素材的总数</br>
474 * .图片和图文消息素材(包括单图文和多图文)的总数上限为5000,其他素材的总数上限为1000
475 *
476 * @return 总数对象
477 * @throws WeixinException
478 * @see com.foxinmy.weixin4j.model.media.MediaCounter
479 * @see <a href=
480 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444738733&token=&lang=zh_CN">
481 * 获取素材总数</a>
482 * @see com.foxinmy.weixin4j.mp.api.MediaApi
483 */
484 public MediaCounter countMaterialMedia() throws WeixinException {
485 return mediaApi.countMaterialMedia();
486 }
487
488 /**
489 * 获取媒体素材记录列表
490 *
491 * @param mediaType
492 * 素材的类型,图片(image)、视频(video)、语音 (voice)、图文(news)
493 * @param pageable
494 * 分页数据
495 * @return 媒体素材的记录对象
496 * @throws WeixinException
497 * @see com.foxinmy.weixin4j.mp.api.MediaApi
498 * @see com.foxinmy.weixin4j.model.media.MediaRecord
499 * @see com.foxinmy.weixin4j.type.MediaType
500 * @see com.foxinmy.weixin4j.model.media.MediaItem
501 * @see com.foxinmy.weixin4j.model.paging.Pageable
502 * @see com.foxinmy.weixin4j.model.paging.Pagedata
503 * @see <a href=
504 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444738734&token=&lang=zh_CN">
505 * 获取素材列表</a>
506 */
507 public MediaRecord listMaterialMedia(MediaType mediaType, Pageable pageable) throws WeixinException {
508 return mediaApi.listMaterialMedia(mediaType, pageable);
509 }
510
511 /**
512 * 获取全部的媒体素材
513 *
514 * @param mediaType
515 * 媒体类型
516 * @return 素材列表
517 * @see com.foxinmy.weixin4j.mp.api.MediaApi
518 * @see {@link #listMaterialMedia(MediaType, Pageable)}
519 * @throws WeixinException
520 */
521 public List<MediaItem> listAllMaterialMedia(MediaType mediaType) throws WeixinException {
522 return mediaApi.listAllMaterialMedia(mediaType);
523 }
524
525 /**
526 * 发送客服消息(在48小时内不限制发送次数)
527 *
528 * @param notify
529 * 客服消息对象
530 * @return 处理结果
531 * @see {@link #sendNotify(NotifyMessage,String) }
532 * @throws WeixinException
533 */
534 public ApiResult sendNotify(NotifyMessage notify) throws WeixinException {
535 return notifyApi.sendNotify(notify);
536 }
537
538 /**
539 * 发送客服消息(在48小时内不限制发送次数)
540 *
541 * @param notify
542 * 客服消息对象
543 * @param kfAccount
544 * 客服账号 可为空
545 * @throws WeixinException
546 * @return 处理结果
547 * @see <a href=
548 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140547&token=&lang=zh_CN">
549 * 发送客服消息</a>
550 * @see com.foxinmy.weixin4j.tuple.Text
551 * @see com.foxinmy.weixin4j.tuple.Image
552 * @see com.foxinmy.weixin4j.tuple.Voice
553 * @see com.foxinmy.weixin4j.tuple.Video
554 * @see com.foxinmy.weixin4j.tuple.Music
555 * @see com.foxinmy.weixin4j.tuple.News
556 * @see com.foxinmy.weixin4j.mp.api.NotifyApi
557 */
558 public ApiResult sendNotify(NotifyMessage notify, String kfAccount) throws WeixinException {
559 return notifyApi.sendNotify(notify, kfAccount);
560 }
561
562 /**
563 * 客服聊天记录
564 *
565 * @param startTime
566 * 查询开始时间
567 * @param endTime
568 * 查询结束时间 每次查询不能跨日查询
569 * @param number
570 * 最多10000条
571 * @see com.foxinmy.weixin4j.mp.model.KfChatRecord
572 * @see com.foxinmy.weixin4j.mp.api.CustomApi
573 * @see <a href="http://dkf.qq.com/document-1_1.html">查询客服聊天记录</a>
574 * @see <a href=
575 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1458044854&token=&lang=zh_CN">
576 * 查询客服聊天记录</a>
577 * @throws WeixinException
578 */
579 public List<KfChatRecord> getKfChatRecord(Date startTime, Date endTime, int number) throws WeixinException {
580 return customApi.getKfChatRecord(startTime, endTime, number);
581 }
582
583 /**
584 * 获取公众号中所设置的客服基本信息,包括客服工号、客服昵称、客服登录账号
585 *
586 * @return 多客服信息列表
587 * @see com.foxinmy.weixin4j.mp.model.KfAccount
588 * @see com.foxinmy.weixin4j.mp.api.CustomApi
589 * @see <a href=
590 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1458044813&token=&lang=zh_CN">
591 * 获取客服基本信息</a>
592 * @throws WeixinException
593 */
594 public List<KfAccount> listKfAccount() throws WeixinException {
595 return customApi.listKfAccount();
596 }
597
598 /**
599 * 获取在线客服在线状态(手机在线、PC客户端在线、手机和PC客户端全都在线)、客服自动接入最大值、 客服当前接待客户数
600 *
601 * @return 多客服在线信息列表
602 * @see com.foxinmy.weixin4j.mp.model.KfOnlineAccount
603 * @see com.foxinmy.weixin4j.mp.api.CustomApi
604 * @see <a href=
605 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1458044813&token=&lang=zh_CN">
606 * 获取客服在线信息</a>
607 * @throws WeixinException
608 */
609 public List<KfOnlineAccount> listOnlineKfAccount() throws WeixinException {
610 return customApi.listOnlineKfAccount();
611 }
612
613 /**
614 * 新增客服账号
615 *
616 * @param id
617 * 完整客服账号,格式为:账号前缀@公众号微信号,账号前缀最多10个字符,必须是英文或者数字字符。如果没有公众号微信号,
618 * 请前往微信公众平台设置。
619 * @param name
620 * 客服昵称,最长6个汉字或12个英文字符
621 * @return 处理结果
622 * @throws WeixinException
623 * @see com.foxinmy.weixin4j.mp.api.CustomApi 客服管理接口返回码</a>
624 * @see <a href=
625 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1458044813&token=&lang=zh_CN">
626 * 新增客服账号</a>
627 */
628 public ApiResult createKfAccount(String id, String name) throws WeixinException {
629 return customApi.createKfAccount(id, name);
630 }
631
632 /**
633 * 更新客服账号
634 *
635 * @param id
636 * 完整客服账号,格式为:账号前缀@公众号微信号,账号前缀最多10个字符,必须是英文或者数字字符。如果没有公众号微信号,
637 * 请前往微信公众平台设置。
638 * @param name
639 * 客服昵称,最长6个汉字或12个英文字符
640 * @return 处理结果
641 * @throws WeixinException
642 * @see com.foxinmy.weixin4j.mp.api.CustomApi
643 * @see <a href=
644 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1458044813&token=&lang=zh_CN">
645 * 更新客服账号</a>
646 */
647 public ApiResult updateKfAccount(String id, String name) throws WeixinException {
648 return customApi.updateKfAccount(id, name);
649 }
650
651 /**
652 * 邀请绑定客服帐号
653 * 新添加的客服帐号是不能直接使用的,只有客服人员用微信号绑定了客服账号后,方可登录Web客服进行操作。此接口发起一个绑定邀请到客服人员微信号
654 * ,客服人员需要在微信客户端上用该微信号确认后帐号才可用。尚未绑定微信号的帐号可以进行绑定邀请操作,邀请未失效时不能对该帐号进行再次绑定微信号邀请。
655 *
656 * @param kfAccount
657 * 完整客服帐号,格式为:帐号前缀@公众号微信号
658 * @param inviteAccount
659 * 接收绑定邀请的客服微信号
660 * @return 处理结果
661 * @see com.foxinmy.weixin4j.mp.api.CustomApi
662 * @see <a href=
663 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1458044813&token=&lang=zh_CN"
664 * >邀请绑定客服帐号<a/>
665 * @throws WeixinException
666 */
667 public ApiResult inviteKfAccount(String kfAccount, String inviteAccount) throws WeixinException {
668 return customApi.inviteKfAccount(kfAccount, inviteAccount);
669 }
670
671 /**
672 * 上传客服头像
673 *
674 * @param accountId
675 * 完整客服账号,格式为:账号前缀@公众号微信号
676 * @param is
677 * 头像图片文件必须是jpg格式,推荐使用640*640大小的图片以达到最佳效果
678 * @param fileName
679 * 文件名 为空时将自动生成
680 * @return 处理结果
681 * @see com.foxinmy.weixin4j.mp.api.CustomApi
682 * @throws WeixinException
683 * @see <a href=
684 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1458044813&token=&lang=zh_CN">
685 * 上传客服头像</a>
686 */
687 public ApiResult uploadKfAvatar(String accountId, InputStream is, String fileName) throws WeixinException {
688 return customApi.uploadKfAvatar(accountId, is, fileName);
689 }
690
691 /**
692 * 删除客服账号
693 *
694 * @param id
695 * 完整客服账号,格式为:账号前缀@公众号微信号
696 * @return 处理结果
697 * @see com.foxinmy.weixin4j.mp.api.CustomApi
698 * @throws WeixinException
699 * @see <a href=
700 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1458044813&token=&lang=zh_CN">
701 * 删除客服账号</a>
702 */
703 public ApiResult deleteKfAccount(String id) throws WeixinException {
704 return customApi.deleteKfAccount(id);
705 }
706
707 /**
708 * 创建客服会话
709 * <p>
710 * 开发者可以使用本接口,为多客服的客服工号创建会话,将某个客户直接指定给客服工号接待,需要注意此接口不会受客服自动接入数以及自动接入开关限制。
711 * 只能为在线的客服(PC客户端在线,或者已绑定多客服助手)创建会话。
712 * </p>
713 *
714 * @param userOpenId
715 * 用户的userOpenId
716 * @param kfAccount
717 * 完整客服账号,格式为:账号前缀@公众号微信号
718 * @param text
719 * 附加信息,文本会展示在客服人员的多客服客户端
720 * @return 处理结果
721 * @throws WeixinException
722 * @see com.foxinmy.weixin4j.mp.api.CustomApi
723 * @see <a href=
724 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1458044813&token=&lang=zh_CN">
725 * 创建会话</a>
726 */
727 public ApiResult createKfSession(String userOpenId, String kfAccount, String text) throws WeixinException {
728 return customApi.createKfSession(userOpenId, kfAccount, text);
729 }
730
731 /**
732 * 关闭客服会话
733 *
734 * @param userOpenId
735 * 用户的userOpenId
736 * @param kfAccount
737 * 完整客服账号,格式为:账号前缀@公众号微信号
738 * @param text
739 * 附加信息,文本会展示在客服人员的多客服客户端
740 * @return 处理结果
741 * @throws WeixinException
742 * @see com.foxinmy.weixin4j.mp.api.CustomApi
743 * @see <a href=
744 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1458044820&token=&lang=zh_CN">
745 * 关闭会话</a>
746 */
747 public ApiResult closeKfSession(String userOpenId, String kfAccount, String text) throws WeixinException {
748 return customApi.closeKfSession(userOpenId, kfAccount, text);
749 }
750
751 /**
752 * 获取客户的会话状态:获取客户当前的会话状态。
753 *
754 * @param userOpenId
755 * 用户的openid
756 * @return 会话对象
757 * @throws WeixinException
758 * @see com.foxinmy.weixin4j.mp.api.CustomApi
759 * @see com.foxinmy.weixin4j.mp.model.KfSession
760 * @see <a href=
761 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1458044820&token=&lang=zh_CN">
762 * 获取会话状态</a>
763 */
764 public KfSession getKfSession(String userOpenId) throws WeixinException {
765 return customApi.getKfSession(userOpenId);
766 }
767
768 /**
769 * 获取客服的会话列表:获取某个客服正在接待的会话列表。
770 *
771 * @param kfAccount
772 * 完整客服账号,格式为:账号前缀@公众号微信号,账号前缀最多10个字符,必须是英文或者数字字符。
773 * @return 会话列表
774 * @throws WeixinException
775 * @see com.foxinmy.weixin4j.mp.api.CustomApi
776 * @see com.foxinmy.weixin4j.mp.model.KfSession
777 * @see <a href=
778 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1458044820&token=&lang=zh_CN">
779 * 获取客服的会话列表</a>
780 */
781 public List<KfSession> listKfSession(String kfAccount) throws WeixinException {
782 return customApi.listKfSession(kfAccount);
783 }
784
785 /**
786 * 获取未接入会话列表:获取当前正在等待队列中的会话列表,此接口最多返回最早进入队列的100个未接入会话
787 *
788 * @return 会话列表
789 * @throws WeixinException
790 * @see com.foxinmy.weixin4j.mp.api.CustomApi
791 * @see com.foxinmy.weixin4j.mp.model.KfSession
792 * @see com.foxinmy.weixin4j.mp.model.KfSession.KfSessionCounter
793 * @see <a href=
794 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1458044820&token=&lang=zh_CN">
795 * 获取客服的会话列表</a>
796 */
797 public KfSessionCounter listKfWaitSession() throws WeixinException {
798 return customApi.listKfWaitSession();
799 }
800
801 /**
802 * 上传群发的图文消息,一个图文消息支持1到10条图文
803 *
804 * @param articles
805 * 图片消息
806 * @return 媒体ID
807 * @throws WeixinException
808 * @see <a href=
809 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140549&token=&lang=zh_CN">
810 * 上传图文素材</a>
811 * @see com.foxinmy.weixin4j.tuple.MpArticle
812 * @see com.foxinmy.weixin4j.mp.api.MassApi
813 */
814 public String uploadMassArticle(List<MpArticle> articles) throws WeixinException {
815 return massApi.uploadArticle(articles);
816 }
817
818 /**
819 * 群发消息
820 * <p>
821 * 在返回成功时,意味着群发任务提交成功,并不意味着此时群发已经结束,所以,仍有可能在后续的发送过程中出现异常情况导致用户未收到消息,
822 * 如消息有时会进行审核、服务器不稳定等,此外,群发任务一般需要较长的时间才能全部发送完毕
823 * </p>
824 *
825 * @param tuple
826 * 消息元件
827 * @param isToAll
828 * 用于设定是否向全部用户发送,值为true或false,选择true该消息群发给所有用户,
829 * 选择false可根据group_id发送给指定群组的用户
830 * @param groupId
831 * 分组ID
832 * @return 第一个元素为消息发送任务的ID,第二个元素为消息的数据ID,该字段只有在群发图文消息时,才会出现,可以用于在图文分析数据接口中
833 * @throws WeixinException
834 * @see com.foxinmy.weixin4j.mp.model.Group
835 * @see com.foxinmy.weixin4j.tuple.Text
836 * @see com.foxinmy.weixin4j.tuple.Image
837 * @see com.foxinmy.weixin4j.tuple.Voice
838 * @see com.foxinmy.weixin4j.tuple.MpVideo
839 * @see com.foxinmy.weixin4j.tuple.MpNews
840 * @see com.foxinmy.weixin4j.mp.api.MassApi
841 * @see com.foxinmy.weixin4j.tuple.MassTuple
842 * @see {@link #getGroups()}
843 * @see <a href=
844 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140549&token=&lang=zh_CN">
845 * 根据分组群发</a>
846 */
847 public String[] massByGroupId(MassTuple tuple, boolean isToAll, int groupId) throws WeixinException {
848 return massApi.massByGroupId(tuple, isToAll, groupId);
849 }
850
851 /**
852 * 分组ID群发图文消息
853 *
854 * @param articles
855 * 图文列表
856 * @param groupId
857 * 分组ID
858 * @return 第一个元素为消息发送任务的ID,第二个元素为消息的数据ID,该字段只有在群发图文消息时,才会出现,可以用于在图文分析数据接口中
859 * @see {@link #massByGroupId(MassTuple,boolean,int)}
860 * @see <a href=
861 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140549&token=&lang=zh_CN">
862 * 根据分组群发</a>
863 * @see com.foxinmy.weixin4j.tuple.MpArticle
864 * @throws WeixinException
865 */
866 public String[] massArticleByGroupId(List<MpArticle> articles, int groupId) throws WeixinException {
867 return massApi.massArticleByGroupId(articles, groupId);
868 }
869
870 /**
871 * 群发消息给所有粉丝
872 *
873 * @param tuple
874 * 消息元件
875 * @return 第一个元素为消息发送任务的ID,第二个元素为消息的数据ID,该字段只有在群发图文消息时,才会出现,可以用于在图文分析数据接口中
876 * @throws WeixinException
877 * @see com.foxinmy.weixin4j.mp.api.MassApi
878 * @see <a href=
879 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140549&token=&lang=zh_CN">
880 * 根据标签群发</a>
881 */
882 public String[] massToAll(MassTuple tuple) throws WeixinException {
883 return massApi.massToAll(tuple);
884 }
885
886 /**
887 * 标签群发消息
888 *
889 * @param tuple
890 * 消息元件
891 * @param tagId
892 * 标签ID
893 * @return 第一个元素为消息发送任务的ID,第二个元素为消息的数据ID,该字段只有在群发图文消息时,才会出现,可以用于在图文分析数据接口中
894 * @throws WeixinException
895 * @see Tag
896 * @see {@link TagApi#listTags()}
897 * @see com.foxinmy.weixin4j.mp.api.MassApi
898 * @see <a href=
899 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140549&token=&lang=zh_CN">
900 * 根据标签群发</a>
901 */
902 public String[] massByTagId(MassTuple tuple, int tagId) throws WeixinException {
903 return massApi.massByTagId(tuple, tagId);
904 }
905
906 /**
907 * 标签群发图文消息
908 *
909 * @param articles
910 * 图文列表
911 * @param tagId
912 * 标签ID
913 * @param ignoreReprint
914 * 图文消息被判定为转载时,是否继续群发
915 * @return 第一个元素为消息发送任务的ID,第二个元素为消息的数据ID,该字段只有在群发图文消息时,才会出现。
916 * @see <a href=
917 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140549&token=&lang=zh_CN">
918 * 根据标签群发</a>
919 * @see {@link #massByTagId(MassTuple,int)}
920 * @see com.foxinmy.weixin4j.tuple.MpArticle
921 * @see com.foxinmy.weixin4j.mp.api.MassApi
922 * @throws WeixinException
923 */
924 public String[] massArticleByTagId(List<MpArticle> articles, int tagId, boolean ignoreReprint)
925 throws WeixinException {
926 return massApi.massArticleByTagId(articles, tagId, ignoreReprint);
927 }
928
929 /**
930 * openId群发消息
931 *
932 * @param tuple
933 * 消息元件
934 * @param openIds
935 * openId列表
936 * @return 第一个元素为消息发送任务的ID,第二个元素为消息的数据ID,该字段只有在群发图文消息时,才会出现,可以用于在图文分析数据接口中
937 * @throws WeixinException
938 * @see <a href=
939 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140549&token=&lang=zh_CN">
940 * 根据openid群发</a>
941 * @see {@link UserApi#getUser(String)}
942 * @see com.foxinmy.weixin4j.mp.api.MassApi
943 */
944 public String[] massByOpenIds(MassTuple tuple, String... openIds) throws WeixinException {
945 return massApi.massByOpenIds(tuple, openIds);
946 }
947
948 /**
949 * openid群发图文消息
950 *
951 * @param articles
952 * 图文列表
953 * @param ignoreReprint
954 * 图文消息被判定为转载时,是否继续群发
955 * @param openIds
956 * openId列表
957 * @return 第一个元素为消息发送任务的ID,第二个元素为消息的数据ID,该字段只有在群发图文消息时,才会出现,可以用于在图文分析数据接口中.
958 * @see <a href=
959 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140549&token=&lang=zh_CN">
960 * 根据openid群发</a>
961 * @see {@link #massByOpenIds(MassTuple,String...)}
962 * @see com.foxinmy.weixin4j.tuple.MpArticle
963 * @see com.foxinmy.weixin4j.mp.api.MassApi
964 * @throws WeixinException
965 */
966 public String[] massArticleByOpenIds(List<MpArticle> articles, boolean ignoreReprint, String... openIds)
967 throws WeixinException {
968 return massApi.massArticleByOpenIds(articles, ignoreReprint, openIds);
969 }
970
971 /**
972 * 删除群发消息
973 *
974 * @param msgid
975 * 发送出去的消息ID
976 * @throws WeixinException
977 * @see <a href=
978 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140549&token=&lang=zh_CN">
979 * 删除群发</a>
980 * @see #deleteMassNews(String, int)
981 * @see com.foxinmy.weixin4j.mp.api.MassApi
982 */
983 public ApiResult deleteMassNews(String msgid) throws WeixinException {
984 return massApi.deleteMassNews(msgid);
985 }
986
987 /**
988 * 删除群发消息
989 * <p>
990 * 请注意,只有已经发送成功的消息才能删除删除消息只是将消息的图文详情页失效,已经收到的用户,还是能在其本地看到消息卡片
991 * </p>
992 *
993 * @param msgid
994 * 发送出去的消息ID
995 * @param articleIndex
996 * 要删除的文章在图文消息中的位置,第一篇编号为1,该字段不填或填0会删除全部文章
997 * @throws WeixinException
998 * @see <a href=
999 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140549&token=&lang=zh_CN">
1000 * 删除群发</a>
1001 * @see {@link #massByTagId(MassTuple, int)}
1002 * @see {@link #massByOpenIds(MassTuple, String...)
1003 * @see com.foxinmy.weixin4j.mp.api.MassApi
1004 */
1005 public ApiResult deleteMassNews(String msgid, int articleIndex) throws WeixinException {
1006 return massApi.deleteMassNews(msgid, articleIndex);
1007 }
1008
1009 /**
1010 * 预览群发消息</br>
1011 * 开发者可通过该接口发送消息给指定用户,在手机端查看消息的样式和排版
1012 *
1013 * @param toUser
1014 * 接收用户的openID
1015 * @param toWxName
1016 * 接收用户的微信号 towxname和touser同时赋值时,以towxname优先
1017 * @param tuple
1018 * 消息元件
1019 * @return 处理结果
1020 * @throws WeixinException
1021 * @see com.foxinmy.weixin4j.mp.api.MassApi
1022 * @see com.foxinmy.weixin4j.tuple.MassTuple
1023 * @see <a href=
1024 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140549&token=&lang=zh_CN">
1025 * 预览群发消息</a>
1026 */
1027 public ApiResult previewMassNews(String toUser, String toWxName, MassTuple tuple) throws WeixinException {
1028 return massApi.previewMassNews(toUser, toWxName, tuple);
1029 }
1030
1031 /**
1032 * 查询群发发送状态
1033 *
1034 * @param msgId
1035 * 消息ID
1036 * @return 消息发送状态
1037 * @throws WeixinException
1038 * @see com.foxinmy.weixin4j.mp.api.MassApi
1039 * @see <a href=
1040 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140549&token=&lang=zh_CN">
1041 * 查询群发状态</a>
1042 */
1043 public String getMassNewStatus(String msgId) throws WeixinException {
1044 return massApi.getMassNewStatus(msgId);
1045 }
1046
1047 /**
1048 * 获取用户信息
1049 *
1050 * @param openId
1051 * 用户对应的ID
1052 * @return 用户对象
1053 * @throws WeixinException
1054 * @see <a href=
1055 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140839&token=&lang=zh_CN">
1056 * 获取用户信息</a>
1057 * @see com.foxinmy.weixin4j.mp.model.User
1058 * @see com.foxinmy.weixin4j.mp.api.UserApi
1059 * @see {@link #getUser(String,Lang)}
1060 */
1061 public User getUser(String openId) throws WeixinException {
1062 return userApi.getUser(openId);
1063 }
1064
1065 /**
1066 * 获取用户信息
1067 * <p>
1068 * 在关注者与公众号产生消息交互后,公众号可获得关注者的OpenID(加密后的微信号,每个用户对每个公众号的OpenID是唯一的,对于不同公众号,
1069 * 同一用户的openid不同),公众号可通过本接口来根据OpenID获取用户基本信息,包括昵称、头像、性别、所在城市、语言和关注时间
1070 * </p>
1071 *
1072 * @param openId
1073 * 用户对应的ID
1074 * @param lang
1075 * 国家地区语言版本
1076 * @return 用户对象
1077 * @throws WeixinException
1078 * @see <a href=
1079 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140839&token=&lang=zh_CN">
1080 * 获取用户信息</a>
1081 * @see com.foxinmy.weixin4j.mp.type.Lang
1082 * @see com.foxinmy.weixin4j.mp.model.User
1083 * @see com.foxinmy.weixin4j.mp.api.UserApi
1084 */
1085 public User getUser(String openId, Lang lang) throws WeixinException {
1086 return userApi.getUser(openId, lang);
1087 }
1088
1089 /**
1090 * 批量获取用户信息
1091 *
1092 * @param openIds
1093 * 用户ID
1094 * @return 用户列表
1095 * @see <a href=
1096 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140839&token=&lang=zh_CN">
1097 * 获取用户信息</a>
1098 * @see com.foxinmy.weixin4j.mp.model.User
1099 * @see com.foxinmy.weixin4j.mp.api.UserApi
1100 * @throws WeixinException
1101 * @see {@link #getUsers(Lang,String[])}
1102 */
1103 public List<User> getUsers(String... openIds) throws WeixinException {
1104 return userApi.getUsers(openIds);
1105 }
1106
1107 /**
1108 * 批量获取用户信息
1109 *
1110 * @param lang
1111 * 国家地区语言版本
1112 * @param openIds
1113 * 用户ID
1114 * @return 用户列表
1115 * @see <a href=
1116 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140839&token=&lang=zh_CN">
1117 * 获取用户信息</a>
1118 * @see com.foxinmy.weixin4j.mp.type.Lang
1119 * @see com.foxinmy.weixin4j.mp.model.User
1120 * @see com.foxinmy.weixin4j.mp.api.UserApi
1121 * @throws WeixinException
1122 */
1123 public List<User> getUsers(Lang lang, String... openIds) throws WeixinException {
1124 return userApi.getUsers(lang, openIds);
1125 }
1126
1127 /**
1128 * 获取公众号一定数量(10000)的关注者列表 <font corlor="red">请慎重使用</font>
1129 *
1130 * @param nextOpenId
1131 * 下一次拉取数据的openid 不填写则默认从头开始拉取
1132 * @return 关注者信息 <font color="red">包含用户的详细信息</font>
1133 * @throws WeixinException
1134 * @see <a href=
1135 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140839&token=&lang=zh_CN">
1136 * 获取关注者列表</a>
1137 * @see <a href=
1138 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140840&token=&lang=zh_CN">
1139 * 批量获取用户信息</a>
1140 * @see com.foxinmy.weixin4j.mp.api.UserApi
1141 * @see com.foxinmy.weixin4j.mp.model.Following
1142 * @see com.foxinmy.weixin4j.mp.model.User
1143 */
1144 public Following getFollowing(String nextOpenId) throws WeixinException {
1145 return userApi.getFollowing(nextOpenId);
1146 }
1147
1148 /**
1149 * 获取公众号一定数量(10000)的关注者列表
1150 *
1151 * @param nextOpenId
1152 * 下一次拉取数据的openid 不填写则默认从头开始拉取
1153 * @return 关注者信息 <font color="red">不包含用户的详细信息</font>
1154 * @throws WeixinException
1155 * @see <a href=
1156 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140840&token=&lang=zh_CN">
1157 * 获取关注者列表</a>
1158 * @see com.foxinmy.weixin4j.mp.api.UserApi
1159 * @see com.foxinmy.weixin4j.mp.model.Following
1160 */
1161 public Following getFollowingOpenIds(String nextOpenId) throws WeixinException {
1162 return userApi.getFollowingOpenIds(nextOpenId);
1163 }
1164
1165 /**
1166 * 获取公众号全部的关注者列表 <font corlor="red">请慎重使用</font>
1167 * <p>
1168 * 当公众号关注者数量超过10000时,可通过填写next_openid的值,从而多次拉取列表的方式来满足需求,
1169 * 将上一次调用得到的返回中的next_openid值,作为下一次调用中的next_openid值
1170 * </p>
1171 *
1172 * @return 用户对象集合
1173 * @throws WeixinException
1174 * @see <a href=
1175 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140840&token=&lang=zh_CN">
1176 * 获取关注者列表</a>
1177 * @see <a href=
1178 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140839&token=&lang=zh_CN">
1179 * 批量获取用户信息</a>
1180 * @see com.foxinmy.weixin4j.mp.api.UserApi
1181 * @see com.foxinmy.weixin4j.mp.model.Following
1182 * @see com.foxinmy.weixin4j.mp.model.User
1183 * @see #getFollowing(String)
1184 */
1185 public List<User> getAllFollowing() throws WeixinException {
1186 return userApi.getAllFollowing();
1187 }
1188
1189 /**
1190 * 获取公众号全部的关注者列表 <font corlor="red">请慎重使用</font>
1191 * <p>
1192 * 当公众号关注者数量超过10000时,可通过填写next_openid的值,从而多次拉取列表的方式来满足需求,
1193 * 将上一次调用得到的返回中的next_openid值,作为下一次调用中的next_openid值
1194 * </p>
1195 *
1196 * @return 用户openid集合
1197 * @throws WeixinException
1198 * @see <a href=
1199 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140840&token=&lang=zh_CN">
1200 * 获取关注者列表</a>
1201 * @see com.foxinmy.weixin4j.mp.api.UserApi
1202 * @see #getFollowingOpenIds(String)
1203 */
1204 public List<String> getAllFollowingOpenIds() throws WeixinException {
1205 return userApi.getAllFollowingOpenIds();
1206 }
1207
1208 /**
1209 * 设置用户备注名
1210 *
1211 * @param openId
1212 * 用户ID
1213 * @param remark
1214 * 备注名
1215 * @throws WeixinException
1216 * @see <a href=
1217 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140838&token=&lang=zh_CN">
1218 * 设置用户备注名</a>
1219 * @see com.foxinmy.weixin4j.mp.api.UserApi
1220 */
1221 public ApiResult remarkUserName(String openId, String remark) throws WeixinException {
1222 return userApi.remarkUserName(openId, remark);
1223 }
1224
1225 /**
1226 * 公众号迁移批量转换openid
1227 *
1228 * @param fromAppid 原账号ID
1229 * @param openIds 原账号openid列表,最多不能超过100个
1230 * @return 转换后的openid
1231 * @throws WeixinException
1232 * @see <a href="https://kf.qq.com/faq/1901177NrqMr190117nqYJze.html">openid转换</a>
1233 * @see com.foxinmy.weixin4j.mp.model.ChangeOpenidResult
1234 * @see com.foxinmy.weixin4j.mp.api.UserApi
1235 */
1236 public List<ChangeOpenidResult> batchChangeOpenid(String fromAppid, List<String> openIds) throws WeixinException {
1237 return userApi.batchChangeOpenid(fromAppid,openIds);
1238 }
1239
1240 /**
1241 * 公众号迁移转换所有openid
1242 *
1243 * @param fromAppid 新appid
1244 * @return 转换后的openid
1245 * @throws WeixinException
1246 * @see <a href="https://kf.qq.com/faq/1901177NrqMr190117nqYJze.html">openid转换</a>
1247 * @see com.foxinmy.weixin4j.mp.model.ChangeOpenidResult
1248 * @see com.foxinmy.weixin4j.mp.api.UserApi
1249 */
1250 public List<ChangeOpenidResult> changeAllOpenid(String fromAppid) throws WeixinException {
1251 return userApi.changeAllOpenid(fromAppid);
1252 }
1253
1254 /**
1255 * 创建分组
1256 *
1257 * @param name
1258 * 组名称
1259 * @return group对象
1260 * @throws WeixinException
1261 * @see <a href=
1262 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140837&token=&lang=zh_CN">
1263 * 创建分组</a>
1264 * @see com.foxinmy.weixin4j.mp.model.Group
1265 * @see com.foxinmy.weixin4j.mp.model.Group#toCreateJson()
1266 * @see com.foxinmy.weixin4j.mp.api.GroupApi
1267 */
1268 public Group createGroup(String name) throws WeixinException {
1269 return groupApi.createGroup(name);
1270 }
1271
1272 /**
1273 * 查询所有分组
1274 *
1275 * @return 组集合
1276 * @throws WeixinException
1277 * @see <a href=
1278 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140837&token=&lang=zh_CN">
1279 * 查询所有分组</a>
1280 * @see com.foxinmy.weixin4j.mp.model.Group
1281 * @see com.foxinmy.weixin4j.mp.api.GroupApi
1282 */
1283 public List<Group> getGroups() throws WeixinException {
1284 return groupApi.getGroups();
1285 }
1286
1287 /**
1288 * 查询用户所在分组
1289 *
1290 * @param openId
1291 * 用户对应的ID
1292 * @return 组ID
1293 * @throws WeixinException
1294 * @see <a href=
1295 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140837&token=&lang=zh_CN">
1296 * 查询用户所在分组</a>
1297 * @see com.foxinmy.weixin4j.mp.model.Group
1298 * @see com.foxinmy.weixin4j.mp.api.GroupApi
1299 */
1300 public int getGroupByOpenId(String openId) throws WeixinException {
1301 return groupApi.getGroupByOpenId(openId);
1302 }
1303
1304 /**
1305 * 修改分组名
1306 *
1307 * @param groupId
1308 * 组ID
1309 * @param name
1310 * 组名称
1311 * @throws WeixinException
1312 * @see <a href=
1313 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140837&token=&lang=zh_CN">
1314 * 修改分组名</a>
1315 * @see com.foxinmy.weixin4j.mp.model.Group
1316 * @see com.foxinmy.weixin4j.mp.api.GroupApi
1317 */
1318 public ApiResult modifyGroup(int groupId, String name) throws WeixinException {
1319 return groupApi.modifyGroup(groupId, name);
1320 }
1321
1322 /**
1323 * 移动用户到分组
1324 *
1325 * @param groupId
1326 * 组ID
1327 * @param openId
1328 * 用户对应的ID
1329 * @throws WeixinException
1330 * @see <a href=
1331 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140837&token=&lang=zh_CN4">
1332 * 移动分组</a>
1333 * @see com.foxinmy.weixin4j.mp.model.Group
1334 * @see com.foxinmy.weixin4j.mp.api.GroupApi
1335 */
1336 public ApiResult moveGroup(int groupId, String openId) throws WeixinException {
1337 return groupApi.moveGroup(groupId, openId);
1338 }
1339
1340 /**
1341 * 批量移动分组
1342 *
1343 * @param groupId
1344 * 组ID
1345 * @param openIds
1346 * 用户ID列表(不能超过50个)
1347 * @throws WeixinException
1348 * @see <a href=
1349 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140837&token=&lang=zh_CN">
1350 * 批量移动分组</a>
1351 * @see com.foxinmy.weixin4j.mp.model.Group
1352 * @see com.foxinmy.weixin4j.mp.api.GroupApi
1353 */
1354 public ApiResult moveGroup(int groupId, String... openIds) throws WeixinException {
1355 return groupApi.moveGroup(groupId, openIds);
1356 }
1357
1358 /**
1359 * 删除用户分组,所有该分组内的用户自动进入默认分组.
1360 *
1361 * @param groupId
1362 * 组ID
1363 * @throws WeixinException
1364 * @see <a href=
1365 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140837&token=&lang=zh_CN">
1366 * 删除用户分组</a>
1367 * @see com.foxinmy.weixin4j.mp.model.Group
1368 * @see com.foxinmy.weixin4j.mp.api.GroupApi
1369 */
1370 public ApiResult deleteGroup(int groupId) throws WeixinException {
1371 return groupApi.deleteGroup(groupId);
1372 }
1373
1374 /**
1375 * 自定义菜单
1376 *
1377 * @param buttons
1378 * 菜单列表
1379 * @throws WeixinException
1380 * @see <a href=
1381 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141013&token=&lang=zh_CN">
1382 * 创建自定义菜单</a>
1383 * @see com.foxinmy.weixin4j.model.Button
1384 * @see com.foxinmy.weixin4j.type.ButtonType
1385 * @see com.foxinmy.weixin4j.mp.api.MenuApi
1386 */
1387 public ApiResult createMenu(List<Button> buttons) throws WeixinException {
1388 return menuApi.createMenu(buttons);
1389 }
1390
1391 /**
1392 * 查询菜单
1393 *
1394 * @return 菜单集合
1395 * @throws WeixinException
1396 * @see <a href=
1397 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141014&token=&lang=zh_CN">
1398 * 查询菜单</a>
1399 * @see com.foxinmy.weixin4j.model.Button
1400 * @see com.foxinmy.weixin4j.mp.api.MenuApi
1401 */
1402 public List<Button> getMenu() throws WeixinException {
1403 return menuApi.getMenu();
1404 }
1405
1406 /**
1407 * 查询全部菜单(包含个性化菜单)
1408 *
1409 * @return 菜单集合
1410 * @throws WeixinException
1411 * @see <a href=
1412 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141014&token=&lang=zh_CN">
1413 * 普通菜单</a>
1414 * @see <a href=
1415 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1455782296&token=&lang=zh_CN">
1416 * 个性化菜单</a>
1417 * @see com.foxinmy.weixin4j.model.Button
1418 * @see com.foxinmy.weixin4j.mp.model.Menu
1419 * @see com.foxinmy.weixin4j.mp.api.MenuApi
1420 */
1421 public List<Menu> getAllMenu() throws WeixinException {
1422 return menuApi.getAllMenu();
1423 }
1424
1425 /**
1426 * 删除菜单
1427 *
1428 * @throws WeixinException
1429 * @see <a href=
1430 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141015&token=&lang=zh_CN">
1431 * 删除菜单</a>
1432 * @see com.foxinmy.weixin4j.mp.api.MenuApi
1433 * @return 处理结果
1434 */
1435 public ApiResult deleteMenu() throws WeixinException {
1436 return menuApi.deleteMenu();
1437 }
1438
1439 /**
1440 * 创建个性化菜单
1441 *
1442 * @param buttons
1443 * 菜单列表
1444 * @param matchRule
1445 * 匹配规则 至少要有一个匹配信息是不为空
1446 * @return 菜单ID
1447 * @throws WeixinException
1448 * @see <a href=
1449 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1455782296&token=&lang=zh_CN">
1450 * 创建个性化菜单</a>
1451 * @see com.foxinmy.weixin4j.mp.api.MenuApi
1452 * @see com.foxinmy.weixin4j.model.Button
1453 */
1454 public String createCustomMenu(List<Button> buttons, MenuMatchRule matchRule) throws WeixinException {
1455 return menuApi.createCustomMenu(buttons, matchRule);
1456 }
1457
1458 /**
1459 * 删除个性化菜单
1460 *
1461 * @throws WeixinException
1462 * @see <a href=
1463 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1455782296&token=&lang=zh_CN">
1464 * 删除个性化菜单</a>
1465 * @see com.foxinmy.weixin4j.mp.api.MenuApi
1466 * @return 处理结果
1467 */
1468 public ApiResult deleteCustomMenu(String menuId) throws WeixinException {
1469 return menuApi.deleteCustomMenu(menuId);
1470 }
1471
1472 /**
1473 * 测试个性化菜单匹配结果
1474 *
1475 * @param userId
1476 * 可以是粉丝的OpenID,也可以是粉丝的微信号。
1477 * @see <a href=
1478 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1455782296&token=&lang=zh_CN">
1479 * 测试个性化菜单</a>
1480 * @see com.foxinmy.weixin4j.model.Button
1481 * @see com.foxinmy.weixin4j.mp.api.MenuApi
1482 * @throws WeixinException
1483 * @return 匹配到的菜单配置
1484 */
1485 public List<Button> matchCustomMenu(String userId) throws WeixinException {
1486 return menuApi.matchCustomMenu(userId);
1487 }
1488
1489 /**
1490 * 生成带参数的二维码
1491 *
1492 * @param parameter
1493 * 二维码参数
1494 * @return 二维码结果对象
1495 * @throws WeixinException
1496 * @see com.foxinmy.weixin4j.model.qr.QRResult
1497 * @see com.foxinmy.weixin4j.model.qr.QRParameter
1498 * @see com.foxinmy.weixin4j.mp.api.QrApi
1499 * @see <a href=
1500 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1443433542&token=&lang=zh_CN">
1501 * 生成二维码</a>
1502 */
1503 public QRResult createQR(QRParameter parameter) throws WeixinException {
1504 return qrApi.createQR(parameter);
1505 }
1506
1507 /**
1508 * 设置所属行业(每月可修改行业1次,账号仅可使用所属行业中相关的模板)
1509 *
1510 * @param industryTypes
1511 * 所处行业 目前不超过两个
1512 * @return 操作结果
1513 * @throws WeixinException
1514 * @see com.foxinmy.weixin4j.mp.type.IndustryType
1515 * @see com.foxinmy.weixin4j.mp.api.TmplApi
1516 * @see <a href=
1517 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1433751277&token=&lang=zh_CN">
1518 * 设置所处行业</a>
1519 */
1520 public ApiResult setTmplIndustry(IndustryType... industryTypes) throws WeixinException {
1521 return tmplApi.setTmplIndustry(industryTypes);
1522 }
1523
1524 /**
1525 * 获取模板ID
1526 *
1527 * @param shortId
1528 * 模板库中模板的编号,有“TM**”和“OPENTMTM**”等形式
1529 * @return 模板ID
1530 * @throws WeixinException
1531 * @see <a href=
1532 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1433751277&token=&lang=zh_CN">
1533 * 获得模板ID</a>
1534 * @see com.foxinmy.weixin4j.mp.api.TmplApi
1535 */
1536 public String getTemplateId(String shortId) throws WeixinException {
1537 return tmplApi.getTemplateId(shortId);
1538 }
1539
1540 /**
1541 * 获取模板列表
1542 *
1543 * @return 模板列表
1544 * @see com.foxinmy.weixin4j.mp.model.TemplateMessageInfo
1545 * @see <a href=
1546 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1433751277&token=&lang=zh_CN">
1547 * 获取模板列表</a>
1548 * @see com.foxinmy.weixin4j.mp.api.TmplApi
1549 * @throws WeixinException
1550 */
1551 public List<TemplateMessageInfo> getAllTemplates() throws WeixinException {
1552 return tmplApi.getAllTemplates();
1553 }
1554
1555 /**
1556 * 删除模板
1557 *
1558 * @param templateId
1559 * 公众帐号下模板消息ID
1560 * @return 处理结果
1561 * @see <a href=
1562 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1433751277&token=&lang=zh_CN">
1563 * 删除模板</a>
1564 * @see com.foxinmy.weixin4j.mp.api.TmplApi
1565 * @throws WeixinException
1566 */
1567 public ApiResult deleteTemplate(String templateId) throws WeixinException {
1568 return tmplApi.deleteTemplate(templateId);
1569 }
1570
1571 /**
1572 * 发送模板消息
1573 *
1574 * @param tplMessage
1575 * 模板消息主体
1576 * @return 发送的消息ID
1577 * @throws WeixinException
1578 * @see <a href=
1579 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1433751277&token=&lang=zh_CN">
1580 * 模板消息</a>
1581 * @see <a href=
1582 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1433751288&token=&lang=zh_CN"
1583 * >运营规范</a>
1584 * @see com.foxinmy.weixin4j.mp.message.TemplateMessage
1585 * @seee com.foxinmy.weixin4j.msg.event.TemplatesendjobfinishMessage
1586 * @see com.foxinmy.weixin4j.mp.api.TmplApi
1587 */
1588 public String sendTmplMessage(TemplateMessage tplMessage) throws WeixinException {
1589 return tmplApi.sendTmplMessage(tplMessage);
1590 }
1591
1592 /**
1593 * 长链接转短链接
1594 *
1595 * @param url
1596 * 待转换的链接
1597 * @return 短链接
1598 * @throws WeixinException
1599 * @see <a href=
1600 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1443433600&token=&lang=zh_CN">
1601 * 长链接转短链接</a>
1602 * @see com.foxinmy.weixin4j.mp.api.HelperApi
1603 */
1604 public String getShorturl(String url) throws WeixinException {
1605 return helperApi.getShorturl(url);
1606 }
1607
1608 /**
1609 * 语义理解
1610 *
1611 * @param semQuery
1612 * 语义理解协议
1613 * @return 语义理解结果
1614 * @see com.foxinmy.weixin4j.mp.model.SemQuery
1615 * @see com.foxinmy.weixin4j.mp.model.SemResult
1616 * @see <a href=
1617 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141241&token=&lang=zh_CN">
1618 * 语义理解</a>
1619 * @see com.foxinmy.weixin4j.mp.api.HelperApi
1620 * @throws WeixinException
1621 */
1622 public SemResult semantic(SemQuery semQuery) throws WeixinException {
1623 return helperApi.semantic(semQuery);
1624 }
1625
1626 /**
1627 * 获取微信服务器IP地址
1628 *
1629 * @return IP地址
1630 * @see <a href=
1631 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140187&token=&lang=zh_CN">
1632 * 获取IP地址</a>
1633 * @see com.foxinmy.weixin4j.mp.api.HelperApi
1634 * @throws WeixinException
1635 */
1636 public List<String> getWechatServerIp() throws WeixinException {
1637 return helperApi.getWechatServerIp();
1638 }
1639
1640 /**
1641 * 接口调用次数调用清零:公众号调用接口并不是无限制的。为了防止公众号的程序错误而引发微信服务器负载异常,默认情况下,
1642 * 每个公众号调用接口都不能超过一定限制 ,当超过一定限制时,调用对应接口会收到{"errcode":45009,"errmsg":"api freq
1643 * out of limit" }错误返回码。
1644 *
1645 * @see <a href=
1646 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1433744592&token=&lang=zh_CN">
1647 * 接口清零</a>
1648 * @see com.foxinmy.weixin4j.mp.api.HelperApi
1649 * @return 操作结果
1650 * @throws WeixinException
1651 */
1652 public ApiResult clearQuota() throws WeixinException {
1653 return helperApi.clearQuota(weixinAccount.getId());
1654 }
1655
1656 /**
1657 * 获取公众号当前使用的自定义菜单的配置,如果公众号是通过API调用设置的菜单,则返回菜单的开发配置,
1658 * 而如果公众号是在公众平台官网通过网站功能发布菜单,则本接口返回运营者设置的菜单配置。
1659 *
1660 * @return 菜单集合
1661 * @see {@link #getMenu()}
1662 * @see <a href=
1663 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1434698695&token=&lang=zh_CN">
1664 * 获取自定义菜单配置</a>
1665 * @see com.foxinmy.weixin4j.model.Button
1666 * @se com.foxinmy.weixin4j.mp.model.MenuSetting
1667 * @see com.foxinmy.weixin4j.tuple.MpArticle
1668 * @see com.foxinmy.weixin4j.mp.api.HelperApi
1669 * @throws WeixinException
1670 */
1671 public MenuSetting getMenuSetting() throws WeixinException {
1672 return helperApi.getMenuSetting();
1673 }
1674
1675 /**
1676 * 获取公众号当前使用的自动回复规则,包括关注后自动回复、消息自动回复(60分钟内触发一次)、关键词自动回复。
1677 *
1678 * @see com.foxinmy.weixin4j.mp.model.AutoReplySetting
1679 * @see com.foxinmy.weixin4j.mp.api.HelperApi
1680 * @see <a href=
1681 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1433751299&token=&lang=zh_CN">
1682 * 获取自动回复规则</a>
1683 * @throws WeixinException
1684 */
1685 public AutoReplySetting getAutoReplySetting() throws WeixinException {
1686 return helperApi.getAutoReplySetting();
1687 }
1688
1689 /**
1690 * 数据统计
1691 *
1692 * @param datacubeType
1693 * 数据统计类型
1694 * @param beginDate
1695 * 获取数据的起始日期,begin_date和end_date的差值需小于“最大时间跨度”(比如最大时间跨度为1时,
1696 * begin_date和end_date的差值只能为0,才能小于1),否则会报错
1697 * @param endDate
1698 * 获取数据的结束日期,end_date允许设置的最大值为昨日
1699 * @see com.foxinmy.weixin4j.mp.api.DataApi
1700 * @see com.foxinmy.weixin4j.mp.datacube.UserSummary
1701 * @see com.foxinmy.weixin4j.mp.datacube.ArticleSummary
1702 * @see com.foxinmy.weixin4j.mp.datacube.ArticleTotal
1703 * @see com.foxinmy.weixin4j.mp.datacube.ArticleDatacubeShare
1704 * @see com.foxinmy.weixin4j.mp.datacube.UpstreamMsg
1705 * @see com.foxinmy.weixin4j.mp.datacube.UpstreamMsgDist
1706 * @see com.foxinmy.weixin4j.mp.datacube.InterfaceSummary
1707 * @return 统计结果
1708 * @see <a href=
1709 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141082&token=&lang=zh_CN">
1710 * 用户分析</a>
1711 * @see <a href=
1712 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141084&token=&lang=zh_CN">
1713 * 图文分析</a>
1714 * @see <a href=
1715 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141085&token=&lang=zh_CN">
1716 * 消息分析</a>
1717 * @see <a href=
1718 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141086&token=&lang=zh_CN">
1719 * 接口分析</a>
1720 * @throws WeixinException
1721 */
1722 public List<?> datacube(DatacubeType datacubeType, Date beginDate, Date endDate) throws WeixinException {
1723 return dataApi.datacube(datacubeType, beginDate, endDate);
1724 }
1725
1726 /**
1727 * 数据统计
1728 *
1729 * @param datacubeType
1730 * 统计类型
1731 * @param beginDate
1732 * 开始日期
1733 * @param offset
1734 * 增量 表示向前几天 比如 offset=1 则查询 beginDate的后一天之间的数据
1735 * @see {@link #datacube(DatacubeType, Date,Date)}
1736 * @see com.foxinmy.weixin4j.mp.api.DataApi
1737 * @throws WeixinException
1738 */
1739 public List<?> datacube(DatacubeType datacubeType, Date beginDate, int offset) throws WeixinException {
1740 return dataApi.datacube(datacubeType, beginDate, offset);
1741 }
1742
1743 /**
1744 * 数据统计
1745 *
1746 * @param datacubeType
1747 * 统计类型
1748 * @param offset
1749 * 增量 表示向后几天 比如 offset=1 则查询 beginDate的前一天之间的数据
1750 * @param endDate
1751 * 截至日期
1752 * @see {@link #datacube(DatacubeType, Date,Date)}
1753 * @see com.foxinmy.weixin4j.mp.api.DataApi
1754 * @throws WeixinException
1755 */
1756 public List<?> datacube(DatacubeType datacubeType, int offset, Date endDate) throws WeixinException {
1757 return dataApi.datacube(datacubeType, offset, endDate);
1758 }
1759
1760 /**
1761 * 查询日期跨度为0的统计数据(当天)
1762 *
1763 * @param datacubeType
1764 * 统计类型
1765 * @param date
1766 * 统计日期
1767 * @see {@link #datacube(DatacubeType, Date,Date)}
1768 * @see com.foxinmy.weixin4j.mp.api.DataApi
1769 * @throws WeixinException
1770 */
1771 public List<?> datacube(DatacubeType datacubeType, Date date) throws WeixinException {
1772 return dataApi.datacube(datacubeType, date);
1773 }
1774
1775 /**
1776 * 创建标签
1777 *
1778 * @param name
1779 * 标签名(30个字符以内)
1780 * @return 标签对象
1781 * @throws WeixinException
1782 * @see com.foxinmy.weixin4j.mp.api.TagApi
1783 * @see com.foxinmy.weixin4j.mp.model.Tag
1784 * @see <a href=
1785 * "http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140837&token=&lang=zh_CN">
1786 * 创建标签</a>
1787 */
1788 public Tag createTag(String name) throws WeixinException {
1789 return tagApi.createTag(name);
1790 }
1791
1792 /**
1793 * 获取标签
1794 *
1795 * @return 标签列表
1796 * @throws WeixinException
1797 * @see com.foxinmy.weixin4j.mp.api.TagApi
1798 * @see com.foxinmy.weixin4j.mp.model.Tag
1799 * @see <a href=
1800 * "http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140837&token=&lang=zh_CN">
1801 * 获取标签</a>
1802 */
1803 public List<Tag> listTags() throws WeixinException {
1804 return tagApi.listTags();
1805 }
1806
1807 /**
1808 * 更新标签
1809 *
1810 * @param tag
1811 * 标签对象
1812 * @return 操作结果
1813 * @throws WeixinException
1814 * @see com.foxinmy.weixin4j.mp.api.TagApi
1815 * @see com.foxinmy.weixin4j.mp.model.Tag
1816 * @see <a href=
1817 * "http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140837&token=&lang=zh_CN">
1818 * 更新标签</a>
1819 */
1820 public ApiResult updateTag(Tag tag) throws WeixinException {
1821 return tagApi.updateTag(tag);
1822 }
1823
1824 /**
1825 * 删除标签
1826 *
1827 * @param tagId
1828 * 标签id
1829 * @return 操作结果
1830 * @see com.foxinmy.weixin4j.mp.api.TagApi
1831 * @throws WeixinException
1832 * @see <a href=
1833 * "http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140837&token=&lang=zh_CN">
1834 * 删除标签</a>
1835 */
1836 public ApiResult deleteTag(int tagId) throws WeixinException {
1837 return tagApi.deleteTag(tagId);
1838 }
1839
1840 /**
1841 * 批量为用户打标签:标签功能目前支持公众号为用户打上最多三个标签
1842 *
1843 * @param tagId
1844 * 标签ID
1845 * @param openIds
1846 * 用户ID
1847 * @return 操作结果
1848 * @throws WeixinException
1849 * @see com.foxinmy.weixin4j.mp.api.TagApi
1850 * @see <a href=
1851 * "http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140837&token=&lang=zh_CN">
1852 * 批量为用户打标签</a>
1853 */
1854 public ApiResult taggingUsers(int tagId, String... openIds) throws WeixinException {
1855 return tagApi.taggingUsers(tagId, openIds);
1856 }
1857
1858 /**
1859 * 批量为用户取消标签
1860 *
1861 * @param tagId
1862 * 标签ID
1863 * @param openIds
1864 * 用户ID
1865 * @return 操作结果
1866 * @throws WeixinException
1867 * @see com.foxinmy.weixin4j.mp.api.TagApi
1868 * @see <a href=
1869 * "http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140837&token=&lang=zh_CN">
1870 * 批量为用户取消标签</a>
1871 */
1872 public ApiResult untaggingUsers(int tagId, String... openIds) throws WeixinException {
1873 return tagApi.untaggingUsers(tagId, openIds);
1874 }
1875
1876 /**
1877 * 获取标签下粉丝列表
1878 *
1879 * @param tagId
1880 * 标签ID
1881 * @param nextOpenId
1882 * 第一个拉取的OPENID,不填默认从头开始拉取
1883 * @return 用户openid列表
1884 * @throws WeixinException
1885 * @see com.foxinmy.weixin4j.mp.api.TagApi
1886 * @see <a href=
1887 * "http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140837&token=&lang=zh_CN">
1888 * 获取标签下粉丝列表</a>
1889 */
1890 public Following getTagFollowingOpenIds(int tagId, String nextOpenId) throws WeixinException {
1891 return tagApi.getTagFollowingOpenIds(tagId, nextOpenId);
1892 }
1893
1894 /**
1895 * 获取标签下粉丝列表 <font corlor="red">请慎重使用</font>
1896 *
1897 * @param tagId
1898 * 标签ID
1899 * @param nextOpenId
1900 * 第一个拉取的OPENID,不填默认从头开始拉取
1901 * @return 被打标签者信息 <font color="red">包含用户的详细信息</font>
1902 * @throws WeixinException
1903 * @see com.foxinmy.weixin4j.mp.api.TagApi
1904 * @see <a href=
1905 * "http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140837&token=&lang=zh_CN">
1906 * 获取标签下粉丝列表</a>
1907 */
1908 public Following getTagFollowing(int tagId, String nextOpenId) throws WeixinException {
1909 return tagApi.getTagFollowing(tagId, nextOpenId);
1910 }
1911
1912 /**
1913 * 获取标签下全部的粉丝列表 <font corlor="red">请慎重使用</font>
1914 *
1915 * @param tagId
1916 * 标签ID
1917 * @return 用户openid列表
1918 * @throws WeixinException
1919 * @see com.foxinmy.weixin4j.mp.api.TagApi
1920 * @see #getTagFollowingOpenIds(int,String)
1921 * @see <a href=
1922 * "http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140837&token=&lang=zh_CN">
1923 * 获取标签下粉丝列表</a>
1924 */
1925 public List<String> getAllTagFollowingOpenIds(int tagId) throws WeixinException {
1926 return tagApi.getAllTagFollowingOpenIds(tagId);
1927 }
1928
1929 /**
1930 * 获取标签下全部的粉丝列表 <font corlor="red">请慎重使用</font>
1931 *
1932 * @param tagId
1933 * 标签ID
1934 * @return 被打标签者信息 <font color="red">包含用户的详细信息</font>
1935 * @throws WeixinException
1936 * @see com.foxinmy.weixin4j.mp.api.TagApi
1937 * @see #getTagFollowing(int,String)
1938 * @see <a href=
1939 * "http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140837&token=&lang=zh_CN">
1940 * 获取标签下粉丝列表</a>
1941 */
1942 public List<User> getAllTagFollowing(int tagId) throws WeixinException {
1943 return tagApi.getAllTagFollowing(tagId);
1944 }
1945
1946 /**
1947 * 获取用户身上的标签列表
1948 *
1949 * @param openId
1950 * 用户ID
1951 * @return 标签ID集合
1952 * @throws WeixinException
1953 * @see com.foxinmy.weixin4j.mp.api.TagApi
1954 * @see <a href=
1955 * "http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140837&token=&lang=zh_CN">
1956 * 获取用户身上的标签列表</a>
1957 */
1958 public Integer[] getUserTags(String openId) throws WeixinException {
1959 return tagApi.getUserTags(openId);
1960 }
1961
1962 /**
1963 * 获取公众号的黑名单列表
1964 *
1965 * @param nextOpenId
1966 * 下一次拉取数据的openid 不填写则默认从头开始拉取
1967 * @return 拉黑用户列表 <font color="red">不包含用户的详细信息</font>
1968 * @see <a href=
1969 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1471422259_pJMWA&token=&lang=zh_CN"
1970 * >获取黑名单列表</a>
1971 * @see com.foxinmy.weixin4j.mp.api.TagApi
1972 * @see com.foxinmy.weixin4j.mp.model.Following
1973 * @throws WeixinException
1974 */
1975 public Following getBalcklistOpenIds(String nextOpenId) throws WeixinException {
1976 return tagApi.getBalcklistOpenIds(nextOpenId);
1977 }
1978
1979 /**
1980 * 获取公众号全部的黑名单列表 <font corlor="red">请慎重使用</font>
1981 * <p>
1982 * 当公众号关注者数量超过10000时,可通过填写next_openid的值,从而多次拉取列表的方式来满足需求,
1983 * 将上一次调用得到的返回中的next_openid值,作为下一次调用中的next_openid值
1984 * </p>
1985 *
1986 * @return 用户openid集合
1987 * @throws WeixinException
1988 * @see com.foxinmy.weixin4j.mp.api.TagApi
1989 * @see <a href=
1990 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1471422259_pJMWA&token=&lang=zh_CN">
1991 * 获取黑名单列表</a>
1992 * @see #getFollowingOpenIds(String)
1993 */
1994 public List<String> getAllBalcklistOpenIds() throws WeixinException {
1995 return tagApi.getAllBalcklistOpenIds();
1996 }
1997
1998 /**
1999 * 黑名单操作
2000 *
2001 * @param blacklist
2002 * true=拉黑用户,false=取消拉黑用户
2003 * @param openIds
2004 * 用户ID列表
2005 * @return 操作结果
2006 * @see com.foxinmy.weixin4j.mp.api.TagApi
2007 * @see <a href=
2008 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1471422259_pJMWA&token=&lang=zh_CN">
2009 * 黑名单操作</a>
2010 * @throws WeixinException
2011 */
2012 public ApiResult batchBlacklist(boolean blacklist, String... openIds) throws WeixinException {
2013 return tagApi.batchBlacklist(blacklist, openIds);
2014 }
2015
2016 /**
2017 * 创建卡券:创建卡券接口是微信卡券的基础接口,用于创建一类新的卡券,获取card_id,创建成功并通过审核后,
2018 * 商家可以通过文档提供的其他接口将卡券下发给用户,每次成功领取,库存数量相应扣除。
2019 *
2020 * <li>1.需自定义Code码的商家必须在创建卡券时候,设定use_custom_code为true,且在调用投放卡券接口时填入指定的Code码。
2021 * 指定OpenID同理。特别注意:在公众平台创建的卡券均为非自定义Code类型。
2022 * <li>2.can_share字段指领取卡券原生页面是否可分享,建议指定Code码、指定OpenID等强限制条件的卡券填写false。
2023 * <li>3.创建成功后该卡券会自动提交审核
2024 * ,审核结果将通过事件通知商户。开发者可调用设置白名单接口设置用户白名单,领取未通过审核的卡券,测试整个卡券的使用流程。
2025 *
2026 * @param cardCoupon
2027 * 卡券对象
2028 * @see <a href=
2029 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1451025056&token=&lang=zh_CN">
2030 * 创建卡券</a>
2031 * @see CardCoupons
2032 * @see MediaApi#uploadImage(java.io.InputStream, String)
2033 * @see com.foxinmy.weixin4j.mp.api.CardApi
2034 * @return 卡券ID
2035 * @throws WeixinException
2036 */
2037 public String createCardCoupon(CardCoupon cardCoupon) throws WeixinException {
2038 return cardApi.createCardCoupon(cardCoupon);
2039 }
2040
2041 /**
2042 * 查询某个card_id的创建信息、审核状态以及库存数量。
2043 *
2044 * @param cardId
2045 * @return
2046 * @throws WeixinException
2047 */
2048 public JSONObject getCardInfo(String cardId) throws WeixinException {
2049 return cardApi.getCardInfo(cardId);
2050 }
2051
2052 /**
2053 * 设置卡券买单:创建卡券之后,开发者可以通过设置微信买单接口设置该card_id支持微信买单功能。值得开发者注意的是,
2054 * 设置买单的card_id必须已经配置了门店,否则会报错。
2055 *
2056 * @param cardId
2057 * 卡券ID
2058 * @param isOpen
2059 * 是否开启买单功能,填true/false
2060 * @see #createCardCoupon(CardCoupon)
2061 * @see com.foxinmy.weixin4j.mp.api.CardApi
2062 * @return 操作结果
2063 * @throws WeixinException
2064 */
2065 public ApiResult setCardPayCell(String cardId, boolean isOpen) throws WeixinException {
2066 return cardApi.setCardPayCell(cardId, isOpen);
2067 }
2068
2069 /**
2070 * 设置自助核销:创建卡券之后,开发者可以通过设置微信买单接口设置该card_id支持自助核销功能。值得开发者注意的是,
2071 * 设置自助核销的card_id必须已经配置了门店,否则会报错。
2072 *
2073 * @param cardId
2074 * 卡券ID
2075 * @param isOpen
2076 * 是否开启买单功能,填true/false
2077 * @see #createCardCoupon(CardCoupon)
2078 * @see com.foxinmy.weixin4j.mp.api.CardApi
2079 * @return 操作结果
2080 * @throws WeixinException
2081 */
2082 public ApiResult setCardSelfConsumeCell(String cardId, boolean isOpen) throws WeixinException {
2083 return cardApi.setCardSelfConsumeCell(cardId, isOpen);
2084 }
2085
2086 /**
2087 * 创建卡券二维码: 开发者可调用该接口生成一张卡券二维码供用户扫码后添加卡券到卡包。
2088 *
2089 * @param expireSeconds
2090 * 指定二维码的有效时间,范围是60 ~ 1800秒。不填默认为365天有效
2091 * @param cardQRs
2092 * 二维码参数:二维码领取单张卡券/多张卡券
2093 * @return 二维码结果对象
2094 * @see com.foxinmy.weixin4j.model.qr.QRResult
2095 * @see com.foxinmy.weixin4j.model.qr.QRParameter
2096 * @see com.foxinmy.weixin4j.mp.api.CardApi
2097 * @see <a href=
2098 * "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1451025062&token=&lang=zh_CN">
2099 * 投放卡券</a>
2100 * @throws WeixinException
2101 */
2102 public QRResult createCardQR(Integer expireSeconds, CardQR... cardQRs) throws WeixinException {
2103 return cardApi.createCardQR(expireSeconds, cardQRs);
2104 }
2105
2106 /**
2107 * 微信礼品卡货架创建接口,开发者可以通过该接口创建一个礼品卡货架并且用于公众号、门店的礼品卡售卖。
2108 *
2109 * @param page
2110 * 货架对象
2111 * @return 货架ID
2112 * @throws WeixinException
2113 * @see <a href="https://mp.weixin.qq.com/wiki?action=doc&id=215143440770UT7Y&t=0.7237731395289302">微信礼品卡</a>
2114 */
2115 public String addGiftCardPage(GiftCardPage page) throws WeixinException {
2116 return cardApi.addGiftCardPage(page);
2117 }
2118
2119 /**
2120 * 查询礼品卡货架信息接口
2121 *
2122 * @param pageId
2123 * 货架ID
2124 * @return
2125 * @throws WeixinException
2126 */
2127 public JSONObject getGiftCardPage(String pageId) throws WeixinException {
2128 return cardApi.getGiftCardPage(pageId);
2129 }
2130
2131 /**
2132 * 下架一个礼品卡货架
2133 *
2134 * @param pageId
2135 * @return
2136 * @throws WeixinException
2137 */
2138 public ApiResult maintainGiftCardPage(String pageId) throws WeixinException {
2139 return cardApi.maintainGiftCardPage(pageId);
2140 }
2141
2142 /**
2143 * 下架所有礼品卡货架
2144 *
2145 * @return
2146 * @throws WeixinException
2147 */
2148 public ApiResult maintainAllGiftCardPage() throws WeixinException {
2149 return cardApi.maintainAllGiftCardPage();
2150 }
2151
2152 /**
2153 * 查询当前商户下所有的礼品卡货架id
2154 *
2155 * @return
2156 * @throws WeixinException
2157 */
2158 public String[] getGiftCardPageIdList() throws WeixinException {
2159 return cardApi.getGiftCardPageIdList();
2160 }
2161
2162 /**
2163 * 修改礼品卡货架信息接口
2164 *
2165 * @param page
2166 * 货架对象
2167 * @return
2168 * @throws WeixinException
2169 */
2170 public ApiResult updateGiftCardPage(GiftCardPage page) throws WeixinException {
2171 return cardApi.updateGiftCardPage(page);
2172 }
2173
2174 /**
2175 * 申请礼品卡的微信支付权限
2176 * @param subMchId
2177 * 子商户号
2178 * @return 微信支付商户平台确认地址
2179 * @throws WeixinException
2180 */
2181 public String addGiftCardPayWhitelist(String subMchId) throws WeixinException {
2182 return cardApi.addGiftCardPayWhitelist(subMchId);
2183 }
2184
2185 /**
2186 * 绑定商户号到礼品卡小程序
2187 *
2188 * @param wxaAppid
2189 * 微信小程序ID
2190 * @param subMchId
2191 * 微信支付商户号
2192 * @return
2193 * @throws WeixinException
2194 */
2195 public ApiResult bindGiftCardPaySubMch(String wxaAppid, String subMchId) throws WeixinException {
2196 return cardApi.bindGiftCardPaySubMch(wxaAppid, subMchId);
2197 }
2198
2199 /**
2200 * 上传礼品卡小程序代码
2201 *(提供小程序APPID及货架ID,由微信平台为你小程序帐号上传一套现成的礼品卡小程序,直接用于礼品卡售卖)
2202 *
2203 * @param wxaAppid
2204 * 微信小程序APPID
2205 * @param pageId
2206 * 礼品卡货架ID
2207 * @return
2208 * @throws WeixinException
2209 */
2210 public ApiResult setGiftCardWxaCode(String wxaAppid, String pageId) throws WeixinException {
2211 return cardApi.setGiftCardWxaCode(wxaAppid, pageId);
2212 }
2213
2214 /**
2215 * 当礼品卡被使用完毕或者发生转存、绑定等操作后,开发者可以通过该接口核销用户的礼品卡,使礼品卡在列表中沉底并不再被使用。
2216 * 注意:需在礼品卡核销前调用,否则会报40099 已核销的错误
2217 *
2218 * @param code
2219 * 卡券Code码。
2220 * @param cardId
2221 * 卡券ID,自定义code卡券必填,否则非必填。
2222 * @return
2223 * @throws WeixinException
2224 */
2225 public ApiResult consumeGiftCard(String code, String cardId) throws WeixinException {
2226 return cardApi.consumeGiftCard(code, cardId);
2227 }
2228
2229 /**
2230 * 开发者可以通过该接口查询到code对应的信息,如余额、有效期、订单号等,主要用于防止在交易完成后丢单的情况下,用于核销/余额变动时兜底处理。
2231 *
2232 * @param code
2233 * 卡券Code码
2234 * @param cardId
2235 * 卡券ID,自定义code卡券必填,否则非必填。
2236 * @return
2237 * @throws WeixinException
2238 */
2239 public JSONObject getGiftCardInfo(String code, String cardId) throws WeixinException {
2240 return cardApi.getGiftCardInfo(code, cardId);
2241 }
2242
2243 /**
2244 * 查询某个订单号对应的订单详情
2245 *
2246 * @param orderId
2247 * 礼品卡订单号,商户可以通过购买成功的事件推送或者批量查询订单接口获得
2248 * @return
2249 * @throws WeixinException
2250 */
2251 public JSONObject getGiftCardOrderInfo(String orderId) throws WeixinException {
2252 return cardApi.getOrderInfo(orderId);
2253 }
2254
2255 /**
2256 * 批量查询礼品卡订单信息接口
2257 *
2258 * @param beginTime
2259 * 查询的时间起点,十位时间戳(utc+8)
2260 * @param endTime
2261 * 查询的时间终点,十位时间戳(utc+8)
2262 * @param sortType
2263 * 填"ASC" / "DESC",表示对订单创建时间进行“升 / 降”排序
2264 * @param offset
2265 * 查询的订单偏移量,如填写100则表示从第100个订单开始拉取
2266 * @param limit
2267 * 查询订单的数量,如offset填写100,count填写10,则表示查询第100个到第110个订单
2268 * @return
2269 * @throws WeixinException
2270 */
2271 public JSONObject getGiftCardOrders(long beginTime, long endTime, String sortType, int offset, int limit) throws WeixinException
2272 {
2273 return cardApi.getOrders(beginTime, endTime, sortType, offset, limit);
2274 }
2275
2276 /**
2277 * 更新用户礼品卡信息
2278 * 当礼品卡被使用后,可以通过该接口变更某个礼品卡的余额信息。
2279 *
2280 * @param cardInfo
2281 * @return
2282 * @throws WeixinException
2283 */
2284 public JSONObject updateGiftCardUserBalance(CardInfo cardInfo) throws WeixinException {
2285 return cardApi.updateGiftCardUserBalance(cardInfo);
2286 }
2287
2288 /**
2289 * 对一笔礼品卡订单操作退款
2290 *
2291 * @param orderId
2292 * 订单ID
2293 * @return
2294 * @throws WeixinException
2295 */
2296 public ApiResult giftCardOrderRefund(String orderId) throws WeixinException {
2297 return cardApi.orderRefund(orderId);
2298 }
2299
2300 /**
2301 * 打开/关闭已群发文章评论
2302 *
2303 * @param open
2304 * true为打开,false为关闭
2305 * @param msgid
2306 * 群发返回的msg_data_id
2307 * @param index
2308 * 多图文时,用来指定第几篇图文,从0开始,不带默认操作该msg_data_id的第一篇图文
2309 * @return 操作结果
2310 * @see com.foxinmy.weixin4j.mp.api.ComponentApi
2311 * @see {@link MassApi#massByTagId(com.foxinmy.weixin4j.tuple.MassTuple, int)}
2312 * @see {@link MassApi#massByOpenIds(com.foxinmy.weixin4j.tuple.MassTuple, String...)}
2313 * @throws WeixinException
2314 */
2315 public ApiResult openComment(boolean open, String msgid, int index) throws WeixinException {
2316 return commentApi.openComment(open, msgid, index);
2317 }
2318
2319 /**
2320 * 获取评论列表
2321 *
2322 * @param page
2323 * 分页信息
2324 * @param commentType
2325 * 评论类型 为空获取全部类型
2326 * @param msgid
2327 * 群发返回的msg_data_id
2328 * @param index
2329 * 多图文时,用来指定第几篇图文,从0开始,不带默认操作该msg_data_id的第一篇图文
2330 * @return 分页数据
2331 * @see ArticleComment
2332 * @see ArticleCommentType
2333 * @see com.foxinmy.weixin4j.mp.api.ComponentApi
2334 * @see {@link MassApi#massByTagId(com.foxinmy.weixin4j.tuple.MassTuple, int)}
2335 * @see {@link MassApi#massByOpenIds(com.foxinmy.weixin4j.tuple.MassTuple, String...)}
2336 * @throws WeixinException
2337 */
2338 public Pagedata<ArticleComment> listArticleComments(Pageable page, ArticleCommentType commentType, String msgid,
2339 int index) throws WeixinException {
2340 return commentApi.listArticleComments(page, commentType, msgid, index);
2341 }
2342
2343 /**
2344 * 获取评论列表
2345 *
2346 * @param commentType
2347 * 评论类型 为空获取全部类型
2348 * @param msgid
2349 * 群发返回的msg_data_id
2350 * @param index
2351 * 多图文时,用来指定第几篇图文,从0开始,不带默认操作该msg_data_id的第一篇图文
2352 * @return 分页数据
2353 * @see com.foxinmy.weixin4j.mp.api.ComponentApi
2354 * @see #listArticleComments(Pageable, ArticleCommentType, String, int)
2355 * @throws WeixinException
2356 */
2357 public List<ArticleComment> listAllArticleComments(ArticleCommentType commentType, String msgid, int index)
2358 throws WeixinException {
2359 return commentApi.listAllArticleComments(commentType, msgid, index);
2360 }
2361
2362 /**
2363 * 评论标记/取消精选
2364 *
2365 * @param markelect
2366 * true为标记,false为取消
2367 * @param msgid
2368 * 群发返回的msg_data_id
2369 * @param index
2370 * 多图文时,用来指定第几篇图文,从0开始,不带默认操作该msg_data_id的第一篇图文
2371 * @param commentId
2372 * 用户评论ID
2373 * @return 操作结果
2374 * @see com.foxinmy.weixin4j.mp.api.ComponentApi
2375 * @see #listArticleComments(Pageable, ArticleCommentType, String, int)
2376 * @throws WeixinException
2377 */
2378 public ApiResult markelectComment(boolean markelect, String msgid, int index, String commentId)
2379 throws WeixinException {
2380 return commentApi.markelectComment(markelect, msgid, index, commentId);
2381 }
2382
2383 /**
2384 * 删除评论
2385 *
2386 * @param msgid
2387 * 群发返回的msg_data_id
2388 * @param index
2389 * 多图文时,用来指定第几篇图文,从0开始,不带默认操作该msg_data_id的第一篇图文
2390 * @param commentId
2391 * 用户评论ID
2392 * @return 操作结果
2393 * @see com.foxinmy.weixin4j.mp.api.ComponentApi
2394 * @see #listArticleComments(Pageable, ArticleCommentType, String, int)
2395 * @throws WeixinException
2396 */
2397 public ApiResult deleteComment(String msgid, int index, String commentId) throws WeixinException {
2398 return commentApi.deleteComment(msgid, index, commentId);
2399 }
2400
2401 /**
2402 * 回复评论
2403 *
2404 * @param msgid
2405 * 群发返回的msg_data_id
2406 * @param index
2407 * 多图文时,用来指定第几篇图文,从0开始,不带默认操作该msg_data_id的第一篇图文
2408 * @param commentId
2409 * 用户评论ID
2410 * @param content
2411 * 回复内容
2412 * @return 操作结果
2413 * @see com.foxinmy.weixin4j.mp.api.ComponentApi
2414 * @see #listArticleComments(Pageable, ArticleCommentType, String, int)
2415 * @throws WeixinException
2416 */
2417 public ApiResult replyComment(String msgid, int index, String commentId, String content) throws WeixinException {
2418 return commentApi.replyComment(msgid, index, commentId, content);
2419 }
2420
2421 /**
2422 * 删除回复
2423 *
2424 * @param msgid
2425 * 群发返回的msg_data_id
2426 * @param index
2427 * 多图文时,用来指定第几篇图文,从0开始,不带默认操作该msg_data_id的第一篇图文
2428 * @param commentId
2429 * 用户评论ID
2430 * @return 操作结果
2431 * @see com.foxinmy.weixin4j.mp.api.ComponentApi
2432 * @see #listArticleComments(Pageable, ArticleCommentType, String, int)
2433 * @throws WeixinException
2434 */
2435 public ApiResult deleteCommentReply(String msgid, int index, String commentId) throws WeixinException {
2436 return commentApi.deleteCommentReply(msgid, index, commentId);
2437 }
2438
2439 public final static String VERSION = Consts.VERSION;
2440 }