Package com.foxinmy.weixin4j.mp.api
Class MassApi
- java.lang.Object
-
- com.foxinmy.weixin4j.api.BaseApi
-
- com.foxinmy.weixin4j.mp.api.MpApi
-
- com.foxinmy.weixin4j.mp.api.MassApi
-
public class MassApi extends MpApi
群发相关API- Since:
- JDK 1.6
- Author:
- jinyu(foxinmy@gmail.com)
-
-
Field Summary
-
Fields inherited from class com.foxinmy.weixin4j.api.BaseApi
weixinExecutor
-
-
Constructor Summary
Constructors Constructor Description MassApi(TokenManager tokenManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ApiResultdeleteMassNews(String msgid)删除群发消息ApiResultdeleteMassNews(String msgid, int articleIndex)删除群发消息StringgetMassNewStatus(String msgId)查询群发发送状态String[]massArticleByGroupId(List<MpArticle> articles, int groupId)Deprecated.String[]massArticleByOpenIds(List<MpArticle> articles, boolean ignoreReprint, String... openIds)openid群发图文消息String[]massArticleByTagId(List<MpArticle> articles, int tagId, boolean ignoreReprint)标签群发图文消息String[]massByGroupId(MassTuple tuple, boolean isToAll, int groupId)Deprecated.String[]massByOpenIds(MassTuple tuple, String... openIds)openId群发消息String[]massByTagId(MassTuple tuple, int tagId)标签群发消息String[]massToAll(MassTuple tuple)群发消息给所有粉丝ApiResultpreviewMassNews(String toUser, String toWxName, MassTuple tuple)预览群发消息 开发者可通过该接口发送消息给指定用户,在手机端查看消息的样式和排版StringuploadArticle(List<MpArticle> articles)上传图文消息,一个图文消息支持1到10条图文 具备微信支付权限的公众号,在使用高级群发接口上传、群发图文消息类型时,可使用<a>\u6807\u7b7e\u52a0\u5165\u5916\u94fe-
Methods inherited from class com.foxinmy.weixin4j.mp.api.MpApi
weixinBundle
-
Methods inherited from class com.foxinmy.weixin4j.api.BaseApi
getRequestUri
-
-
-
-
Constructor Detail
-
MassApi
public MassApi(TokenManager tokenManager)
-
-
Method Detail
-
uploadArticle
public String uploadArticle(List<MpArticle> articles) throws WeixinException
上传图文消息,一个图文消息支持1到10条图文 具备微信支付权限的公众号,在使用高级群发接口上传、群发图文消息类型时,可使用<a>\u6807\u7b7e\u52a0\u5165\u5916\u94fe- Parameters:
articles- 图片消息- Returns:
- 媒体ID
- Throws:
WeixinException- See Also:
- 上传图文素材,
MpArticle
-
massByGroupId
@Deprecated public String[] massByGroupId(MassTuple tuple, boolean isToAll, int groupId) throws WeixinException
Deprecated.分组群发在返回成功时,意味着群发任务提交成功,并不意味着此时群发已经结束,所以,仍有可能在后续的发送过程中出现异常情况导致用户未收到消息, 如消息有时会进行审核、服务器不稳定等,此外,群发任务一般需要较长的时间才能全部发送完毕
-
massArticleByGroupId
@Deprecated public String[] massArticleByGroupId(List<MpArticle> articles, int groupId) throws WeixinException
Deprecated.分组ID群发图文消息- Parameters:
articles- 图文列表groupId- 分组ID- Returns:
- 第一个元素为消息发送任务的ID,第二个元素为消息的数据ID,该字段只有在群发图文消息时,才会出现。
- Throws:
WeixinException- See Also:
- 根据分组群发,
MpArticle
-
massToAll
public String[] massToAll(MassTuple tuple) throws WeixinException
群发消息给所有粉丝- Parameters:
tuple- 消息元件- Returns:
- 第一个元素为消息发送任务的ID,第二个元素为消息的数据ID,该字段只有在群发图文消息时,才会出现,可以用于在图文分析数据接口中
- Throws:
WeixinException- See Also:
- 根据标签群发
-
massByTagId
public String[] massByTagId(MassTuple tuple, int tagId) throws WeixinException
标签群发消息- Parameters:
tuple- 消息元件tagId- 标签ID- Returns:
- 第一个元素为消息发送任务的ID,第二个元素为消息的数据ID,该字段只有在群发图文消息时,才会出现,可以用于在图文分析数据接口中
- Throws:
WeixinException- See Also:
Tag,#mass(MassTuple, JSONObject, boolean), 根据标签群发
-
massArticleByTagId
public String[] massArticleByTagId(List<MpArticle> articles, int tagId, boolean ignoreReprint) throws WeixinException
标签群发图文消息- Parameters:
articles- 图文列表tagId- 标签IDignoreReprint- 图文消息被判定为转载时,是否继续群发- Returns:
- 第一个元素为消息发送任务的ID,第二个元素为消息的数据ID,该字段只有在群发图文消息时,才会出现。
- Throws:
WeixinException- See Also:
- 根据标签群发,
MpArticle
-
massByOpenIds
public String[] massByOpenIds(MassTuple tuple, String... openIds) throws WeixinException
openId群发消息- Parameters:
tuple- 消息元件openIds- openId列表- Returns:
- 第一个元素为消息发送任务的ID,第二个元素为消息的数据ID,该字段只有在群发图文消息时,才会出现,可以用于在图文分析数据接口中
- Throws:
WeixinException- See Also:
- 根据openid群发,
#mass(MassTuple, JSONObject, boolean)
-
massArticleByOpenIds
public String[] massArticleByOpenIds(List<MpArticle> articles, boolean ignoreReprint, String... openIds) throws WeixinException
openid群发图文消息- Parameters:
articles- 图文列表ignoreReprint- 图文消息被判定为转载时,是否继续群发openIds- openId列表- Returns:
- 第一个元素为消息发送任务的ID,第二个元素为消息的数据ID,该字段只有在群发图文消息时,才会出现,可以用于在图文分析数据接口中.
- Throws:
WeixinException- See Also:
- 根据openid群发,
MpArticle
-
deleteMassNews
public ApiResult deleteMassNews(String msgid) throws WeixinException
删除群发消息- Parameters:
msgid- 发送出去的消息ID- Throws:
WeixinException- See Also:
- 删除群发,
deleteMassNews(String, int)
-
deleteMassNews
public ApiResult deleteMassNews(String msgid, int articleIndex) throws WeixinException
删除群发消息请注意,只有已经发送成功的消息才能删除删除消息只是将消息的图文详情页失效,已经收到的用户,还是能在其本地看到消息卡片
- Parameters:
msgid- 发送出去的消息IDarticleIndex- 要删除的文章在图文消息中的位置,第一篇编号为1,该字段不填或填0会删除全部文章- Throws:
WeixinException- See Also:
- 删除群发
-
previewMassNews
public ApiResult previewMassNews(String toUser, String toWxName, MassTuple tuple) throws WeixinException
预览群发消息 开发者可通过该接口发送消息给指定用户,在手机端查看消息的样式和排版- Parameters:
toUser- 接收用户的openIDtoWxName- 接收用户的微信号 towxname和touser同时赋值时,以towxname优先tuple- 消息元件- Returns:
- 处理结果
- Throws:
WeixinException- See Also:
MassTuple, 预览群发消息
-
getMassNewStatus
public String getMassNewStatus(String msgId) throws WeixinException
查询群发发送状态- Parameters:
msgId- 消息ID- Returns:
- 消息发送状态,如sendsuccess:发送成功、sendfail:发送失败
- Throws:
WeixinException- See Also:
- 查询群发状态
-
-