getGuideCardMaterial(int type) throws WxErrorException;
+
+ /**
+ * 删除小程序卡片素材
+ *
+ *
+ * 请求地址: POST https://api.weixin.qq.com/cgi-bin/guide/delguidecardmaterial?access_token=ACCESS_TOKEN
+ * 文档地址:https://developers.weixin.qq.com/doc/offiaccount/Shopping_Guide/model-account/shopping-guide.delGuideCardMaterial.html
+ *
+ *
+ * @param type 操作类型,填0,表示服务号素材
+ * @param title 小程序卡片名字
+ * @param path 小程序路径
+ * @param appId 小程序的appid
+ * @throws WxErrorException .
+ */
+ void delGuideCardMaterial(int type, String title, String path, String appId) throws WxErrorException;
+
+ /**
+ * 添加图片素材
+ *
+ *
+ * 请求地址: POST https://api.weixin.qq.com/cgi-bin/guide/setguideimagematerial?access_token=ACCESS_TOKEN
+ * 文档地址:https://developers.weixin.qq.com/doc/offiaccount/Shopping_Guide/model-account/shopping-guide.setGuideImageMaterial.html
+ *
+ *
+ * @param mediaId 图片素材,只能用《素材管理获取media_id》(注意:只支持临时素材的media_id)
+ * @param type 操作类型,填0,表示服务号素材
+ * @throws WxErrorException .
+ */
+ void setGuideImageMaterial(String mediaId, int type) throws WxErrorException;
+
+ /**
+ * 查询图片素材
+ *
+ *
+ * 请求地址: POST https://api.weixin.qq.com/cgi-bin/guide/getguideimagematerial?access_token=ACCESS_TOKEN
+ * 文档地址:https://developers.weixin.qq.com/doc/offiaccount/Shopping_Guide/model-account/shopping-guide.getGuideImageMaterial.html
+ *
+ *
+ * @param type 操作类型,填0,表示服务号素材
+ * @param start 分页查询,起始位置
+ * @param num 分页查询,查询个数
+ * @return 图片素材列表
+ * @throws WxErrorException .
+ */
+ WxMpGuideImgMaterialInfoList getGuideImageMaterial(int type, int start, int num) throws WxErrorException;
+
+ /**
+ * 删除图片素材
+ *
+ *
+ * 请求地址: POST https://api.weixin.qq.com/cgi-bin/guide/delguideimagematerial?access_token=ACCESS_TOKEN
+ * 文档地址:https://developers.weixin.qq.com/doc/offiaccount/Shopping_Guide/model-account/shopping-guide.delGuideImageMaterial.html
+ *
+ *
+ * @param type 操作类型,填0,表示服务号素材
+ * @param picUrl 图片素材内容
+ * @throws WxErrorException .
+ */
+ void delGuideImageMaterial(int type, String picUrl) throws WxErrorException;
+
+ /**
+ * 添加文字素材
+ *
+ *
+ * 请求地址: POST https://api.weixin.qq.com/cgi-bin/guide/setguidewordmaterial?access_token=ACCESS_TOKEN
+ * 文档地址:https://developers.weixin.qq.com/doc/offiaccount/Shopping_Guide/model-account/shopping-guide.setGuideWordMaterial.html
+ *
+ *
+ * @param type 操作类型,填0,表示服务号素材
+ * @param word 文字素材内容
+ * @throws WxErrorException .
+ */
+ void setGuideWordMaterial(int type, String word) throws WxErrorException;
+
+ /**
+ * 查询文字素材
+ *
+ *
+ * 请求地址: POST https://api.weixin.qq.com/cgi-bin/guide/getguidewordmaterial?access_token=ACCESS_TOKEN
+ * 文档地址:https://developers.weixin.qq.com/doc/offiaccount/Shopping_Guide/model-account/shopping-guide.getGuideWordMaterial.html
+ *
+ *
+ * @param type 操作类型,填0,表示服务号素材
+ * @param start 分页查询,起始位置
+ * @param num 分页查询,查询个数
+ * @return 文字素材列表
+ * @throws WxErrorException 。
+ */
+ WxMpGuideWordMaterialInfoList getGuideWordMaterial(int type, int start, int num) throws WxErrorException;
+
+ /**
+ * 删除文字素材
+ *
+ *
+ * 请求地址: POST https://api.weixin.qq.com/cgi-bin/guide/delguidewordmaterial?access_token=ACCESS_TOKEN
+ * 文档地址:https://developers.weixin.qq.com/doc/offiaccount/Shopping_Guide/model-account/shopping-guide.delGuideWordMaterial.html
+ *
+ *
+ * @param type 操作类型,填0,表示服务号素材
+ * @param word 文字素材内容
+ * @throws WxErrorException .
+ */
+ void delGuideWordMaterial(int type, String word) throws WxErrorException;
+
+}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpGuideService.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpGuideService.java
index e1427dbb67..e91cfc1dc4 100644
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpGuideService.java
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpGuideService.java
@@ -1,8 +1,9 @@
package me.chanjar.weixin.mp.api;
import me.chanjar.weixin.common.error.WxErrorException;
-import me.chanjar.weixin.mp.bean.guide.WxMpGuideInfo;
-import me.chanjar.weixin.mp.bean.guide.WxMpGuideList;
+import me.chanjar.weixin.mp.bean.guide.*;
+
+import java.util.List;
/**
* 微信导购助手(现在叫对话能力)接口.
@@ -11,6 +12,7 @@
* @date 2020 -10-06
*/
public interface WxMpGuideService {
+
/**
* 为服务号添加顾问
*
@@ -93,4 +95,240 @@ public interface WxMpGuideService {
* @throws WxErrorException .
*/
WxMpGuideList listGuide(int page, int num) throws WxErrorException;
+
+ /**
+ * 生成顾问二维码
+ *
+ * 生成顾问二维码后,微信用户扫码直接跳转公众号首页。分为两种情况:
+ * 1.微信用户已经关注公众号,扫码后绑定该顾问。
+ * 2.微信用户未关注公众号,扫码后 3 分钟内关注该公众号,则绑定该顾问
+ *
+ *
+ * 请求地址: POST https://api.weixin.qq.com/cgi-bin/guide/guidecreateqrcode?access_token=ACCESS_TOKEN
+ * 文档地址:https://developers.weixin.qq.com/doc/offiaccount/Shopping_Guide/guide-account/shopping-guide.guideCreateQrCode.html
+ *
+ *
+ * @param account 顾问微信号(guide_account和guide_openid二选一,若同时请求,默认为guide_account)
+ * @param openid 顾问openid或者unionid(guide_account和guide_openid二选一)
+ * @param qrcodeInfo 额外参数,用于事件推送
+ * @return 二维码下载链接
+ * @throws WxErrorException .
+ */
+ String createGuideQrCode(String account, String openid, String qrcodeInfo) throws WxErrorException;
+
+ /**
+ * 获取顾问聊天记录
+ *
+ * 支持拉取该顾问近 30 天的聊天记录。begin_time 与 end_time 同时非0情况下,该参数才会生效,否则为默认值。
+ *
+ *
+ * 请求地址: POST https://api.weixin.qq.com/cgi-bin/guide/getguidebuyerchatrecord?access_token=ACCESS_TOKEN
+ * 文档地址:https://developers.weixin.qq.com/doc/offiaccount/Shopping_Guide/guide-account/shopping-guide.getGuideBuyerChatRecord.html
+ *
+ *
+ * @param account 顾问微信号(guide_account和guide_openid二选一,若同时请求,默认为guide_account)
+ * @param openid 顾问openid或者unionid(guide_account和guide_openid二选一)
+ * @param clientOpenid 客户openid 若不填,则拉取该顾问所有客户的聊天记录。若填写,则拉取顾问与某一个客户的聊天记录
+ * @param beginTime 消息的起始UNIX时间戳,如果不填,默认当前时间的前30天(仅支持30天范围内的查询)
+ * @param endTime 消息的截止UNIX时间戳,如果不填,默认当前时间。
+ * @param page 分页页数,从0开始
+ * @param num 每页数量
+ * @return 顾问聊天记录列表
+ */
+ WxMpGuideMsgList getGuideChatRecord(String account, String openid, String clientOpenid, Long beginTime, Long endTime, int page, int num) throws WxErrorException;
+
+ /**
+ * 设置快捷回复与关注自动回复
+ *
+ * 快捷回复:指顾问在对话详情页,可快速选择的回复内容。
+ * 注意:1.快捷回复只允许全部删除 2.快捷回复的添加删除需要指定顾问的guide_account和guide_openid二选一
+ *
+ * 关注自动回复:是指客户通过扫顾问码、扫顾问分组码、微信广告三种方式主动关注公众号并绑定顾问,
+ * 顾问会下发的自动回复,即顾问欢迎语。最多可下发两条消息,支持文字、图片或小程序素材,可更新、删除,设置好后先后下发。
+ * 不指定 guide_account 和 guide_openid 时,可设置所有顾问默认的关注自动回复。
+ * 对单个顾问来说,如果指定 guide_account 和 guide_openid 设置了自动回复,则下发它,否则下发所有顾问默认的关注自动回复
+ * 注意:自动回复每次设置会覆盖原有的,自动回复只允许出现两条
+ *
+ * 特别注意:删除需要传递 guideAutoReply:{"msgtype":"1"}
+ * 删除目前只支持两条全部删除 2021/5/8
+ *
+ * 自动回复格式:
+ * String content: 新客户关注自动回复内容,图片填mediaid,获取方式同图片素材,小程序卡片填下面请求demo中字段的json格式
+ * int msgtype: 1表示文字,2表示图片,3表示小程序卡片
+ * 例如:JsonObject:{"content": "abc","msgtype":"1"}
+ *
+ *
+ * 请求地址: POST https://api.weixin.qq.com/cgi-bin/guide/setguideconfig?access_token=ACCESS_TOKEN
+ * 文档地址:https://developers.weixin.qq.com/doc/offiaccount/Shopping_Guide/guide-account/shopping-guide.setGuideConfig.html
+ *
+ *
+ * @param account 顾问微信号(guide_account和guide_openid二选一,若同时请求,默认为guide_account)
+ * @param openid 顾问openid或者unionid(guide_account和guide_openid二选一)
+ * @param isDelete 操作类型,false表示添加 true表示删除
+ * @param guideFastReplyList 快捷回复列表
+ * @param guideAutoReply 第一条新客户关注自动回复
+ * @param guideAutoReplyPlus 第二条新客户关注自动回复
+ * @throws WxErrorException .
+ */
+ void setGuideConfig(String account, String openid, boolean isDelete, List guideFastReplyList, WxMpAddGuideAutoReply guideAutoReply, WxMpAddGuideAutoReply guideAutoReplyPlus) throws WxErrorException;
+
+ /**
+ * 获取快捷回复与关注自动回复
+ * 如果要获取服务号维度的新客户关注自动回复,不填guide_account与guide_openid即可
+ *
+ *
+ * 请求地址: POST https://api.weixin.qq.com/cgi-bin/guide/getguideconfig?access_token=ACCESS_TOKEN
+ * 文档地址:https://developers.weixin.qq.com/doc/offiaccount/Shopping_Guide/guide-account/shopping-guide.getGuideConfig.html
+ *
+ *
+ * @param account 顾问微信号(guide_account和guide_openid二选一,若同时请求,默认为guide_account)
+ * @param openid 顾问openid或者unionid(guide_account和guide_openid二选一)
+ * @return 顾问的 快捷回复,关注顾问自动回复
+ */
+ WxMpGuideConfig getGuideConfig(String account, String openid) throws WxErrorException;
+
+ /**
+ * 为服务号设置敏感词与离线自动回复
+ * 顾问在小程序离线状态时,客户发消息会收到设置的离线自动回复,最多支持 300 字。 顾问在小程序内发消息,如果触发敏感词将无法发出。
+ *
+ * 注意:添加模式 black_keyword字段传递null将删除全部敏感词
+ * black_keyword字段有值将对敏感词进行追加而不是全量更新覆盖 (实际测试与官方文档有冲突)
+ *
+ *
+ * 请求地址: POST https://api.weixin.qq.com/cgi-bin/guide/setguideacctconfig?access_token=ACCESS_TOKEN
+ * 文档地址:https://developers.weixin.qq.com/doc/offiaccount/Shopping_Guide/guide-account/shopping-guide.setGuideAcctConfig.html
+ *
+ *
+ * @param isDelete 操作类型,false表示添加 true表示删除
+ * @param blackKeyword 敏感词,每次全量更新覆盖原来数据(如果不设置就不传black_keyword字段)
+ * @param guideAutoReply 离线自动回复(如果不设置就不传guide_auto_reply字段)
+ * @throws WxErrorException .
+ */
+ void setGuideAcctConfig(boolean isDelete, List blackKeyword, String guideAutoReply) throws WxErrorException;
+
+ /**
+ * 获取离线自动回复与敏感词
+ *
+ *
+ * 请求地址: POST https://api.weixin.qq.com/cgi-bin/guide/getguideacctconfig?access_token=ACCESS_TOKEN
+ * 文档地址:https://developers.weixin.qq.com/doc/offiaccount/Shopping_Guide/guide-account/shopping-guide.getGuideAcctConfig.html
+ *
+ *
+ * @return 离线自动回复与敏感词
+ * @throws WxErrorException .
+ */
+ WxMpGuideAcctConfig getGuideAcctConfig() throws WxErrorException;
+
+ /**
+ * 允许微信用户复制小程序页面路径
+ * 请求成功后,该微信号用户可在微信上复制对应小程序的任意页面path,有效期为60天。若需要添加小程序卡片素材时的path,可以用这个方式获取。
+ *
+ *
+ * 请求地址: POST https://api.weixin.qq.com/cgi-bin/guide/pushshowwxapathmenu?access_token=ACCESS_TOKEN
+ * 文档地址:https://developers.weixin.qq.com/doc/offiaccount/Shopping_Guide/guide-account/shopping-guide.pushShowWxaPathMenu.html
+ *
+ *
+ * @param appId 小程序appid,暂时只支持小程序,不支持小游戏
+ * @param userName 关注该公众号的微信号
+ * @throws WxErrorException .
+ */
+ void pushShowWxaPathMenu(String appId, String userName) throws WxErrorException;
+
+ /**
+ * 新建顾问分组
+ *
+ *
+ * 请求地址: POST https://api.weixin.qq.com/cgi-bin/guide/newguidegroup?access_token=ACCESS_TOKEN
+ * 文档地址:https://developers.weixin.qq.com/doc/offiaccount/Shopping_Guide/guide-account/shopping-guide.newGuideGroup.html
+ *
+ *
+ * @param groupName 顾问分组名称
+ * @return 顾问分组唯一id
+ * @throws WxErrorException .
+ */
+ Long newGuideGroup(String groupName) throws WxErrorException;
+
+ /**
+ * 获取服务号下所有顾问分组的列表
+ *
+ *
+ * 请求地址: POST https://api.weixin.qq.com/cgi-bin/guide/getguidegrouplist?access_token=ACCESS_TOKEN
+ * 文档地址:https://developers.weixin.qq.com/doc/offiaccount/Shopping_Guide/guide-account/shopping-guide.getGuideGroupList.html
+ *
+ *
+ * @return 顾问分组列表
+ * @throws WxErrorException .
+ */
+ List getGuideGroupList() throws WxErrorException;
+
+ /**
+ * 获取指定顾问分组内顾问信息
+ *
+ *
+ * 请求地址: POST https://api.weixin.qq.com/cgi-bin/guide/getgroupinfo?access_token=ACCESS_TOKEN
+ * 文档地址:https://developers.weixin.qq.com/doc/offiaccount/Shopping_Guide/guide-account/shopping-guide.getGroupInfo.html
+ *
+ *
+ * @param groupId 顾问群组id
+ * @param page 分页页数,从0开始,用于组内顾问分页获取
+ * @param num 每页数量
+ * @return 顾问分组内顾问信息
+ * @throws WxErrorException .
+ */
+ WxMpGuideGroupInfoList getGroupInfo(long groupId, int page, int num) throws WxErrorException;
+
+ /**
+ * 分组内添加顾问
+ *
+ *
+ * 请求地址: POST https://api.weixin.qq.com/cgi-bin/guide/addguide2guidegroup?access_token=ACCESS_TOKEN
+ * 文档地址:https://developers.weixin.qq.com/doc/offiaccount/Shopping_Guide/guide-account/shopping-guide.addGuide2GuideGroup.html
+ *
+ *
+ * @param groupId 顾问分组id
+ * @param account 顾问微信号
+ * @throws WxErrorException .
+ */
+ void addGuide2GuideGroup(long groupId, String account) throws WxErrorException;
+
+ /**
+ * 分组内删除顾问
+ *
+ *
+ * 请求地址: POST https://api.weixin.qq.com/cgi-bin/guide/delguide2guidegroup?access_token=ACCESS_TOKEN
+ * 文档地址:https://developers.weixin.qq.com/doc/offiaccount/Shopping_Guide/guide-account/shopping-guide.delGuide2GuideGroup.html
+ *
+ *
+ * @param groupId 顾问分组id
+ * @param account 顾问微信号
+ * @throws WxErrorException .
+ */
+ void delGuide2GuideGroup(long groupId, String account) throws WxErrorException;
+
+ /**
+ * 获取顾问所在分组
+ *
+ *
+ * 请求地址: POST https://api.weixin.qq.com/cgi-bin/guide/getgroupbyguide?access_token=ACCESS_TOKEN
+ * 文档地址:https://developers.weixin.qq.com/doc/offiaccount/Shopping_Guide/guide-account/shopping-guide.getGroupByGuide.html
+ *
+ *
+ * @param account 顾问微信号
+ * @return 顾问分组id列表
+ * @throws WxErrorException .
+ */
+ List getGroupByGuide(String account) throws WxErrorException;
+
+ /**
+ * 删除指定顾问分组
+ *
+ *
+ * 请求地址: POST https://api.weixin.qq.com/cgi-bin/guide/delguidegroup?access_token=ACCESS_TOKEN
+ * 文档地址:https://developers.weixin.qq.com/doc/offiaccount/Shopping_Guide/guide-account/shopping-guide.delGuideGroup.html
+ *
+ *
+ * @param groupId 顾问分组id
+ * @throws WxErrorException .
+ */
+ void delGuideGroup(long groupId) throws WxErrorException;
}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpGuideTagService.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpGuideTagService.java
new file mode 100644
index 0000000000..554815b701
--- /dev/null
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpGuideTagService.java
@@ -0,0 +1,204 @@
+package me.chanjar.weixin.mp.api;
+
+import me.chanjar.weixin.common.error.WxErrorException;
+import me.chanjar.weixin.mp.bean.guide.WxMpGuideBuyerResp;
+import me.chanjar.weixin.mp.bean.guide.WxMpGuideTagInfo;
+
+import java.util.List;
+
+/**
+ * @author 广州跨界-宋心成
+ * @date 2021/5/13/013
+ */
+public interface WxMpGuideTagService {
+
+ /**
+ * 新建标签类型
+ * 最多 4 类标签类型,50 个可选值,所有的标签可选值不能有相等重复的值。
+ *
+ *
+ * 请求地址: POST https://api.weixin.qq.com/cgi-bin/guide/newguidetagoption?access_token=ACCESS_TOKEN
+ * 文档地址:https://developers.weixin.qq.com/doc/offiaccount/Shopping_Guide/tag-account/shopping-guide.newGuideTagOption.html
+ *
+ *
+ * @param tagName 标签类型的名字
+ * @param values 标签可选值列表,可选值不能为空值,所有的标签可选值不能有相等重复的值
+ * @throws WxErrorException 。
+ */
+ void newGuideTagOption(String tagName, List values) throws WxErrorException;
+
+ /**
+ * 删除指定标签类型
+ * 此操作会更新所有相关客户的标签信息,存在延迟。
+ *
+ *
+ * 请求地址: POST https://api.weixin.qq.com/cgi-bin/guide/delguidetagoption?access_token=ACCESS_TOKEN
+ * 文档地址:https://developers.weixin.qq.com/doc/offiaccount/Shopping_Guide/tag-account/shopping-guide.delguidetagoption.html
+ *
+ *
+ * @param tagName 标签类型的名字
+ * @throws WxErrorException 。
+ */
+ void delGuideTagOption(String tagName) throws WxErrorException;
+
+ /**
+ * 为标签添加可选值
+ *
+ *
+ * 请求地址: POST https://api.weixin.qq.com/cgi-bin/guide/addguidetagoption?access_token=ACCESS_TOKEN
+ * 文档地址:https://developers.weixin.qq.com/doc/offiaccount/Shopping_Guide/tag-account/shopping-guide.addGuideTagOption.html
+ *
+ *
+ * @param tagName 标签类型的名字
+ * @param values 标签可选值列表,可选值不能为空值,所有的标签可选值不能有相等重复的值
+ * @throws WxErrorException 。
+ */
+ void addGuideTagOption(String tagName, List values) throws WxErrorException;
+
+ /**
+ * 获取标签和可选值
+ *
+ *
+ * 请求地址: POST https://api.weixin.qq.com/cgi-bin/guide/getguidetagoption?access_token=ACCESS_TOKEN
+ * 文档地址:https://developers.weixin.qq.com/doc/offiaccount/Shopping_Guide/tag-account/shopping-guide.getGuideTagOption.html
+ *
+ *
+ * @return 标签信息列表
+ */
+ List getGuideTagOption() throws WxErrorException;
+
+ /**
+ * 为客户设置标签(批量)
+ *
+ *
+ * 请求地址: POST https://api.weixin.qq.com/cgi-bin/guide/addguidebuyertag?access_token=ACCESS_TOKEN
+ * 文档地址:https://developers.weixin.qq.com/doc/offiaccount/Shopping_Guide/tag-account/shopping-guide.addGuideBuyerTag.html
+ *
+ *
+ * @param account 顾问微信号(guide_account和guide_openid二选一)
+ * @param openid 顾问openid或者unionid(guide_account和guide_openid二选一)
+ * @param value 标签的可选值,该值必须在标签的可选值集合中
+ * @param userOpenIds 客户列表,不超过200
+ * @return 客户列表添加结果
+ * @throws WxErrorException .
+ */
+ List addGuideBuyerTag(String account, String openid, String value, List userOpenIds) throws WxErrorException;
+
+ /**
+ * 为客户设置标签(单个)
+ *
+ * @param account 顾问微信号(guide_account和guide_openid二选一)
+ * @param openid 顾问openid或者unionid(guide_account和guide_openid二选一)
+ * @param value 标签的可选值,该值必须在标签的可选值集合中
+ * @param userOpenid 用户openid
+ * @throws WxErrorException .
+ */
+ void addGuideBuyerTag(String account, String openid, String value, String userOpenid) throws WxErrorException;
+
+ /**
+ * 查询客户标签
+ *
+ *
+ * 请求地址: POST https://api.weixin.qq.com/cgi-bin/guide/getguidebuyertag?access_token=ACCESS_TOKEN
+ * 文档地址:https://developers.weixin.qq.com/doc/offiaccount/Shopping_Guide/tag-account/shopping-guide.getGuideBuyerTag.html
+ *
+ *
+ * 踩坑记录(2021/5/12):这里不只是返回标签值
+ * 如果该客户设置了自定义信息也会同样返回在标签数组的末尾
+ * 未设置则只返回客户标签列表
+ * 为此坑我添加一个参数是否排除客户自定义信息
+ *
+ * @param account 顾问微信号(guide_account和guide_openid二选一)
+ * @param openid 顾问openid或者unionid(guide_account和guide_openid二选一)
+ * @param userOpenid 用户openid
+ * @param isExclude 是否排除客户自定义信息
+ * @return 标签值列表
+ * @throws WxErrorException 。
+ */
+ List getGuideBuyerTag(String account, String openid, String userOpenid, Boolean isExclude) throws WxErrorException;
+
+ /**
+ * 根据标签值筛选客户
+ *
+ *
+ * 请求地址: POST https://api.weixin.qq.com/cgi-bin/guide/queryguidebuyerbytag?access_token=ACCESS_TOKEN
+ * 文档地址:https://developers.weixin.qq.com/doc/offiaccount/Shopping_Guide/tag-account/shopping-guide.queryGuideBuyerByTag.html
+ *
+ *
+ * 踩坑记录(2021/5/12): 不传递pushCount参数会返回-1
+ * 传递0查询所有 (推荐传递0)
+ * 当pushCount > 0 该条件查询逻辑有问题
+ * 目前发现:传递1可以查询出可发次数为4次的用户,而传递4是查询不出来的。
+ *
+ * 注意:该查询是查询所有条件均符合的 例如:查询A标签的客户 假如客户标签为A,B两个 将无法查询到该客户
+ *
+ * @param account 顾问微信号(guide_account和guide_openid二选一)
+ * @param openid 顾问openid或者unionid(guide_account和guide_openid二选一)
+ * @param pushCount 本月还可主动发消息次数 (建议传递0查询)
+ * @param value 标签值集合,该值必须在标签可选值集合中
+ * @return 客户openid集合
+ * @throws WxErrorException 。
+ */
+ List queryGuideBuyerByTag(String account, String openid, Integer pushCount, List value) throws WxErrorException;
+
+ /**
+ * 删除客户标签(批量)
+ *
+ *
+ * 请求地址: POST https://api.weixin.qq.com/cgi-bin/guide/delguidebuyertag?access_token=ACCESS_TOKEN
+ * 文档地址:https://developers.weixin.qq.com/doc/offiaccount/Shopping_Guide/tag-account/shopping-guide.delGuideBuyerTag.html
+ *
+ *
+ * @param account 顾问微信号(guide_account和guide_openid二选一)
+ * @param openid 顾问openid或者unionid(guide_account和guide_openid二选一)
+ * @param value 标签的可选值,该值必须在标签的可选值集合中
+ * @param userOpenIds 客户列表,不超过200
+ * @return 客户列表处理结果
+ * @throws WxErrorException。
+ */
+ List delGuideBuyerTag(String account, String openid, String value, List userOpenIds) throws WxErrorException;
+
+ /**
+ * 删除客户标签(单个)
+ *
+ * @param account 顾问微信号(guide_account和guide_openid二选一)
+ * @param openid 顾问openid或者unionid(guide_account和guide_openid二选一)
+ * @param value 标签的可选值,该值必须在标签的可选值集合中
+ * @param userOpenid 用户openid
+ * @throws WxErrorException .
+ */
+ void delGuideBuyerTag(String account, String openid, String value, String userOpenid) throws WxErrorException;
+
+ /**
+ * 设置自定义客户信息
+ *
+ *
+ * 请求地址: POST https://api.weixin.qq.com/cgi-bin/guide/addguidebuyerdisplaytag?access_token=ACCESS_TOKEN
+ * 文档地址:https://developers.weixin.qq.com/doc/offiaccount/Shopping_Guide/tag-account/shopping-guide.addGuideBuyerDisplayTag.html
+ *
+ *
+ * @param account 顾问微信号(guide_account和guide_openid二选一)
+ * @param openid 顾问openid或者unionid(guide_account和guide_openid二选一)
+ * @param userOpenid 用户openid
+ * @param msgList 自定义客户信息,全量更新,调用时传所有信息
+ * @throws WxErrorException .
+ */
+ void addGuideBuyerDisplayTag(String account, String openid, String userOpenid, List msgList) throws WxErrorException;
+
+ /**
+ * 获取自定义客户信息
+ *
+ *
+ * 请求地址: POST https://api.weixin.qq.com/cgi-bin/guide/getguidebuyerdisplaytag?access_token=ACCESS_TOKEN
+ * 文档地址:https://developers.weixin.qq.com/doc/offiaccount/Shopping_Guide/tag-account/shopping-guide.getGuideBuyerDisplayTag.html
+ *
+ *
+ * @param account 顾问微信号(guide_account和guide_openid二选一)
+ * @param openid 顾问openid或者unionid(guide_account和guide_openid二选一)
+ * @param userOpenid 用户openid
+ * @return 自定义客户信息列表
+ * @throws WxErrorException 。
+ */
+ List getGuideBuyerDisplayTag(String account, String openid, String userOpenid) throws WxErrorException;
+
+}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpService.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpService.java
index eff7ed63af..4e8cb96987 100644
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpService.java
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpService.java
@@ -1,13 +1,13 @@
package me.chanjar.weixin.mp.api;
import com.google.gson.JsonObject;
-import me.chanjar.weixin.common.service.WxImgProcService;
-import me.chanjar.weixin.common.service.WxOcrService;
import me.chanjar.weixin.common.bean.WxJsapiSignature;
import me.chanjar.weixin.common.bean.WxNetCheckResult;
import me.chanjar.weixin.common.enums.TicketType;
import me.chanjar.weixin.common.error.WxErrorException;
+import me.chanjar.weixin.common.service.WxImgProcService;
import me.chanjar.weixin.common.service.WxOAuth2Service;
+import me.chanjar.weixin.common.service.WxOcrService;
import me.chanjar.weixin.common.service.WxService;
import me.chanjar.weixin.common.util.http.MediaUploadRequestExecutor;
import me.chanjar.weixin.common.util.http.RequestExecutor;
@@ -720,4 +720,60 @@ public interface WxMpService extends WxService {
* @param guideService the guide service
*/
void setGuideService(WxMpGuideService guideService);
+
+ /**
+ * Gets guideBuyer service.
+ *
+ * @return the guideBuyer service
+ */
+ WxMpGuideBuyerService getGuideBuyerService();
+
+ /**
+ * Sets guideBuyer service.
+ *
+ * @param guideBuyerService the guideBuyer service
+ */
+ void setGuideBuyerService(WxMpGuideBuyerService guideBuyerService);
+
+ /**
+ * Gets guideTag service.
+ *
+ * @return the guide service
+ */
+ WxMpGuideTagService getGuideTagService();
+
+ /**
+ * Sets guideTag service.
+ *
+ * @param guideTagService the guideTag service
+ */
+ void setGuideTagService(WxMpGuideTagService guideTagService);
+
+ /**
+ * Gets guideMaterial service.
+ *
+ * @return the guideMaterial service
+ */
+ WxMpGuideMaterialService getGuideMaterialService();
+
+ /**
+ * Sets guideMaterial service.
+ *
+ * @param guideMaterialService the guideMaterial service
+ */
+ void setGuideMaterialService(WxMpGuideMaterialService guideMaterialService);
+
+ /**
+ * Gets guideMassedJob service.
+ *
+ * @return the guideMassedJob service
+ */
+ WxMpGuideMassedJobService getGuideMassedJobService();
+
+ /**
+ * Sets guide service.
+ *
+ * @param guideMassedJobService the guide service
+ */
+ void setGuideMassedJobService(WxMpGuideMassedJobService guideMassedJobService);
}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/BaseWxMpServiceImpl.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/BaseWxMpServiceImpl.java
index fc0aceade6..d340c6dc4d 100644
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/BaseWxMpServiceImpl.java
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/BaseWxMpServiceImpl.java
@@ -8,8 +8,6 @@
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.api.WxConsts;
-import me.chanjar.weixin.common.service.WxImgProcService;
-import me.chanjar.weixin.common.service.WxOcrService;
import me.chanjar.weixin.common.bean.ToJson;
import me.chanjar.weixin.common.bean.WxAccessToken;
import me.chanjar.weixin.common.bean.WxJsapiSignature;
@@ -19,7 +17,9 @@
import me.chanjar.weixin.common.error.WxError;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.common.error.WxRuntimeException;
+import me.chanjar.weixin.common.service.WxImgProcService;
import me.chanjar.weixin.common.service.WxOAuth2Service;
+import me.chanjar.weixin.common.service.WxOcrService;
import me.chanjar.weixin.common.session.StandardSessionManager;
import me.chanjar.weixin.common.session.WxSessionManager;
import me.chanjar.weixin.common.util.DataUtils;
@@ -124,6 +124,18 @@ public abstract class BaseWxMpServiceImpl implements WxMpService, RequestH
@Getter
@Setter
private WxMpGuideService guideService = new WxMpGuideServiceImpl(this);
+ @Getter
+ @Setter
+ private WxMpGuideBuyerService guideBuyerService = new WxMpGuideBuyerServiceImpl(this);
+ @Getter
+ @Setter
+ private WxMpGuideTagService guideTagService = new WxMpGuideTagServiceImpl(this);
+ @Getter
+ @Setter
+ private WxMpGuideMassedJobService guideMassedJobService = new WxMpGuideMassedJobServiceImpl(this);
+ @Getter
+ @Setter
+ private WxMpGuideMaterialService guideMaterialService = new WxMpGuideMaterialServiceImpl(this);
@Getter
@Setter
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpGuideBuyerServiceImpl.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpGuideBuyerServiceImpl.java
new file mode 100644
index 0000000000..94c07ad4db
--- /dev/null
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpGuideBuyerServiceImpl.java
@@ -0,0 +1,118 @@
+package me.chanjar.weixin.mp.api.impl;
+
+import com.google.gson.reflect.TypeToken;
+import lombok.AllArgsConstructor;
+import me.chanjar.weixin.common.error.WxErrorException;
+import me.chanjar.weixin.common.util.json.GsonHelper;
+import me.chanjar.weixin.common.util.json.GsonParser;
+import me.chanjar.weixin.common.util.json.WxGsonBuilder;
+import me.chanjar.weixin.mp.api.WxMpGuideBuyerService;
+import me.chanjar.weixin.mp.api.WxMpService;
+import me.chanjar.weixin.mp.bean.guide.*;
+import me.chanjar.weixin.mp.enums.WxMpApiUrl;
+
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author 广州跨界-宋心成
+ * @date 2021/5/13/013
+ */
+@AllArgsConstructor
+public class WxMpGuideBuyerServiceImpl implements WxMpGuideBuyerService {
+ private static final String ACCOUNT = "guide_account";
+ private static final String OPENID = "guide_openid";
+ private final WxMpService mpService;
+
+ @Override
+ public List addGuideBuyerRelation(String account, String openid, List infos) throws WxErrorException {
+ Map body = new LinkedHashMap<>();
+ body.put(ACCOUNT, account);
+ body.put(OPENID, openid);
+ body.put("buyer_list", infos);
+
+ String json = this.mpService.post(WxMpApiUrl.Guide.ADD_GUIDE_BUYER_RELATION, body);
+ return WxGsonBuilder.create().fromJson(GsonParser.parse(json).getAsJsonArray("buyer_resp"),
+ new TypeToken>() {
+ }.getType());
+ }
+
+ @Override
+ public void addGuideBuyerRelation(String account, String openid, String userOpenid, String nickname) throws WxErrorException {
+ this.mpService.post(WxMpApiUrl.Guide.ADD_GUIDE_BUYER_RELATION,
+ GsonHelper.buildJsonObject(ACCOUNT, account, OPENID, openid, "openid", userOpenid, "buyer_nickname", nickname));
+ }
+
+ @Override
+ public List delGuideBuyerRelation(String account, String openid, List buyerOpenIds) throws WxErrorException {
+ Map body = new LinkedHashMap<>();
+ body.put(ACCOUNT, account);
+ body.put(OPENID, openid);
+ body.put("openid_list", buyerOpenIds);
+
+ String json = this.mpService.post(WxMpApiUrl.Guide.DEL_GUIDE_BUYER_RELATION, body);
+ return WxGsonBuilder.create().fromJson(GsonParser.parse(json).getAsJsonArray("buyer_resp"),
+ new TypeToken>() {
+ }.getType());
+ }
+
+ @Override
+ public void delGuideBuyerRelation(String account, String openid, String userOpenid) throws WxErrorException {
+ this.mpService.post(WxMpApiUrl.Guide.DEL_GUIDE_BUYER_RELATION,
+ GsonHelper.buildJsonObject(ACCOUNT, account, OPENID, openid, "openid", userOpenid));
+ }
+
+ @Override
+ public WxMpGuideBuyerInfoList getGuideBuyerRelationList(String account, String openid, int page, int num) throws WxErrorException {
+ return WxMpGuideBuyerInfoList.fromJson(this.mpService.post(WxMpApiUrl.Guide.GET_GUIDE_BUYER_RELATION_LIST,
+ GsonHelper.buildJsonObject(ACCOUNT, account, OPENID, openid, "page", page, "num", num)));
+ }
+
+ @Override
+ public List rebindGuideAcctForBuyer(String oldAccount, String oldOpenid, String account, String openid, List buyerOpenIds) throws WxErrorException {
+ Map body = new LinkedHashMap<>();
+ body.put("old_guide_account", oldAccount);
+ body.put("old_guide_openid", oldOpenid);
+ body.put("new_guide_account", account);
+ body.put("new_guide_openid", openid);
+ body.put("openid_list", buyerOpenIds);
+
+ String json = this.mpService.post(WxMpApiUrl.Guide.REBIND_GUIDE_ACCT_FOR_BUYER, body);
+ return WxGsonBuilder.create().fromJson(GsonParser.parse(json).getAsJsonArray("buyer_resp"),
+ new TypeToken>() {
+ }.getType());
+ }
+
+ @Override
+ public void rebindGuideAcctForBuyer(String oldAccount, String oldOpenid, String account, String openid, String userOpenid) throws WxErrorException {
+ Map body = new LinkedHashMap<>();
+ body.put("old_guide_account", oldAccount);
+ body.put("old_guide_openid", oldOpenid);
+ body.put("new_guide_account", account);
+ body.put("new_guide_openid", openid);
+ body.put("openid", userOpenid);
+
+ this.mpService.post(WxMpApiUrl.Guide.REBIND_GUIDE_ACCT_FOR_BUYER, body);
+ }
+
+ @Override
+ public void updateGuideBuyerRelation(String account, String openid, String userOpenid, String nickname) throws WxErrorException {
+ this.mpService.post(WxMpApiUrl.Guide.UPDATE_GUIDE_BUYER_RELATION,
+ GsonHelper.buildJsonObject(ACCOUNT, account, OPENID, openid,
+ "openid", userOpenid, "buyer_nickname", nickname));
+ }
+
+ @Override
+ public WxMpGuideBuyerRelation getGuideBuyerRelationByBuyer(String openid) throws WxErrorException {
+ return WxMpGuideBuyerRelation.fromJson(this.mpService.post(WxMpApiUrl.Guide.GET_GUIDE_BUYER_RELATION_BY_BUYER,
+ GsonHelper.buildJsonObject("openid", openid)));
+ }
+
+ @Override
+ public WxMpGuideBuyerInfo getGuideBuyerRelation(String account, String openid, String userOpenid) throws WxErrorException {
+ return WxMpGuideBuyerInfo.fromJson(this.mpService.post(WxMpApiUrl.Guide.GET_GUIDE_BUYER_RELATION,
+ GsonHelper.buildJsonObject(ACCOUNT, account, OPENID, openid,
+ "openid", userOpenid)));
+ }
+}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpGuideMassedJobServiceImpl.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpGuideMassedJobServiceImpl.java
new file mode 100644
index 0000000000..9bc7881b6d
--- /dev/null
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpGuideMassedJobServiceImpl.java
@@ -0,0 +1,80 @@
+package me.chanjar.weixin.mp.api.impl;
+
+import com.google.gson.reflect.TypeToken;
+import lombok.AllArgsConstructor;
+import me.chanjar.weixin.common.error.WxErrorException;
+import me.chanjar.weixin.common.util.json.GsonHelper;
+import me.chanjar.weixin.common.util.json.GsonParser;
+import me.chanjar.weixin.common.util.json.WxGsonBuilder;
+import me.chanjar.weixin.mp.api.WxMpGuideMassedJobService;
+import me.chanjar.weixin.mp.api.WxMpService;
+import me.chanjar.weixin.mp.bean.guide.WxMpGuideMassed;
+import me.chanjar.weixin.mp.bean.guide.WxMpGuideMassedInfo;
+import me.chanjar.weixin.mp.bean.guide.WxMpGuideMaterialInfo;
+import me.chanjar.weixin.mp.enums.WxMpApiUrl;
+
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author 广州跨界-宋心成
+ * @date 2021/5/13/013
+ */
+@AllArgsConstructor
+public class WxMpGuideMassedJobServiceImpl implements WxMpGuideMassedJobService {
+ private static final String ACCOUNT = "guide_account";
+ private static final String OPENID = "guide_openid";
+ private final WxMpService mpService;
+
+ @Override
+ public WxMpGuideMassed addGuideMassedJob(String account, String openid, String taskName, String taskRemark, Long pushTime, List userOpenIds, List materialInfos) throws WxErrorException {
+ Map body = new LinkedHashMap<>();
+ body.put(ACCOUNT, account);
+ body.put(OPENID, openid);
+ body.put("task_name", taskName);
+ body.put("task_remark", taskRemark);
+ body.put("push_time", pushTime);
+ body.put("openid", userOpenIds);
+ body.put("material", materialInfos);
+ String returnString = this.mpService.post(WxMpApiUrl.Guide.ADD_GUIDE_MASSED_JOB, body);
+ return WxMpGuideMassed.fromJson(GsonParser.parse(returnString).getAsJsonArray("task_result").get(0));
+ }
+
+ @Override
+ public List getGuideMassedJobList(String account, String openid, List taskStatus, Integer offset, Integer limit) throws WxErrorException {
+ Map body = new LinkedHashMap<>();
+ body.put(ACCOUNT, account);
+ body.put(OPENID, openid);
+ body.put("task_status", taskStatus);
+ body.put("offset", offset);
+ body.put("limit", limit);
+ String returnString = this.mpService.post(WxMpApiUrl.Guide.GET_GUIDE_MASSED_JOB_LIST, body);
+ return WxGsonBuilder.create().fromJson(GsonParser.parse(returnString).getAsJsonArray("list"),
+ new TypeToken>() {
+ }.getType());
+ }
+
+ @Override
+ public WxMpGuideMassedInfo getGuideMassedJob(String taskId) throws WxErrorException {
+ String returnString = this.mpService.post(WxMpApiUrl.Guide.GET_GUIDE_MASSED_JOB, GsonHelper.buildJsonObject("task_id", taskId));
+ return WxMpGuideMassedInfo.fromJson(GsonParser.parse(returnString).get("job"));
+ }
+
+ @Override
+ public void updateGuideMassedJob(String taskId, String taskName, String taskRemark, Long pushTime, List userOpenIds, List materialInfos) throws WxErrorException {
+ Map body = new LinkedHashMap<>();
+ body.put("task_id", taskId);
+ body.put("task_name", taskName);
+ body.put("task_remark", taskRemark);
+ body.put("push_time", pushTime);
+ body.put("openid", userOpenIds);
+ body.put("material", materialInfos);
+ this.mpService.post(WxMpApiUrl.Guide.UPDATE_GUIDE_MASSED_JOB, body);
+ }
+
+ @Override
+ public void cancelGuideMassedJob(String taskId) throws WxErrorException {
+ this.mpService.post(WxMpApiUrl.Guide.CANCEL_GUIDE_MASSED_JOB, GsonHelper.buildJsonObject("task_id", taskId));
+ }
+}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpGuideMaterialServiceImpl.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpGuideMaterialServiceImpl.java
new file mode 100644
index 0000000000..0584d82460
--- /dev/null
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpGuideMaterialServiceImpl.java
@@ -0,0 +1,96 @@
+package me.chanjar.weixin.mp.api.impl;
+
+import com.google.gson.reflect.TypeToken;
+import lombok.AllArgsConstructor;
+import me.chanjar.weixin.common.error.WxErrorException;
+import me.chanjar.weixin.common.util.json.GsonHelper;
+import me.chanjar.weixin.common.util.json.GsonParser;
+import me.chanjar.weixin.common.util.json.WxGsonBuilder;
+import me.chanjar.weixin.mp.api.WxMpGuideMaterialService;
+import me.chanjar.weixin.mp.api.WxMpService;
+import me.chanjar.weixin.mp.bean.guide.WxMpGuideCardMaterialInfo;
+import me.chanjar.weixin.mp.bean.guide.WxMpGuideImgMaterialInfoList;
+import me.chanjar.weixin.mp.bean.guide.WxMpGuideWordMaterialInfoList;
+import me.chanjar.weixin.mp.enums.WxMpApiUrl;
+
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author 广州跨界-宋心成
+ * @date 2021/5/13/013
+ */
+@AllArgsConstructor
+public class WxMpGuideMaterialServiceImpl implements WxMpGuideMaterialService {
+ private static final String ACCOUNT = "guide_account";
+ private static final String OPENID = "guide_openid";
+ private final WxMpService mpService;
+
+ @Override
+ public void setGuideCardMaterial(String mediaId, int type, String title, String path, String appId) throws WxErrorException {
+ Map body = new LinkedHashMap<>();
+ body.put("type", type);
+ body.put("media_id", mediaId);
+ body.put("title", title);
+ body.put("path", path);
+ body.put("appid", appId);
+ this.mpService.post(WxMpApiUrl.Guide.SET_GUIDE_CARD_MATERIAL, body);
+ }
+
+ @Override
+ public List getGuideCardMaterial(int type) throws WxErrorException {
+ String returnString = this.mpService.post(WxMpApiUrl.Guide.GET_GUIDE_CARD_MATERIAL, GsonHelper.buildJsonObject("type", type));
+ return WxGsonBuilder.create().fromJson(GsonParser.parse(returnString).getAsJsonArray("card_list"),
+ new TypeToken>() {
+ }.getType());
+ }
+
+ @Override
+ public void delGuideCardMaterial(int type, String title, String path, String appId) throws WxErrorException {
+ Map body = new LinkedHashMap<>();
+ body.put("type", type);
+ body.put("title", title);
+ body.put("path", path);
+ body.put("appid", appId);
+ this.mpService.post(WxMpApiUrl.Guide.DEL_GUIDE_CARD_MATERIAL, body);
+ }
+
+ @Override
+ public void setGuideImageMaterial(String mediaId, int type) throws WxErrorException {
+ this.mpService.post(WxMpApiUrl.Guide.SET_GUIDE_IMAGE_MATERIAL,
+ GsonHelper.buildJsonObject("media_id", mediaId, "type", type));
+ }
+
+ @Override
+ public WxMpGuideImgMaterialInfoList getGuideImageMaterial(int type, int start, int num) throws WxErrorException {
+ String returnString = this.mpService.post(WxMpApiUrl.Guide.GET_GUIDE_IMAGE_MATERIAL,
+ GsonHelper.buildJsonObject("type", type, "start", start, "num", num));
+ return WxMpGuideImgMaterialInfoList.fromJson(returnString);
+ }
+
+ @Override
+ public void delGuideImageMaterial(int type, String picUrl) throws WxErrorException {
+ this.mpService.post(WxMpApiUrl.Guide.DEL_GUIDE_IMAGE_MATERIAL,
+ GsonHelper.buildJsonObject("type", type, "picurl", picUrl));
+ }
+
+ @Override
+ public void setGuideWordMaterial(int type, String word) throws WxErrorException {
+ this.mpService.post(WxMpApiUrl.Guide.SET_GUIDE_WORD_MATERIAL,
+ GsonHelper.buildJsonObject("type", type, "word", word));
+ }
+
+ @Override
+ public WxMpGuideWordMaterialInfoList getGuideWordMaterial(int type, int start, int num) throws WxErrorException {
+ String returnString = this.mpService.post(WxMpApiUrl.Guide.GET_GUIDE_WORD_MATERIAL,
+ GsonHelper.buildJsonObject("type", type, "start", start, "num", num));
+ return WxMpGuideWordMaterialInfoList.fromJson(returnString);
+ }
+
+ @Override
+ public void delGuideWordMaterial(int type, String word) throws WxErrorException {
+ this.mpService.post(WxMpApiUrl.Guide.DEL_GUIDE_WORD_MATERIAL,
+ GsonHelper.buildJsonObject("type", type, "word", word));
+ }
+}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpGuideServiceImpl.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpGuideServiceImpl.java
index 51513fbfe7..3fb47d0971 100644
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpGuideServiceImpl.java
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpGuideServiceImpl.java
@@ -1,14 +1,22 @@
package me.chanjar.weixin.mp.api.impl;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonObject;
+import com.google.gson.reflect.TypeToken;
import lombok.AllArgsConstructor;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.common.util.json.GsonHelper;
+import me.chanjar.weixin.common.util.json.GsonParser;
+import me.chanjar.weixin.common.util.json.WxGsonBuilder;
import me.chanjar.weixin.mp.api.WxMpGuideService;
import me.chanjar.weixin.mp.api.WxMpService;
-import me.chanjar.weixin.mp.bean.guide.WxMpGuideInfo;
-import me.chanjar.weixin.mp.bean.guide.WxMpGuideList;
+import me.chanjar.weixin.mp.bean.guide.*;
import me.chanjar.weixin.mp.enums.WxMpApiUrl;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
/**
* .
*
@@ -63,4 +71,133 @@ public WxMpGuideList listGuide(int page, int num) throws WxErrorException {
return WxMpGuideList.fromJson(this.mpService.post(WxMpApiUrl.Guide.LIST_GUIDE,
GsonHelper.buildJsonObject("page", page, "num", num)));
}
+
+ @Override
+ public String createGuideQrCode(String account, String openid, String qrcodeInfo) throws WxErrorException {
+ String json = this.mpService.post(WxMpApiUrl.Guide.CREATE_QR_CODE,
+ GsonHelper.buildJsonObject(ACCOUNT, account, OPENID, openid, "qrcode_info", qrcodeInfo));
+ return GsonParser.parse(json).get("qrcode_url").toString().replaceAll("\"","");
+ }
+
+ @Override
+ public WxMpGuideMsgList getGuideChatRecord(String account, String openid, String clientOpenid, Long beginTime, Long endTime, int page, int num) throws WxErrorException {
+ return WxMpGuideMsgList.fromJson(this.mpService.post(WxMpApiUrl.Guide.GET_GUIDE_CHAT_RECORD,
+ GsonHelper.buildJsonObject(ACCOUNT, account, OPENID, openid,
+ "begin_time", beginTime,
+ "end_time", endTime,
+ "page", page,
+ "num", num)
+ ));
+ }
+
+ @Override
+ public void setGuideConfig(String account, String openid, boolean isDelete, List guideFastReplyList, WxMpAddGuideAutoReply guideAutoReply,WxMpAddGuideAutoReply guideAutoReplyPlus) throws WxErrorException {
+ JsonArray jsonArray = null;
+ if (guideFastReplyList != null) {
+ jsonArray = new JsonArray();
+ for (String it : guideFastReplyList) {
+ JsonObject jsonObject = new JsonObject();
+ jsonObject.addProperty("content", it);
+ jsonArray.add(jsonObject);
+ }
+ }
+ Map body = new LinkedHashMap<>();
+ body.put(ACCOUNT, account);
+ body.put(OPENID, openid);
+ body.put("is_delete", isDelete);
+ body.put("guide_fast_reply_list", jsonArray);
+ body.put("guide_auto_reply", guideAutoReply);
+ body.put("guide_auto_reply_plus", guideAutoReplyPlus);
+
+ this.mpService.post(WxMpApiUrl.Guide.SET_GUIDE_CONFIG,body);
+ }
+
+ @Override
+ public WxMpGuideConfig getGuideConfig(String account, String openid) throws WxErrorException {
+ return WxMpGuideConfig.fromJson(this.mpService.post(WxMpApiUrl.Guide.GET_GUIDE_CONFIG,
+ GsonHelper.buildJsonObject(ACCOUNT, account, OPENID, openid)));
+ }
+
+ @Override
+ public void setGuideAcctConfig(boolean isDelete, List blackKeyWord, String guideAutoReply) throws WxErrorException {
+ JsonObject jsonObject1 = null;
+ if (blackKeyWord != null && blackKeyWord.size() > 0) {
+ jsonObject1 = new JsonObject();
+ JsonArray jsonArray = new JsonArray();
+ blackKeyWord.forEach(jsonArray::add);
+ jsonObject1.add("values", jsonArray);
+ }
+
+ JsonObject jsonObject2 = null;
+ if (guideAutoReply != null) {
+ jsonObject2 = new JsonObject();
+ jsonObject2.addProperty("content", guideAutoReply);
+ }
+
+ this.mpService.post(WxMpApiUrl.Guide.SET_GUIDE_ACCT_CONFIG,
+ GsonHelper.buildJsonObject(
+ "is_delete", isDelete,
+ "black_keyword", jsonObject1,
+ "guide_auto_reply", jsonObject2));
+ }
+
+ @Override
+ public WxMpGuideAcctConfig getGuideAcctConfig() throws WxErrorException {
+ return WxMpGuideAcctConfig.fromJson(this.mpService.post(WxMpApiUrl.Guide.GET_GUIDE_ACCT_CONFIG, new JsonObject()));
+ }
+
+ @Override
+ public void pushShowWxaPathMenu(String appId, String userName) throws WxErrorException {
+ this.mpService.post(WxMpApiUrl.Guide.PUSH_SHOW_WX_PATH_MENU,
+ GsonHelper.buildJsonObject("wxa_appid", appId, "wx_username", userName));
+ }
+
+ @Override
+ public Long newGuideGroup(String groupName) throws WxErrorException {
+ String json = this.mpService.post(WxMpApiUrl.Guide.NEW_GUIDE_GROUP,
+ GsonHelper.buildJsonObject("group_name", groupName));
+ return Long.valueOf(GsonParser.parse(json).get("group_id").toString());
+ }
+
+ @Override
+ public List getGuideGroupList() throws WxErrorException {
+ String json = this.mpService.post(WxMpApiUrl.Guide.GET_GUIDE_GROUP_LIST, new JsonObject());
+ return WxGsonBuilder.create().fromJson(GsonParser.parse(json).getAsJsonArray("group_list"),
+ new TypeToken>() {
+ }.getType());
+ }
+
+ @Override
+ public WxMpGuideGroupInfoList getGroupInfo(long groupId, int page, int num) throws WxErrorException {
+ return WxMpGuideGroupInfoList.fromJson(this.mpService.post(WxMpApiUrl.Guide.GET_GROUP_GUIDE_INFO,
+ GsonHelper.buildJsonObject("group_id", groupId, "page", page, "num", num)
+ ));
+ }
+
+ @Override
+ public void addGuide2GuideGroup(long groupId, String account) throws WxErrorException {
+ this.mpService.post(WxMpApiUrl.Guide.ADD_GROUP_GUIDE,
+ GsonHelper.buildJsonObject("group_id", groupId, ACCOUNT, account));
+ }
+
+ @Override
+ public void delGuide2GuideGroup(long groupId, String account) throws WxErrorException {
+ this.mpService.post(WxMpApiUrl.Guide.DEL_GROUP_GUIDE,
+ GsonHelper.buildJsonObject("group_id", groupId, ACCOUNT, account));
+ }
+
+ @Override
+ public List getGroupByGuide(String account) throws WxErrorException {
+ String json = this.mpService.post(WxMpApiUrl.Guide.GET_GROUP_ON_GUIDE,
+ GsonHelper.buildJsonObject(ACCOUNT, account));
+ return WxGsonBuilder.create().fromJson(GsonParser.parse(json).getAsJsonArray("group_id_list"),
+ new TypeToken>() {
+ }.getType());
+ }
+
+ @Override
+ public void delGuideGroup(long groupId) throws WxErrorException {
+ this.mpService.post(WxMpApiUrl.Guide.DEL_GROUP,
+ GsonHelper.buildJsonObject("group_id", groupId));
+ }
}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpGuideTagServiceImpl.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpGuideTagServiceImpl.java
new file mode 100644
index 0000000000..1bde21e9b2
--- /dev/null
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpGuideTagServiceImpl.java
@@ -0,0 +1,160 @@
+package me.chanjar.weixin.mp.api.impl;
+
+import com.google.gson.JsonObject;
+import com.google.gson.reflect.TypeToken;
+import lombok.AllArgsConstructor;
+import me.chanjar.weixin.common.error.WxErrorException;
+import me.chanjar.weixin.common.util.json.GsonHelper;
+import me.chanjar.weixin.common.util.json.GsonParser;
+import me.chanjar.weixin.common.util.json.WxGsonBuilder;
+import me.chanjar.weixin.mp.api.WxMpGuideTagService;
+import me.chanjar.weixin.mp.api.WxMpService;
+import me.chanjar.weixin.mp.bean.guide.WxMpGuideBuyerResp;
+import me.chanjar.weixin.mp.bean.guide.WxMpGuideTagInfo;
+import me.chanjar.weixin.mp.enums.WxMpApiUrl;
+
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * @author 广州跨界-宋心成
+ * @date 2021/5/13/013
+ */
+
+@AllArgsConstructor
+public class WxMpGuideTagServiceImpl implements WxMpGuideTagService {
+ private static final String ACCOUNT = "guide_account";
+ private static final String OPENID = "guide_openid";
+ private final WxMpService mpService;
+
+ @Override
+ public void newGuideTagOption(String tagName, List values) throws WxErrorException {
+ Map body = new LinkedHashMap<>();
+ body.put("tag_name", tagName);
+ body.put("tag_values", values);
+ this.mpService.post(WxMpApiUrl.Guide.NEW_GUIDE_TAG_OPTION, body);
+ }
+
+ @Override
+ public void delGuideTagOption(String tagName) throws WxErrorException {
+ this.mpService.post(WxMpApiUrl.Guide.DEL_GUIDE_TAG_OPTION, GsonHelper.buildJsonObject("tag_name", tagName));
+ }
+
+ @Override
+ public void addGuideTagOption(String tagName, List values) throws WxErrorException {
+ Map body = new LinkedHashMap<>();
+ body.put("tag_name", tagName);
+ body.put("tag_values", values);
+ this.mpService.post(WxMpApiUrl.Guide.ADD_GUIDE_TAG_OPTION, body);
+ }
+
+ @Override
+ public List getGuideTagOption() throws WxErrorException {
+ String returnString = this.mpService.post(WxMpApiUrl.Guide.GET_GUIDE_TAG_OPTION, new JsonObject());
+ List infoList = WxGsonBuilder.create().fromJson(GsonParser.parse(returnString).getAsJsonArray("options"),
+ new TypeToken>() {
+ }.getType());
+ return infoList.stream().filter(it -> !it.getTagName().equals("")).collect(Collectors.toList());
+ }
+
+ @Override
+ public List addGuideBuyerTag(String account, String openid, String value, List userOpenIds) throws WxErrorException {
+ Map body = new LinkedHashMap<>();
+ body.put(ACCOUNT, account);
+ body.put(OPENID, openid);
+ body.put("tag_value", value);
+ body.put("openid_list", userOpenIds);
+ String returnString = this.mpService.post(WxMpApiUrl.Guide.ADD_GUIDE_BUYER_TAG, body);
+ return WxGsonBuilder.create().fromJson(GsonParser.parse(returnString).getAsJsonArray("buyer_resp"),
+ new TypeToken>() {
+ }.getType());
+ }
+
+ @Override
+ public void addGuideBuyerTag(String account, String openid, String value, String userOpenid) throws WxErrorException {
+ Map body = new LinkedHashMap<>();
+ body.put(ACCOUNT, account);
+ body.put(OPENID, openid);
+ body.put("tag_value", value);
+ body.put("openid", userOpenid);
+ this.mpService.post(WxMpApiUrl.Guide.ADD_GUIDE_BUYER_TAG, body);
+ }
+
+ @Override
+ public List getGuideBuyerTag(String account, String openid, String userOpenid, Boolean isExclude) throws WxErrorException {
+ String returnString = this.mpService.post(WxMpApiUrl.Guide.GET_GUIDE_BUYER_TAG,
+ GsonHelper.buildJsonObject(ACCOUNT, account, OPENID, openid,
+ "openid", userOpenid));
+ List list = WxGsonBuilder.create().fromJson(GsonParser.parse(returnString).getAsJsonArray("tag_values"),
+ new TypeToken>() {
+ }.getType());
+ if (isExclude) {
+ if (list.size() > 0) {
+ if (list.get(list.size() - 1).contains("\n")) {
+ list.remove(list.size() - 1);
+ }
+ }
+ }
+ return list;
+ }
+
+ @Override
+ public List queryGuideBuyerByTag(String account, String openid, Integer pushCount, List value) throws WxErrorException {
+ Map body = new LinkedHashMap<>();
+ body.put(ACCOUNT, account);
+ body.put(OPENID, openid);
+ body.put("push_count", pushCount);
+ body.put("tag_value", value);
+ String returnString = this.mpService.post(WxMpApiUrl.Guide.QUERY_GUIDE_BUYER_BY_TAG, body);
+ return WxGsonBuilder.create().fromJson(GsonParser.parse(returnString).getAsJsonArray("openid_list"),
+ new TypeToken>() {
+ }.getType());
+ }
+
+ @Override
+ public List delGuideBuyerTag(String account, String openid, String value, List userOpenIds) throws WxErrorException {
+ Map body = new LinkedHashMap<>();
+ body.put(ACCOUNT, account);
+ body.put(OPENID, openid);
+ body.put("tag_value", value);
+ body.put("openid_list", userOpenIds);
+ String returnString = this.mpService.post(WxMpApiUrl.Guide.DEL_GUIDE_BUYER_TAG, body);
+ return WxGsonBuilder.create().fromJson(GsonParser.parse(returnString).getAsJsonArray("buyer_resp"),
+ new TypeToken>() {
+ }.getType());
+ }
+
+ @Override
+ public void delGuideBuyerTag(String account, String openid, String value, String userOpenid) throws WxErrorException {
+ Map body = new LinkedHashMap<>();
+ body.put(ACCOUNT, account);
+ body.put(OPENID, openid);
+ body.put("tag_value", value);
+ body.put("openid", userOpenid);
+ this.mpService.post(WxMpApiUrl.Guide.DEL_GUIDE_BUYER_TAG, body);
+ }
+
+ @Override
+ public void addGuideBuyerDisplayTag(String account, String openid, String userOpenid, List msgList) throws WxErrorException {
+ Map body = new LinkedHashMap<>();
+ body.put(ACCOUNT, account);
+ body.put(OPENID, openid);
+ body.put("openid", userOpenid);
+ body.put("display_tag_list", msgList);
+ this.mpService.post(WxMpApiUrl.Guide.ADD_GUIDE_BUYER_DISPLAY_TAG, body);
+ }
+
+ @Override
+ public List getGuideBuyerDisplayTag(String account, String openid, String userOpenid) throws WxErrorException {
+ Map body = new LinkedHashMap<>();
+ body.put(ACCOUNT, account);
+ body.put(OPENID, openid);
+ body.put("openid", userOpenid);
+ String returnString = this.mpService.post(WxMpApiUrl.Guide.GET_GUIDE_BUYER_DISPLAY_TAG, body);
+ return WxGsonBuilder.create().fromJson(GsonParser.parse(returnString).getAsJsonArray("display_tag_list"),
+ new TypeToken>() {
+ }.getType());
+ }
+}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpAddGuideAutoReply.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpAddGuideAutoReply.java
new file mode 100644
index 0000000000..87ad3cb3fc
--- /dev/null
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpAddGuideAutoReply.java
@@ -0,0 +1,44 @@
+package me.chanjar.weixin.mp.bean.guide;
+
+import com.google.gson.annotations.SerializedName;
+import lombok.Builder;
+import lombok.Data;
+import me.chanjar.weixin.common.bean.ToJson;
+import me.chanjar.weixin.common.util.json.WxGsonBuilder;
+
+import java.io.Serializable;
+
+/**
+ * 关注顾问自动回复(欢迎语)添加实体
+ *
+ * @author 广州跨界-宋心成
+ * @date 2021/5/8/008
+ */
+@Data
+@Builder
+public class WxMpAddGuideAutoReply implements ToJson, Serializable {
+ private static final long serialVersionUID = -3364721434924095836L;
+
+ /**
+ * 新客户关注自动回复内容
+ */
+ @SerializedName("content")
+ private String content;
+
+ /**
+ * 新客户关注自动回复内容类型
+ * 1表示文字,2表示图片,3表示小程序卡片
+ */
+ @SerializedName("msgtype")
+ private Integer msgType;
+
+
+ @Override
+ public String toJson() {
+ return WxGsonBuilder.create().toJson(this);
+ }
+
+ public static WxMpAddGuideAutoReply fromJson(String json) {
+ return WxGsonBuilder.create().fromJson(json, WxMpAddGuideAutoReply.class);
+ }
+}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpAddGuideBuyerInfo.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpAddGuideBuyerInfo.java
new file mode 100644
index 0000000000..caac651070
--- /dev/null
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpAddGuideBuyerInfo.java
@@ -0,0 +1,42 @@
+package me.chanjar.weixin.mp.bean.guide;
+
+import com.google.gson.annotations.SerializedName;
+import lombok.Builder;
+import lombok.Data;
+import me.chanjar.weixin.common.bean.ToJson;
+import me.chanjar.weixin.common.util.json.WxGsonBuilder;
+
+import java.io.Serializable;
+
+/**
+ * 客户信息dto
+ * @author 广州跨界-宋心成
+ * @date 2021/5/11/011
+ */
+
+@Data
+@Builder
+public class WxMpAddGuideBuyerInfo implements ToJson, Serializable {
+ private static final long serialVersionUID = -1703303970552268691L;
+
+ /**
+ * 客户的openId
+ */
+ @SerializedName("openid")
+ private String openid;
+
+ /**
+ * 客户的名称
+ */
+ @SerializedName("buyer_nickname")
+ private String nickname;
+
+ @Override
+ public String toJson() {
+ return WxGsonBuilder.create().toJson(this);
+ }
+
+ public static WxMpAddGuideBuyerInfo fromJson(String json) {
+ return WxGsonBuilder.create().fromJson(json, WxMpAddGuideBuyerInfo.class);
+ }
+}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideAcctConfig.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideAcctConfig.java
new file mode 100644
index 0000000000..fcd817a981
--- /dev/null
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideAcctConfig.java
@@ -0,0 +1,33 @@
+package me.chanjar.weixin.mp.bean.guide;
+
+import com.google.gson.annotations.SerializedName;
+import lombok.Data;
+import me.chanjar.weixin.common.util.json.WxGsonBuilder;
+
+import java.io.Serializable;
+
+/**
+ * 离线自动回复与敏感词
+ * @author 广州跨界-宋心成
+ * @date 2021/5/8/008
+ */
+@Data
+public class WxMpGuideAcctConfig implements Serializable {
+ private static final long serialVersionUID = -5941249630655543648L;
+
+ /**
+ * 敏感词
+ */
+ @SerializedName("black_keyword")
+ private WxMpGuideSensitiveWords guideSensitiveWords;
+
+ /**
+ * 离线自动回复内容
+ */
+ @SerializedName("guide_auto_reply")
+ private WxMpGuideOffLineReply guideOffLineReply;
+
+ public static WxMpGuideAcctConfig fromJson(String json) {
+ return WxGsonBuilder.create().fromJson(json, WxMpGuideAcctConfig.class);
+ }
+}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideAutoReply.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideAutoReply.java
new file mode 100644
index 0000000000..b0ea06a46d
--- /dev/null
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideAutoReply.java
@@ -0,0 +1,48 @@
+package me.chanjar.weixin.mp.bean.guide;
+
+import com.google.gson.annotations.SerializedName;
+import lombok.Data;
+import me.chanjar.weixin.common.bean.ToJson;
+import me.chanjar.weixin.common.util.json.WxGsonBuilder;
+
+import java.io.Serializable;
+
+/**
+ * 关注顾问自动回复(欢迎语)
+ *
+ * @author 广州跨界-宋心成
+ * @date 2021/5/8/008
+ */
+@Data
+public class WxMpGuideAutoReply implements ToJson, Serializable {
+
+ private static final long serialVersionUID = -3584275317132197695L;
+
+ /**
+ * 新客户关注自动回复内容
+ */
+ @SerializedName("content")
+ private String content;
+
+ /**
+ * 新客户关注自动回复内容类型
+ * 1表示文字,2表示图片,3表示小程序卡片
+ */
+ @SerializedName("msgtype")
+ private Integer msgType;
+
+ /**
+ * 修改时间
+ */
+ @SerializedName("updatetime")
+ private Long updateTime;
+
+ @Override
+ public String toJson() {
+ return WxGsonBuilder.create().toJson(this);
+ }
+
+ public static WxMpGuideAutoReply fromJson(String json) {
+ return WxGsonBuilder.create().fromJson(json, WxMpGuideAutoReply.class);
+ }
+}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideBuyerInfo.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideBuyerInfo.java
new file mode 100644
index 0000000000..a692c7d15e
--- /dev/null
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideBuyerInfo.java
@@ -0,0 +1,55 @@
+package me.chanjar.weixin.mp.bean.guide;
+
+import com.google.gson.annotations.SerializedName;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+import me.chanjar.weixin.common.bean.ToJson;
+import me.chanjar.weixin.common.util.json.WxGsonBuilder;
+
+import java.io.Serializable;
+
+/**
+ * 客户信息
+ *
+ * @author 广州跨界-宋心成
+ * @date 2021/5/10/010
+ */
+
+@Data
+@Builder
+@Accessors(chain = true)
+@NoArgsConstructor
+@AllArgsConstructor
+public class WxMpGuideBuyerInfo implements ToJson, Serializable {
+ private static final long serialVersionUID = -8076715937378141119L;
+
+ /**
+ * 客户的openId
+ */
+ @SerializedName("openid")
+ private String openid;
+
+ /**
+ * 客户的名称
+ */
+ @SerializedName("buyer_nickname")
+ private String nickname;
+
+ /**
+ * 创建时间戳
+ */
+ @SerializedName("create_time")
+ private Long createTime;
+
+ @Override
+ public String toJson() {
+ return WxGsonBuilder.create().toJson(this);
+ }
+
+ public static WxMpGuideBuyerInfo fromJson(String json) {
+ return WxGsonBuilder.create().fromJson(json, WxMpGuideBuyerInfo.class);
+ }
+}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideBuyerInfoList.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideBuyerInfoList.java
new file mode 100644
index 0000000000..530a7810c5
--- /dev/null
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideBuyerInfoList.java
@@ -0,0 +1,33 @@
+package me.chanjar.weixin.mp.bean.guide;
+
+import com.google.gson.annotations.SerializedName;
+import lombok.Data;
+import me.chanjar.weixin.common.util.json.WxGsonBuilder;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * 顾问的客户列表
+ * @author 广州跨界-宋心成
+ * @date 2021/5/11/011
+ */
+@Data
+public class WxMpGuideBuyerInfoList implements Serializable {
+ private static final long serialVersionUID = 9094928050460133322L;
+
+ /**
+ * 客户总数量
+ */
+ @SerializedName("total_num")
+ private Integer totalNum;
+
+ /**
+ * 客户列表
+ */
+ private List list;
+
+ public static WxMpGuideBuyerInfoList fromJson(String json) {
+ return WxGsonBuilder.create().fromJson(json, WxMpGuideBuyerInfoList.class);
+ }
+}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideBuyerRelation.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideBuyerRelation.java
new file mode 100644
index 0000000000..f4609937a8
--- /dev/null
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideBuyerRelation.java
@@ -0,0 +1,59 @@
+package me.chanjar.weixin.mp.bean.guide;
+
+import com.google.gson.annotations.SerializedName;
+import lombok.Data;
+import me.chanjar.weixin.common.bean.ToJson;
+import me.chanjar.weixin.common.util.json.WxGsonBuilder;
+
+import java.io.Serializable;
+
+/**
+ * 客户顾问关系
+ *
+ * @author 广州跨界-宋心成
+ * @date 2021/5/11/011
+ */
+
+@Data
+public class WxMpGuideBuyerRelation implements ToJson, Serializable {
+ private static final long serialVersionUID = 1531261524650705552L;
+
+ /**
+ * 顾问的微信帐号
+ */
+ @SerializedName("guide_account")
+ private String guideAccount;
+
+ /**
+ * 顾问的openid或者unionid
+ */
+ @SerializedName("guide_openid")
+ private String guideOpenid;
+
+ /**
+ * 客户的openId
+ */
+ @SerializedName("openid")
+ private String openid;
+
+ /**
+ * 客户的名称
+ */
+ @SerializedName("buyer_nickname")
+ private String nickname;
+
+ /**
+ * 创建时间戳
+ */
+ @SerializedName("create_time")
+ private Long createTime;
+
+ @Override
+ public String toJson() {
+ return WxGsonBuilder.create().toJson(this);
+ }
+
+ public static WxMpGuideBuyerRelation fromJson(String json) {
+ return WxGsonBuilder.create().fromJson(json, WxMpGuideBuyerRelation.class);
+ }
+}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideBuyerResp.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideBuyerResp.java
new file mode 100644
index 0000000000..f0707ebd7a
--- /dev/null
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideBuyerResp.java
@@ -0,0 +1,46 @@
+package me.chanjar.weixin.mp.bean.guide;
+
+import com.google.gson.annotations.SerializedName;
+import lombok.Data;
+import me.chanjar.weixin.common.bean.ToJson;
+import me.chanjar.weixin.common.util.json.WxGsonBuilder;
+
+import java.io.Serializable;
+
+/**
+ * 批量操作客户是否成功返回信息
+ * @author 广州跨界-宋心成
+ * @date 2021/5/10/010
+ */
+
+@Data
+public class WxMpGuideBuyerResp implements ToJson, Serializable {
+ private static final long serialVersionUID = -5628199106867822424L;
+
+ /**
+ * 错误码
+ */
+ @SerializedName("errcode")
+ private Integer errCode;
+
+ /**
+ * 错误信息
+ */
+ @SerializedName("errmsg")
+ private String errMsg;
+
+ /**
+ * 客户openid
+ */
+ @SerializedName("openid")
+ private String openid;
+
+ @Override
+ public String toJson() {
+ return WxGsonBuilder.create().toJson(this);
+ }
+
+ public static WxMpGuideBuyerResp fromJson(String json) {
+ return WxGsonBuilder.create().fromJson(json, WxMpGuideBuyerResp.class);
+ }
+}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideCardMaterialInfo.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideCardMaterialInfo.java
new file mode 100644
index 0000000000..7c83432de4
--- /dev/null
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideCardMaterialInfo.java
@@ -0,0 +1,64 @@
+package me.chanjar.weixin.mp.bean.guide;
+
+import com.google.gson.annotations.SerializedName;
+import lombok.Data;
+import me.chanjar.weixin.common.bean.ToJson;
+import me.chanjar.weixin.common.util.json.WxGsonBuilder;
+
+import java.io.Serializable;
+
+/**
+ * 小程序素材信息
+ *
+ * @author 广州跨界-宋心成
+ * @date 2021/5/12/012
+ */
+@Data
+public class WxMpGuideCardMaterialInfo implements ToJson, Serializable {
+ private static final long serialVersionUID = -3165724834271407258L;
+
+ /**
+ * 卡片名字
+ */
+ @SerializedName("title")
+ private String title;
+
+ /**
+ * 小程序appid
+ */
+ @SerializedName("appid")
+ private String appId;
+
+ /**
+ * 路径
+ */
+ @SerializedName("path")
+ private String path;
+
+ /**
+ * 图片链接
+ */
+ @SerializedName("picurl")
+ private String picUrl;
+
+ /**
+ * 图片id
+ */
+ @SerializedName("master_id")
+ private Long masterId;
+
+ /**
+ * 图片id
+ */
+ @SerializedName("slave_id")
+ private Long slaveId;
+
+ @Override
+ public String toJson() {
+ return WxGsonBuilder.create().toJson(this);
+ }
+
+ public static WxMpGuideCardMaterialInfo fromJson(String json) {
+ return WxGsonBuilder.create().fromJson(json, WxMpGuideCardMaterialInfo.class);
+ }
+}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideConfig.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideConfig.java
new file mode 100644
index 0000000000..9ddaf7318f
--- /dev/null
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideConfig.java
@@ -0,0 +1,40 @@
+package me.chanjar.weixin.mp.bean.guide;
+
+import com.google.gson.annotations.SerializedName;
+import lombok.Data;
+import me.chanjar.weixin.common.util.json.WxGsonBuilder;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * 获取快捷回复,关注顾问自动回复返回类
+ * @author 广州跨界-宋心成
+ * @date 2021/5/8/008
+ */
+@Data
+public class WxMpGuideConfig implements Serializable {
+ private static final long serialVersionUID = -343579331927473027L;
+
+ /**
+ * 快捷回复列表
+ */
+ @SerializedName("guide_fast_reply_list")
+ private List guideFastReplyList;
+
+ /**
+ * 第一条关注顾问自动回复(欢迎语)
+ */
+ @SerializedName("guide_auto_reply")
+ private WxMpGuideAutoReply guideAutoReply;
+
+ /**
+ * 第二条关注顾问自动回复(欢迎语)
+ */
+ @SerializedName("guide_auto_reply_plus")
+ private WxMpGuideAutoReply guideAutoReplyPlus;
+
+ public static WxMpGuideConfig fromJson(String json) {
+ return WxGsonBuilder.create().fromJson(json, WxMpGuideConfig.class);
+ }
+}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideFastReply.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideFastReply.java
new file mode 100644
index 0000000000..116ed91c70
--- /dev/null
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideFastReply.java
@@ -0,0 +1,40 @@
+package me.chanjar.weixin.mp.bean.guide;
+
+import com.google.gson.annotations.SerializedName;
+import lombok.Data;
+import me.chanjar.weixin.common.bean.ToJson;
+import me.chanjar.weixin.common.util.json.WxGsonBuilder;
+
+import java.io.Serializable;
+
+/**
+ * 顾问快捷回复
+ *
+ * @author 广州跨界-宋心成
+ * @date 2021/5/8/008
+ */
+@Data
+public class WxMpGuideFastReply implements ToJson, Serializable {
+ private static final long serialVersionUID = -3316181204068248972L;
+
+ /**
+ * 快捷回复内容
+ */
+ @SerializedName("content")
+ private String content;
+
+ /**
+ * 修改时间
+ */
+ @SerializedName("updatetime")
+ private Long updateTime;
+
+ @Override
+ public String toJson() {
+ return WxGsonBuilder.create().toJson(this);
+ }
+
+ public static WxMpGuideFastReply fromJson(String json) {
+ return WxGsonBuilder.create().fromJson(json, WxMpGuideFastReply.class);
+ }
+}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideGroup.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideGroup.java
new file mode 100644
index 0000000000..f37677ea79
--- /dev/null
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideGroup.java
@@ -0,0 +1,52 @@
+package me.chanjar.weixin.mp.bean.guide;
+
+import com.google.gson.annotations.SerializedName;
+import lombok.Data;
+import me.chanjar.weixin.common.bean.ToJson;
+import me.chanjar.weixin.common.util.json.WxGsonBuilder;
+
+import java.io.Serializable;
+
+/**
+ * 顾问分组信息
+ *
+ * @author 广州跨界-宋心成
+ * @date 2021/5/8/008
+ */
+@Data
+public class WxMpGuideGroup implements ToJson, Serializable {
+ private static final long serialVersionUID = 6235142804489175294L;
+
+ /**
+ * 顾问分组id
+ */
+ @SerializedName("id")
+ private Long id;
+
+ /**
+ * 顾问分组名称
+ */
+ @SerializedName("name")
+ private String name;
+
+ /**
+ * 创建时间戳
+ */
+ @SerializedName("create_time")
+ private Long createTime;
+
+ /**
+ * 更新时间戳
+ */
+ @SerializedName("update_time")
+ private Long updateTime;
+
+ @Override
+ public String toJson() {
+ return WxGsonBuilder.create().toJson(this);
+ }
+
+ public static WxMpGuideGroup fromJson(String json) {
+ return WxGsonBuilder.create().fromJson(json, WxMpGuideGroup.class);
+ }
+}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideGroupInfo.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideGroupInfo.java
new file mode 100644
index 0000000000..4173ad35d2
--- /dev/null
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideGroupInfo.java
@@ -0,0 +1,66 @@
+package me.chanjar.weixin.mp.bean.guide;
+
+import com.google.gson.annotations.SerializedName;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+import me.chanjar.weixin.common.bean.ToJson;
+import me.chanjar.weixin.common.util.json.WxGsonBuilder;
+
+import java.io.Serializable;
+
+/**
+ * 分组顾问信息.
+ *
+ * @author 广州跨界-宋心成
+ * @date 2021/5/8/008
+ */
+@Data
+@Builder
+@Accessors(chain = true)
+@NoArgsConstructor
+@AllArgsConstructor
+public class WxMpGuideGroupInfo implements ToJson, Serializable {
+ private static final long serialVersionUID = -4927568853154487513L;
+
+ /**
+ * 顾问的微信帐号
+ */
+ @SerializedName("guide_account")
+ private String account;
+
+ /**
+ * 顾问的openid或者unionid
+ */
+ @SerializedName("guide_openid")
+ private String openid;
+
+ /**
+ * 顾问昵称
+ */
+ @SerializedName("guide_nickname")
+ private String nickName;
+
+ /**
+ * 顾问头像
+ */
+ @SerializedName("guide_headimgurl")
+ private String headImgUrl;
+
+ /**
+ * 创建时间戳
+ */
+ @SerializedName("create_time")
+ private Long createTime;
+
+ @Override
+ public String toJson() {
+ return WxGsonBuilder.create().toJson(this);
+ }
+
+ public static WxMpGuideGroupInfo fromJson(String json) {
+ return WxGsonBuilder.create().fromJson(json, WxMpGuideGroupInfo.class);
+ }
+}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideGroupInfoList.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideGroupInfoList.java
new file mode 100644
index 0000000000..63e18b80d7
--- /dev/null
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideGroupInfoList.java
@@ -0,0 +1,34 @@
+package me.chanjar.weixin.mp.bean.guide;
+
+import com.google.gson.annotations.SerializedName;
+import lombok.Data;
+import me.chanjar.weixin.common.util.json.WxGsonBuilder;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * 顾问分组内顾问信息
+ * @author 广州跨界-宋心成
+ * @date 2021/5/8/008
+ */
+@Data
+public class WxMpGuideGroupInfoList implements Serializable {
+ private static final long serialVersionUID = 7037631524066068497L;
+
+ /**
+ * 分组顾问总数量
+ */
+ @SerializedName("total_num")
+ private Integer totalNum;
+
+ /**
+ * 分组顾问列表
+ */
+ @SerializedName("guide_list")
+ private List list;
+
+ public static WxMpGuideGroupInfoList fromJson(String json) {
+ return WxGsonBuilder.create().fromJson(json, WxMpGuideGroupInfoList.class);
+ }
+}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideImgMaterialInfo.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideImgMaterialInfo.java
new file mode 100644
index 0000000000..854d6ab8ac
--- /dev/null
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideImgMaterialInfo.java
@@ -0,0 +1,33 @@
+package me.chanjar.weixin.mp.bean.guide;
+
+import com.google.gson.annotations.SerializedName;
+import lombok.Data;
+import me.chanjar.weixin.common.bean.ToJson;
+import me.chanjar.weixin.common.util.json.WxGsonBuilder;
+
+import java.io.Serializable;
+
+/**
+ * 图片素材信息
+ * @author 广州跨界-宋心成
+ * @date 2021/5/12/012
+ */
+@Data
+public class WxMpGuideImgMaterialInfo implements ToJson, Serializable {
+ private static final long serialVersionUID = 9165977127399850455L;
+
+ /**
+ * 图片链接
+ */
+ @SerializedName("picurl")
+ private String picUrl;
+
+ @Override
+ public String toJson() {
+ return WxGsonBuilder.create().toJson(this);
+ }
+
+ public static WxMpGuideImgMaterialInfo fromJson(String json) {
+ return WxGsonBuilder.create().fromJson(json, WxMpGuideImgMaterialInfo.class);
+ }
+}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideImgMaterialInfoList.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideImgMaterialInfoList.java
new file mode 100644
index 0000000000..f87900191d
--- /dev/null
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideImgMaterialInfoList.java
@@ -0,0 +1,35 @@
+package me.chanjar.weixin.mp.bean.guide;
+
+import com.google.gson.annotations.SerializedName;
+import lombok.Data;
+import me.chanjar.weixin.common.util.json.WxGsonBuilder;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * 图片素材列表
+ *
+ * @author 广州跨界-宋心成
+ * @date 2021/5/12/012
+ */
+@Data
+public class WxMpGuideImgMaterialInfoList implements Serializable {
+ private static final long serialVersionUID = 8876840664010690223L;
+
+ /**
+ * 图片素材总数
+ */
+ @SerializedName("total_num")
+ private Integer totalNum;
+
+ /**
+ * 图片素材列表
+ */
+ @SerializedName("model_list")
+ private List list;
+
+ public static WxMpGuideImgMaterialInfoList fromJson(String json) {
+ return WxGsonBuilder.create().fromJson(json, WxMpGuideImgMaterialInfoList.class);
+ }
+}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideMassed.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideMassed.java
new file mode 100644
index 0000000000..258793ccad
--- /dev/null
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideMassed.java
@@ -0,0 +1,41 @@
+package me.chanjar.weixin.mp.bean.guide;
+
+import com.google.gson.JsonElement;
+import com.google.gson.annotations.SerializedName;
+import lombok.Data;
+import me.chanjar.weixin.common.bean.ToJson;
+import me.chanjar.weixin.common.util.json.WxGsonBuilder;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * 添加群发任务返回值
+ *
+ * @author 广州跨界-宋心成
+ * @date 2021/5/13/013
+ */
+@Data
+public class WxMpGuideMassed implements ToJson, Serializable {
+ private static final long serialVersionUID = 7049976499427665050L;
+
+ @SerializedName("task_id")
+ private Long taskId;
+
+ @SerializedName("openid")
+ private List list;
+
+ @Override
+ public String toJson() {
+ return WxGsonBuilder.create().toJson(this);
+ }
+
+ public static WxMpGuideMassed fromJson(T json) {
+ if (json instanceof String) {
+ return WxGsonBuilder.create().fromJson((String) json, WxMpGuideMassed.class);
+ } else if (json instanceof JsonElement) {
+ return WxGsonBuilder.create().fromJson((JsonElement) json, WxMpGuideMassed.class);
+ }
+ return null;
+ }
+}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideMassedBuyerInfo.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideMassedBuyerInfo.java
new file mode 100644
index 0000000000..58f6345f33
--- /dev/null
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideMassedBuyerInfo.java
@@ -0,0 +1,41 @@
+package me.chanjar.weixin.mp.bean.guide;
+
+import com.google.gson.annotations.SerializedName;
+import lombok.Data;
+import me.chanjar.weixin.common.bean.ToJson;
+import me.chanjar.weixin.common.util.json.WxGsonBuilder;
+
+import java.io.Serializable;
+
+/**
+ * 下方客户状态信息
+ *
+ * @author 广州跨界-宋心成
+ * @date 2021/5/13/013
+ */
+
+@Data
+public class WxMpGuideMassedBuyerInfo implements ToJson, Serializable {
+ private static final long serialVersionUID = -7433816414896345471L;
+
+ /**
+ * 客户openid
+ */
+ @SerializedName("openid")
+ private String openid;
+
+ /**
+ * 消息发送状态(1.未发送 2.发送成功 3.未关注公众号 4.没有quota(没有发送机会) 5.系统错误)
+ */
+ @SerializedName("send_status")
+ private int sendStatus;
+
+ @Override
+ public String toJson() {
+ return WxGsonBuilder.create().toJson(this);
+ }
+
+ public static WxMpGuideMassedBuyerInfo fromJson(String json) {
+ return WxGsonBuilder.create().fromJson(json, WxMpGuideMassedBuyerInfo.class);
+ }
+}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideMassedInfo.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideMassedInfo.java
new file mode 100644
index 0000000000..ddce7d6b73
--- /dev/null
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideMassedInfo.java
@@ -0,0 +1,102 @@
+package me.chanjar.weixin.mp.bean.guide;
+
+import com.google.gson.JsonElement;
+import com.google.gson.annotations.SerializedName;
+import lombok.Data;
+import me.chanjar.weixin.common.bean.ToJson;
+import me.chanjar.weixin.common.util.json.WxGsonBuilder;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * 群发任务信息
+ *
+ * @author 广州跨界-宋心成
+ * @date 2021/5/13/013
+ */
+
+@Data
+public class WxMpGuideMassedInfo implements ToJson, Serializable {
+ private static final long serialVersionUID = -6120573244255111822L;
+
+ /**
+ * 任务id
+ */
+ @SerializedName("task_id")
+ private String taskId;
+
+ /**
+ * 顾问openid
+ */
+ @SerializedName("guide_openid")
+ private String openid;
+
+ /**
+ * 任务创建时间
+ */
+ @SerializedName("create_time")
+ private Long createTime;
+
+ /**
+ * 任务最后修改时间
+ */
+ @SerializedName("update_time")
+ private Long updateTime;
+
+ /**
+ * 任务下发时间
+ */
+ @SerializedName("push_time")
+ private Long pushTime;
+
+ /**
+ * 任务完成时间
+ */
+ @SerializedName("finish_time")
+ private Long finishTime;
+
+ /**
+ * 任务名称
+ */
+ @SerializedName("task_name")
+ private String taskName;
+
+ /**
+ * 任务备注
+ */
+ @SerializedName("task_remark")
+ private String taskRemark;
+
+ /**
+ * 任务状态(1.任务未执行 2.已执行 3.执行完成 4.任务取消)
+ */
+ @SerializedName("task_status")
+ private int taskStatus;
+
+ /**
+ * 素材
+ */
+ @SerializedName("material")
+ private List material;
+
+ /**
+ * 客户列表
+ */
+ @SerializedName("buyer_info")
+ private List buyerInfos;
+
+ @Override
+ public String toJson() {
+ return WxGsonBuilder.create().toJson(this);
+ }
+
+ public static WxMpGuideMassedInfo fromJson(T json) {
+ if (json instanceof String) {
+ return WxGsonBuilder.create().fromJson((String) json, WxMpGuideMassedInfo.class);
+ } else if (json instanceof JsonElement) {
+ return WxGsonBuilder.create().fromJson((JsonElement) json, WxMpGuideMassedInfo.class);
+ }
+ return null;
+ }
+}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideMaterialInfo.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideMaterialInfo.java
new file mode 100644
index 0000000000..e7426fcc9c
--- /dev/null
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideMaterialInfo.java
@@ -0,0 +1,66 @@
+package me.chanjar.weixin.mp.bean.guide;
+
+import com.google.gson.annotations.SerializedName;
+import lombok.Builder;
+import lombok.Data;
+import me.chanjar.weixin.common.bean.ToJson;
+import me.chanjar.weixin.common.util.json.WxGsonBuilder;
+
+import java.io.Serializable;
+
+/**
+ * 素材信息
+ * @author 广州跨界-宋心成
+ * @date 2021/5/13/013
+ */
+
+@Data
+@Builder
+public class WxMpGuideMaterialInfo implements ToJson, Serializable {
+ private static final long serialVersionUID = -6201520701655588983L;
+
+ /**
+ * 素材类型,1.文本,3.图片,49.小程序卡片
+ */
+ @SerializedName("type")
+ private int type;
+
+ /**
+ * 图片类型素材或者卡片类型素材的封面,只能用《素材管理获取media_id》(注意目前只能用临时素材的media_id)
+ */
+ @SerializedName("media_id")
+ private String mediaId;
+
+ /**
+ * 小程序卡片标题,最多35字
+ */
+ @SerializedName("title")
+ private String title;
+
+ /**
+ * 小程序卡片路径
+ */
+ @SerializedName("path")
+ private String path;
+
+ /**
+ * 小程序卡片appid,需要关联到公众号
+ */
+ @SerializedName("appid")
+ private String appId;
+
+ /**
+ * 文本类型素材的内容,不超过300字节
+ */
+ @SerializedName("word")
+ private String word;
+
+ @Override
+ public String toJson() {
+ return WxGsonBuilder.create().toJson(this);
+ }
+
+ public static WxMpGuideMaterialInfo fromJson(String json) {
+ return WxGsonBuilder.create().fromJson(json, WxMpGuideMaterialInfo.class);
+ }
+}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideMsg.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideMsg.java
new file mode 100644
index 0000000000..37e1246579
--- /dev/null
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideMsg.java
@@ -0,0 +1,78 @@
+package me.chanjar.weixin.mp.bean.guide;
+
+import com.google.gson.annotations.SerializedName;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+import me.chanjar.weixin.common.bean.ToJson;
+import me.chanjar.weixin.common.util.json.WxGsonBuilder;
+
+import java.io.Serializable;
+
+/**
+ * 顾问聊天记录
+ * @author 广州跨界-宋心成
+ * @date 2021/5/7/007
+ */
+@Data
+@Builder
+@Accessors(chain = true)
+@NoArgsConstructor
+@AllArgsConstructor
+public class WxMpGuideMsg implements ToJson, Serializable {
+ private static final long serialVersionUID = -5175162334221904778L;
+
+ /**
+ * 顾问的微信帐号
+ */
+ @SerializedName("guide_account")
+ private String account;
+
+ /**
+ * 顾问的openid或者unionid
+ */
+ @SerializedName("guide_openid")
+ private String openid;
+
+ /**
+ * 聊天记录生成时间
+ */
+ @SerializedName("create_time")
+ private Long createTime;
+
+ /**
+ * 聊天内容
+ */
+ @SerializedName("content")
+ private String content;
+
+ /**
+ * 聊天记录类型
+ *
+ * 1 文字类型
+ * 3 图片类型
+ * 49 小程序卡片类型
+ */
+ @SerializedName("content_type")
+ private Integer contentType;
+
+ /**
+ * 消息指向
+ *
+ * 1 顾问发送消息给客户
+ * 2 客户发送消息给顾问
+ */
+ @SerializedName("direction")
+ private Integer direction;
+
+ @Override
+ public String toJson() {
+ return WxGsonBuilder.create().toJson(this);
+ }
+
+ public static WxMpGuideMsg fromJson(String json) {
+ return WxGsonBuilder.create().fromJson(json, WxMpGuideMsg.class);
+ }
+}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideMsgList.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideMsgList.java
new file mode 100644
index 0000000000..04e58b0c3d
--- /dev/null
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideMsgList.java
@@ -0,0 +1,35 @@
+package me.chanjar.weixin.mp.bean.guide;
+
+import com.google.gson.annotations.SerializedName;
+import lombok.Data;
+import me.chanjar.weixin.common.util.json.WxGsonBuilder;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * 顾问聊天记录列表
+ * @author 广州跨界-宋心成
+ * @date 2021/5/7/007
+ */
+
+@Data
+public class WxMpGuideMsgList implements Serializable {
+ private static final long serialVersionUID = -4041549590019624417L;
+
+ /**
+ * 顾问聊天记录总数量
+ */
+ @SerializedName("total_num")
+ private Integer totalNum;
+
+ /**
+ * 顾问聊天记录列表
+ */
+ @SerializedName("msg_list")
+ private List msgList;
+
+ public static WxMpGuideMsgList fromJson(String json) {
+ return WxGsonBuilder.create().fromJson(json, WxMpGuideMsgList.class);
+ }
+}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideOffLineReply.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideOffLineReply.java
new file mode 100644
index 0000000000..37ea15937f
--- /dev/null
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideOffLineReply.java
@@ -0,0 +1,42 @@
+package me.chanjar.weixin.mp.bean.guide;
+
+import com.google.gson.annotations.SerializedName;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+import me.chanjar.weixin.common.bean.ToJson;
+import me.chanjar.weixin.common.util.json.WxGsonBuilder;
+
+import java.io.Serializable;
+
+/**
+ * 离线自动回复
+ *
+ * @author 广州跨界-宋心成
+ * @date 2021/5/8/008
+ */
+@Data
+@Builder
+@Accessors(chain = true)
+@NoArgsConstructor
+@AllArgsConstructor
+public class WxMpGuideOffLineReply implements ToJson, Serializable {
+ private static final long serialVersionUID = 1337376246361830706L;
+
+ /**
+ * 离线自动回复内容
+ */
+ @SerializedName("content")
+ private String content;
+
+ @Override
+ public String toJson() {
+ return WxGsonBuilder.create().toJson(this);
+ }
+
+ public static WxMpGuideOffLineReply fromJson(String json) {
+ return WxGsonBuilder.create().fromJson(json, WxMpGuideOffLineReply.class);
+ }
+}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideSensitiveWords.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideSensitiveWords.java
new file mode 100644
index 0000000000..3346def2b0
--- /dev/null
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideSensitiveWords.java
@@ -0,0 +1,40 @@
+package me.chanjar.weixin.mp.bean.guide;
+
+import com.google.gson.annotations.SerializedName;
+import lombok.Data;
+import me.chanjar.weixin.common.bean.ToJson;
+import me.chanjar.weixin.common.util.json.WxGsonBuilder;
+
+import java.io.Serializable;
+
+/**
+ * 顾问敏感词
+ *
+ * @author 广州跨界-宋心成
+ * @date 2021/5/8/008
+ */
+
+@Data
+public class WxMpGuideSensitiveWords implements ToJson, Serializable {
+ private static final long serialVersionUID = 1546603590395563048L;
+
+ /**
+ * 敏感词数组
+ */
+ @SerializedName("values")
+ private String[] values;
+ /**
+ * 修改时间
+ */
+ @SerializedName("updatetime")
+ private Long updateTime;
+
+ @Override
+ public String toJson() {
+ return WxGsonBuilder.create().toJson(this);
+ }
+
+ public static WxMpGuideSensitiveWords fromJson(String json) {
+ return WxGsonBuilder.create().fromJson(json, WxMpGuideSensitiveWords.class);
+ }
+}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideTagInfo.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideTagInfo.java
new file mode 100644
index 0000000000..2d39ebcba3
--- /dev/null
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideTagInfo.java
@@ -0,0 +1,42 @@
+package me.chanjar.weixin.mp.bean.guide;
+
+import com.google.gson.annotations.SerializedName;
+import lombok.Data;
+import me.chanjar.weixin.common.bean.ToJson;
+import me.chanjar.weixin.common.util.json.WxGsonBuilder;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * 标签信息
+ *
+ * @author 广州跨界-宋心成
+ * @date 2021/5/11/011
+ */
+
+@Data
+public class WxMpGuideTagInfo implements ToJson, Serializable {
+ private static final long serialVersionUID = 2086445319422158695L;
+
+ /**
+ * 标签类型名称
+ */
+ @SerializedName("tag_name")
+ private String tagName;
+
+ /**
+ * 标签值
+ */
+ @SerializedName("tag_values")
+ private List values;
+
+ @Override
+ public String toJson() {
+ return WxGsonBuilder.create().toJson(this);
+ }
+
+ public static WxMpGuideTagInfo fromJson(String json) {
+ return WxGsonBuilder.create().fromJson(json, WxMpGuideTagInfo.class);
+ }
+}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideWordMaterialInfo.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideWordMaterialInfo.java
new file mode 100644
index 0000000000..213615d547
--- /dev/null
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideWordMaterialInfo.java
@@ -0,0 +1,39 @@
+package me.chanjar.weixin.mp.bean.guide;
+
+import com.google.gson.annotations.SerializedName;
+import lombok.Data;
+import me.chanjar.weixin.common.bean.ToJson;
+import me.chanjar.weixin.common.util.json.WxGsonBuilder;
+
+import java.io.Serializable;
+
+/** 文字素材信息
+ * @author 广州跨界-宋心成
+ * @date 2021/5/12/012
+ */
+
+@Data
+public class WxMpGuideWordMaterialInfo implements ToJson, Serializable {
+ private static final long serialVersionUID = -1370377663251409658L;
+
+ /**
+ * 文字内容
+ */
+ @SerializedName("word")
+ private String word;
+
+ /**
+ * 创建时间戳
+ */
+ @SerializedName("create_time")
+ private Long createTime;
+
+ @Override
+ public String toJson() {
+ return WxGsonBuilder.create().toJson(this);
+ }
+
+ public static WxMpGuideWordMaterialInfo fromJson(String json) {
+ return WxGsonBuilder.create().fromJson(json, WxMpGuideWordMaterialInfo.class);
+ }
+}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideWordMaterialInfoList.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideWordMaterialInfoList.java
new file mode 100644
index 0000000000..52ee16adad
--- /dev/null
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/guide/WxMpGuideWordMaterialInfoList.java
@@ -0,0 +1,34 @@
+package me.chanjar.weixin.mp.bean.guide;
+
+import com.google.gson.annotations.SerializedName;
+import lombok.Data;
+import me.chanjar.weixin.common.util.json.WxGsonBuilder;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * 文字素材信息列表
+ * @author 广州跨界-宋心成
+ * @date 2021/5/12/012
+ */
+@Data
+public class WxMpGuideWordMaterialInfoList implements Serializable {
+ private static final long serialVersionUID = 6891519244712898267L;
+
+ /**
+ * 文字素材总数
+ */
+ @SerializedName("total_num")
+ private Integer totalNum;
+
+ /**
+ * 文字素材列表
+ */
+ @SerializedName("word_list")
+ private List list;
+
+ public static WxMpGuideWordMaterialInfoList fromJson(String json) {
+ return WxGsonBuilder.create().fromJson(json, WxMpGuideWordMaterialInfoList.class);
+ }
+}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/enums/WxMpApiUrl.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/enums/WxMpApiUrl.java
index b6a08b25ac..0facd7cbb0 100644
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/enums/WxMpApiUrl.java
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/enums/WxMpApiUrl.java
@@ -2,8 +2,8 @@
import lombok.AllArgsConstructor;
import lombok.Getter;
-import me.chanjar.weixin.mp.config.WxMpHostConfig;
import me.chanjar.weixin.mp.config.WxMpConfigStorage;
+import me.chanjar.weixin.mp.config.WxMpHostConfig;
import static me.chanjar.weixin.mp.config.WxMpHostConfig.*;
@@ -290,27 +290,27 @@ enum SubscribeMsg implements WxMpApiUrl {
/**
* 获取模板标题下的关键词列表.
*/
- GET_PUB_TEMPLATE_TITLE_LIST_URL (API_DEFAULT_HOST_URL, "/wxaapi/newtmpl/getpubtemplatetitles"),
+ GET_PUB_TEMPLATE_TITLE_LIST_URL(API_DEFAULT_HOST_URL, "/wxaapi/newtmpl/getpubtemplatetitles"),
/**
* 获取模板标题下的关键词列表.
*/
- GET_PUB_TEMPLATE_KEY_WORDS_BY_ID_URL (API_DEFAULT_HOST_URL, "/wxaapi/newtmpl/getpubtemplatekeywords"),
+ GET_PUB_TEMPLATE_KEY_WORDS_BY_ID_URL(API_DEFAULT_HOST_URL, "/wxaapi/newtmpl/getpubtemplatekeywords"),
/**
* 组合模板并添加至帐号下的个人模板库.
*/
- TEMPLATE_ADD_URL(API_DEFAULT_HOST_URL, "/wxaapi/newtmpl/addtemplate"),
+ TEMPLATE_ADD_URL(API_DEFAULT_HOST_URL, "/wxaapi/newtmpl/addtemplate"),
/**
* 获取当前帐号下的个人模板列表.
*/
- TEMPLATE_LIST_URL(API_DEFAULT_HOST_URL, "/wxaapi/newtmpl/gettemplate"),
+ TEMPLATE_LIST_URL(API_DEFAULT_HOST_URL, "/wxaapi/newtmpl/gettemplate"),
/**
* 删除帐号下的某个模板.
*/
- TEMPLATE_DEL_URL(API_DEFAULT_HOST_URL, "/wxaapi/newtmpl/deltemplate"),
+ TEMPLATE_DEL_URL(API_DEFAULT_HOST_URL, "/wxaapi/newtmpl/deltemplate"),
/**
* 获取小程序账号的类目
*/
- GET_CATEGORY_URL (API_DEFAULT_HOST_URL, "/wxaapi/newtmpl/getcategory"),
+ GET_CATEGORY_URL(API_DEFAULT_HOST_URL, "/wxaapi/newtmpl/getcategory"),
UNIFORM_MSG_SEND_URL(API_DEFAULT_HOST_URL, "/cgi-bin/message/wxopen/template/uniform_send"),
ACTIVITY_ID_CREATE_URL(API_DEFAULT_HOST_URL, "/cgi-bin/message/wxopen/activityid/create"),
UPDATABLE_MSG_SEND_URL(API_DEFAULT_HOST_URL, "/cgi-bin/message/wxopen/updatablemsg/send");
@@ -1133,22 +1133,22 @@ enum Invoice implements WxMpApiUrl {
/**
* 报销方查询报销发票信息
*/
- GET_INVOICE_INFO(API_DEFAULT_HOST_URL,"/card/invoice/reimburse/getinvoiceinfo"),
+ GET_INVOICE_INFO(API_DEFAULT_HOST_URL, "/card/invoice/reimburse/getinvoiceinfo"),
/**
* 报销方批量查询报销发票信息
*/
- GET_INVOICE_BATCH(API_DEFAULT_HOST_URL,"/card/invoice/reimburse/getinvoicebatch"),
+ GET_INVOICE_BATCH(API_DEFAULT_HOST_URL, "/card/invoice/reimburse/getinvoicebatch"),
/**
* 报销方更新发票状态
*/
- UPDATE_INVOICE_STATUS(API_DEFAULT_HOST_URL,"/card/invoice/reimburse/updateinvoicestatus"),
+ UPDATE_INVOICE_STATUS(API_DEFAULT_HOST_URL, "/card/invoice/reimburse/updateinvoicestatus"),
/**
* 报销方批量更新发票状态
*/
- UPDATE_STATUS_BATCH(API_DEFAULT_HOST_URL,"/card/invoice/reimburse/updatestatusbatch"),
+ UPDATE_STATUS_BATCH(API_DEFAULT_HOST_URL, "/card/invoice/reimburse/updatestatusbatch"),
;
private final String prefix;
private final String path;
@@ -1180,7 +1180,190 @@ enum Guide implements WxMpApiUrl {
/**
* 获取服务号顾问列表
*/
- LIST_GUIDE(API_DEFAULT_HOST_URL, "/cgi-bin/guide/getguideacctlist");
+ LIST_GUIDE(API_DEFAULT_HOST_URL, "/cgi-bin/guide/getguideacctlist"),
+ /**
+ * 生成顾问二维码
+ */
+ CREATE_QR_CODE(API_DEFAULT_HOST_URL, "/cgi-bin/guide/guidecreateqrcode"),
+ /**
+ * 获取顾问聊天记录
+ */
+ GET_GUIDE_CHAT_RECORD(API_DEFAULT_HOST_URL, "/cgi-bin/guide/getguidebuyerchatrecord"),
+ /**
+ * 设置快捷回复与关注自动回复
+ */
+ SET_GUIDE_CONFIG(API_DEFAULT_HOST_URL, "/cgi-bin/guide/setguideconfig"),
+ /**
+ * 获取快捷回复与关注自动回复
+ */
+ GET_GUIDE_CONFIG(API_DEFAULT_HOST_URL, "/cgi-bin/guide/getguideconfig"),
+ /**
+ * 为服务号设置敏感词与离线自动回复
+ */
+ SET_GUIDE_ACCT_CONFIG(API_DEFAULT_HOST_URL, "/cgi-bin/guide/setguideacctconfig"),
+ /**
+ * 获取服务号敏感词与离线自动回复
+ */
+ GET_GUIDE_ACCT_CONFIG(API_DEFAULT_HOST_URL, "/cgi-bin/guide/getguideacctconfig"),
+ /**
+ * 允许微信用户复制小程序页面路径
+ */
+ PUSH_SHOW_WX_PATH_MENU(API_DEFAULT_HOST_URL, "/cgi-bin/guide/pushshowwxapathmenu"),
+ /**
+ * 新建顾问分组
+ */
+ NEW_GUIDE_GROUP(API_DEFAULT_HOST_URL, "/cgi-bin/guide/newguidegroup"),
+ /**
+ * 获取服务号下所有顾问分组的列表
+ */
+ GET_GUIDE_GROUP_LIST(API_DEFAULT_HOST_URL, "/cgi-bin/guide/getguidegrouplist"),
+ /**
+ * 获取指定顾问分组内顾问信息
+ */
+ GET_GROUP_GUIDE_INFO(API_DEFAULT_HOST_URL, "/cgi-bin/guide/getgroupinfo"),
+ /**
+ * 分组内添加顾问
+ */
+ ADD_GROUP_GUIDE(API_DEFAULT_HOST_URL, "/cgi-bin/guide/addguide2guidegroup"),
+ /**
+ * 分组内删除顾问
+ */
+ DEL_GROUP_GUIDE(API_DEFAULT_HOST_URL, "/cgi-bin/guide/delguide2guidegroup"),
+ /**
+ * 获取顾问所在分组
+ */
+ GET_GROUP_ON_GUIDE(API_DEFAULT_HOST_URL, "/cgi-bin/guide/getgroupbyguide"),
+ /**
+ * 删除指定顾问分组
+ */
+ DEL_GROUP(API_DEFAULT_HOST_URL, "/cgi-bin/guide/delguidegroup"),
+ /**
+ * 为顾问分配客户
+ */
+ ADD_GUIDE_BUYER_RELATION(API_DEFAULT_HOST_URL, "/cgi-bin/guide/addguidebuyerrelation"),
+ /**
+ * 为顾问移除客户
+ */
+ DEL_GUIDE_BUYER_RELATION(API_DEFAULT_HOST_URL, "/cgi-bin/guide/delguidebuyerrelation"),
+ /**
+ * 获取顾问的客户列表
+ */
+ GET_GUIDE_BUYER_RELATION_LIST(API_DEFAULT_HOST_URL, "/cgi-bin/guide/getguidebuyerrelationlist"),
+ /**
+ * 为客户更换顾问
+ */
+ REBIND_GUIDE_ACCT_FOR_BUYER(API_DEFAULT_HOST_URL, "/cgi-bin/guide/rebindguideacctforbuyer"),
+ /**
+ * 修改客户昵称
+ */
+ UPDATE_GUIDE_BUYER_RELATION(API_DEFAULT_HOST_URL, "/cgi-bin/guide/updateguidebuyerrelation"),
+ /**
+ * 查询客户所属顾问
+ */
+ GET_GUIDE_BUYER_RELATION_BY_BUYER(API_DEFAULT_HOST_URL, "/cgi-bin/guide/getguidebuyerrelationbybuyer"),
+ /**
+ * 查询指定顾问和客户的关系
+ */
+ GET_GUIDE_BUYER_RELATION(API_DEFAULT_HOST_URL, "/cgi-bin/guide/getguidebuyerrelation"),
+ /**
+ * 新建标签类型
+ */
+ NEW_GUIDE_TAG_OPTION(API_DEFAULT_HOST_URL, "/cgi-bin/guide/newguidetagoption"),
+ /**
+ * 删除标签类型
+ */
+ DEL_GUIDE_TAG_OPTION(API_DEFAULT_HOST_URL, "/cgi-bin/guide/delguidetagoption"),
+ /**
+ * 为标签添加可选值
+ */
+ ADD_GUIDE_TAG_OPTION(API_DEFAULT_HOST_URL, "/cgi-bin/guide/addguidetagoption"),
+ /**
+ * 获取标签和可选值
+ */
+ GET_GUIDE_TAG_OPTION(API_DEFAULT_HOST_URL, "/cgi-bin/guide/getguidetagoption"),
+ /**
+ * 为客户设置标签
+ */
+ ADD_GUIDE_BUYER_TAG(API_DEFAULT_HOST_URL, "/cgi-bin/guide/addguidebuyertag"),
+ /**
+ * 查询客户标签
+ */
+ GET_GUIDE_BUYER_TAG(API_DEFAULT_HOST_URL, "/cgi-bin/guide/getguidebuyertag"),
+ /**
+ * 根据标签值筛选客户
+ */
+ QUERY_GUIDE_BUYER_BY_TAG(API_DEFAULT_HOST_URL, "/cgi-bin/guide/queryguidebuyerbytag"),
+ /**
+ * 删除客户标签
+ */
+ DEL_GUIDE_BUYER_TAG(API_DEFAULT_HOST_URL, "/cgi-bin/guide/delguidebuyertag"),
+ /**
+ * 设置自定义客户信息
+ */
+ ADD_GUIDE_BUYER_DISPLAY_TAG(API_DEFAULT_HOST_URL, "/cgi-bin/guide/addguidebuyerdisplaytag"),
+ /**
+ * 获取自定义客户信息
+ */
+ GET_GUIDE_BUYER_DISPLAY_TAG(API_DEFAULT_HOST_URL, "/cgi-bin/guide/getguidebuyerdisplaytag"),
+ /**
+ * 添加小程序卡片素材
+ */
+ SET_GUIDE_CARD_MATERIAL(API_DEFAULT_HOST_URL, "/cgi-bin/guide/setguidecardmaterial"),
+ /**
+ * 查询小程序卡片素材
+ */
+ GET_GUIDE_CARD_MATERIAL(API_DEFAULT_HOST_URL, "/cgi-bin/guide/getguidecardmaterial"),
+ /**
+ * 删除小程序卡片素材
+ */
+ DEL_GUIDE_CARD_MATERIAL(API_DEFAULT_HOST_URL, "/cgi-bin/guide/delguidecardmaterial"),
+ /**
+ * 添加图片素材
+ */
+ SET_GUIDE_IMAGE_MATERIAL(API_DEFAULT_HOST_URL, "/cgi-bin/guide/setguideimagematerial"),
+ /**
+ * 查询图片素材
+ */
+ GET_GUIDE_IMAGE_MATERIAL(API_DEFAULT_HOST_URL, "/cgi-bin/guide/getguideimagematerial"),
+ /**
+ * 删除图片素材
+ */
+ DEL_GUIDE_IMAGE_MATERIAL(API_DEFAULT_HOST_URL, "/cgi-bin/guide/delguideimagematerial"),
+ /**
+ * 添加文字素材
+ */
+ SET_GUIDE_WORD_MATERIAL(API_DEFAULT_HOST_URL, "/cgi-bin/guide/setguidewordmaterial"),
+ /**
+ * 查询文字素材
+ */
+ GET_GUIDE_WORD_MATERIAL(API_DEFAULT_HOST_URL, "/cgi-bin/guide/getguidewordmaterial"),
+ /**
+ * 删除文字素材
+ */
+ DEL_GUIDE_WORD_MATERIAL(API_DEFAULT_HOST_URL, "/cgi-bin/guide/delguidewordmaterial"),
+ /**
+ * 添加群发任务
+ */
+ ADD_GUIDE_MASSED_JOB(API_DEFAULT_HOST_URL, "/cgi-bin/guide/addguidemassendjob"),
+ /**
+ * 获取群发任务列表
+ */
+ GET_GUIDE_MASSED_JOB_LIST(API_DEFAULT_HOST_URL, "/cgi-bin/guide/getguidemassendjoblist"),
+ /**
+ * 获取指定群发任务信息
+ */
+ GET_GUIDE_MASSED_JOB(API_DEFAULT_HOST_URL, "/cgi-bin/guide/getguidemassendjob"),
+ /**
+ * 修改群发任务
+ */
+ UPDATE_GUIDE_MASSED_JOB(API_DEFAULT_HOST_URL, "/cgi-bin/guide/updateguidemassendjob"),
+ /**
+ * 取消群发任务
+ */
+ CANCEL_GUIDE_MASSED_JOB(API_DEFAULT_HOST_URL, "/cgi-bin/guide/cancelguidemassendjob"),
+ ;
+
+
private final String prefix;
private final String path;
diff --git a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpGuideBuyerServiceImplTest.java b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpGuideBuyerServiceImplTest.java
new file mode 100644
index 0000000000..6fd3dda3f0
--- /dev/null
+++ b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpGuideBuyerServiceImplTest.java
@@ -0,0 +1,94 @@
+package me.chanjar.weixin.mp.api.impl;
+
+import com.google.inject.Inject;
+import me.chanjar.weixin.common.error.WxErrorException;
+import me.chanjar.weixin.mp.api.WxMpService;
+import me.chanjar.weixin.mp.api.test.ApiTestModule;
+import me.chanjar.weixin.mp.bean.guide.*;
+import org.testng.annotations.Guice;
+import org.testng.annotations.Test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * @author 广州跨界-宋心成
+ * @date 2021/5/13/013
+ */
+
+@Guice(modules = ApiTestModule.class)
+public class WxMpGuideBuyerServiceImplTest {
+ @Inject
+ protected WxMpService wxService;
+
+ /**
+ * 顾问微信号 guide_account
+ */
+ private static final String ACCOUNT = "sxc_Warm";
+
+ @Test
+ public void testAddGuideBuyerRelation() throws WxErrorException {
+ List list = new ArrayList<>();
+ list.add(WxMpAddGuideBuyerInfo.builder().nickname("小执花").openid("oqlk8v0uTJgRnn5eEskNruD4-bc8").build());
+ List wxMpGuideBuyerResps = this.wxService.getGuideBuyerService().addGuideBuyerRelation(ACCOUNT, null, list);
+ assertThat(wxMpGuideBuyerResps).isNotNull();
+ }
+
+ @Test
+ public void testAddGuideBuyerRelationOnce() throws WxErrorException {
+ this.wxService.getGuideBuyerService().addGuideBuyerRelation(ACCOUNT, null, "oqlk8v0uTJgRnn5eEskNruD4-bc8", "小执花");
+ }
+
+ @Test
+ public void testDelGuideBuyerRelation() throws WxErrorException {
+ List list = new ArrayList<>();
+ list.add("oqlk8v0uTJgRnn5eEskNruD4-bc8");
+ List wxMpGuideBuyerResps = this.wxService.getGuideBuyerService().delGuideBuyerRelation(ACCOUNT, null, list);
+ assertThat(wxMpGuideBuyerResps).isNotNull();
+ }
+
+ @Test
+ public void testDelGuideBuyerRelationOnce() throws WxErrorException {
+ this.wxService.getGuideBuyerService().delGuideBuyerRelation(ACCOUNT, null, "oqlk8v0uTJgRnn5eEskNruD4-bc8");
+ }
+
+ @Test
+ public void testGetGuideBuyerRelationList() throws WxErrorException {
+ WxMpGuideBuyerInfoList list = this.wxService.getGuideBuyerService().getGuideBuyerRelationList(ACCOUNT, null, 0, 10);
+ assertThat(list).isNotNull();
+ }
+
+ @Test
+ public void testRebindGuideAcctForBuyer() throws WxErrorException {
+ List list = new ArrayList<>();
+ list.add("oqlk8v0uTJgRnn5eEskNruD4-bc8");
+ list.add("oqlk8vybPMWapMwOfFTFVYqWpGM0");
+ List enemytriplekill = this.wxService.getGuideBuyerService().rebindGuideAcctForBuyer(ACCOUNT, null, "enemytriplekill", null, list);
+ assertThat(enemytriplekill).isNotNull();
+ }
+
+ @Test
+ public void testRebindGuideAcctForBuyerOnce() throws WxErrorException {
+ this.wxService.getGuideBuyerService().rebindGuideAcctForBuyer(ACCOUNT, null, "enemytriplekill", null, "oqlk8v0uTJgRnn5eEskNruD4-bc8");
+ }
+
+ @Test
+ public void testUpdateGuideBuyerRelation() throws WxErrorException {
+ this.wxService.getGuideBuyerService().updateGuideBuyerRelation(ACCOUNT, null, "oqlk8v0uTJgRnn5eEskNruD4-bc8", "微信文档有坑");
+ }
+
+ @Test
+ public void testGetGuideBuyerRelationByBuyer() throws WxErrorException {
+ WxMpGuideBuyerRelation guideBuyerRelationByBuyer = this.wxService.getGuideBuyerService().getGuideBuyerRelationByBuyer("oqlk8v0uTJgRnn5eEskNruD4-bc8");
+ assertThat(guideBuyerRelationByBuyer).isNotNull();
+ }
+
+ @Test
+ public void testGetGuideBuyerRelation() throws WxErrorException {
+ WxMpGuideBuyerInfo guideBuyerRelation = this.wxService.getGuideBuyerService().getGuideBuyerRelation(ACCOUNT, null, "oqlk8v0uTJgRnn5eEskNruD4-bc8");
+ assertThat(guideBuyerRelation).isNotNull();
+ }
+
+}
diff --git a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpGuideMassedJobServiceImplTest.java b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpGuideMassedJobServiceImplTest.java
new file mode 100644
index 0000000000..20621a34d4
--- /dev/null
+++ b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpGuideMassedJobServiceImplTest.java
@@ -0,0 +1,66 @@
+package me.chanjar.weixin.mp.api.impl;
+
+import com.google.inject.Inject;
+import me.chanjar.weixin.common.error.WxErrorException;
+import me.chanjar.weixin.mp.api.WxMpService;
+import me.chanjar.weixin.mp.api.test.ApiTestModule;
+import me.chanjar.weixin.mp.bean.guide.WxMpGuideMassed;
+import me.chanjar.weixin.mp.bean.guide.WxMpGuideMassedInfo;
+import me.chanjar.weixin.mp.bean.guide.WxMpGuideMaterialInfo;
+import org.testng.annotations.Guice;
+import org.testng.annotations.Test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * @author 广州跨界-宋心成
+ * @date 2021/5/13/013
+ */
+
+@Guice(modules = ApiTestModule.class)
+public class WxMpGuideMassedJobServiceImplTest {
+ @Inject
+ protected WxMpService wxService;
+
+ /**
+ * 顾问微信号 guide_account
+ */
+ private static final String ACCOUNT = "sxc_Warm";
+
+ @Test
+ public void testAddGuideMassedJob() throws WxErrorException {
+ List userOpenId = new ArrayList<>();
+ userOpenId.add("oqlk8v0uTJgRnn5eEskNruD4-bc8");
+ List list = new ArrayList<>();
+ list.add(WxMpGuideMaterialInfo.builder().type(1).word("文字素材测试").build());
+ list.add(WxMpGuideMaterialInfo.builder().type(3).mediaId("qDrCfXeDorLgy83d8h6VzVip9s6omPXF_2ILuoke1j0sY4bSFVaA8lkGzUaznU9e").build()); //图片素材
+ list.add(WxMpGuideMaterialInfo.builder().type(49).mediaId("qDrCfXeDorLgy83d8h6VzVip9s6omPXF_2ILuoke1j0sY4bSFVaA8lkGzUaznU9e").title("小程序标题").path("pages/login-type/index.html").appId("wx4f793c04fd3be5a8").build()); //图片素材
+ WxMpGuideMassed wxMpGuideMassed = this.wxService.getGuideMassedJobService().addGuideMassedJob(ACCOUNT, null, "群发任务", "群发任务备注", System.currentTimeMillis() / 1000, userOpenId, list);
+ assertThat(wxMpGuideMassed).isNotNull();
+ }
+
+ @Test
+ public void testGetGuideMassedJobList() throws WxErrorException {
+ List guideMassedJobList = this.wxService.getGuideMassedJobService().getGuideMassedJobList(ACCOUNT, null, null, null, null);
+ assertThat(guideMassedJobList).isNotNull();
+ }
+
+ @Test
+ public void testGetGuideMassedJob() throws WxErrorException {
+ WxMpGuideMassedInfo guideMassedJob = this.wxService.getGuideMassedJobService().getGuideMassedJob("1867407932930228228");
+ assertThat(guideMassedJob).isNotNull();
+ }
+
+ @Test
+ public void testUpdateGuideMassedJob() throws WxErrorException {
+ this.wxService.getGuideMassedJobService().updateGuideMassedJob("1867407932930228228", "修改群发任务", null, null, null, null);
+ }
+
+ @Test
+ public void testCancelGuideMassedJob() throws WxErrorException {
+ this.wxService.getGuideMassedJobService().cancelGuideMassedJob("1867407932930228228");
+ }
+}
diff --git a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpGuideMaterialServiceImplTest.java b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpGuideMaterialServiceImplTest.java
new file mode 100644
index 0000000000..f1ffe8f9ff
--- /dev/null
+++ b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpGuideMaterialServiceImplTest.java
@@ -0,0 +1,87 @@
+package me.chanjar.weixin.mp.api.impl;
+
+import com.google.inject.Inject;
+import me.chanjar.weixin.common.api.WxConsts;
+import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;
+import me.chanjar.weixin.common.error.WxErrorException;
+import me.chanjar.weixin.mp.api.WxMpService;
+import me.chanjar.weixin.mp.api.test.ApiTestModule;
+import me.chanjar.weixin.mp.bean.guide.WxMpGuideCardMaterialInfo;
+import me.chanjar.weixin.mp.bean.guide.WxMpGuideImgMaterialInfoList;
+import me.chanjar.weixin.mp.bean.guide.WxMpGuideWordMaterialInfoList;
+import org.testng.annotations.Guice;
+import org.testng.annotations.Test;
+
+import java.io.File;
+import java.util.List;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * @author 广州跨界-宋心成
+ * @date 2021/5/13/013
+ */
+
+@Guice(modules = ApiTestModule.class)
+public class WxMpGuideMaterialServiceImplTest {
+ @Inject
+ protected WxMpService wxService;
+
+ /**
+ * 图片路径
+ */
+ private static final String IMG_URL = "C:\\Users\\Administrator\\Desktop\\imgText.png";
+
+
+ @Test
+ public void testSetGuideCardMaterial() throws WxErrorException {
+ WxMediaUploadResult wxMediaUploadResult = this.wxService.getMaterialService()
+ .mediaUpload(WxConsts.MediaFileType.IMAGE, new File(IMG_URL));
+ this.wxService.getGuideMaterialService().setGuideCardMaterial(wxMediaUploadResult.getMediaId(), 0, "小程序素材标题", "pages/login-type/index.html", "wx4f793c04fd3be5a8");
+ }
+
+ @Test
+ public void testGetGuideCardMaterial() throws WxErrorException {
+ List guideCardMaterial = this.wxService.getGuideMaterialService().getGuideCardMaterial(0);
+ assertThat(guideCardMaterial).isNotNull();
+ }
+
+ @Test
+ public void testDelGuideCardMaterial() throws WxErrorException {
+ this.wxService.getGuideMaterialService().delGuideCardMaterial(0, "小程序素材标题", "pages/login-type/index.html", "wx4f793c04fd3be5a8");
+ }
+
+ @Test
+ public void testSetGuideImageMaterial() throws WxErrorException {
+ WxMediaUploadResult wxMediaUploadResult = this.wxService.getMaterialService()
+ .mediaUpload(WxConsts.MediaFileType.IMAGE, new File(IMG_URL));
+ this.wxService.getGuideMaterialService().setGuideImageMaterial(wxMediaUploadResult.getMediaId(), 0);
+ }
+
+ @Test
+ public void testGetGuideImageMaterial() throws WxErrorException {
+ WxMpGuideImgMaterialInfoList guideImageMaterial = this.wxService.getGuideMaterialService().getGuideImageMaterial(0, 0, 20);
+ assertThat(guideImageMaterial).isNotNull();
+ }
+
+ @Test
+ public void testDelGuideImageMaterial() throws WxErrorException {
+ this.wxService.getGuideMaterialService().delGuideImageMaterial(0, "http://mmbiz.qpic.cn/mmbiz_png/63bwCoCgX0neicbffKiaL4vqXAUChYwE1VO0ZG5b6SW3Shv7kR1ia46b3gS8zf78piaR7vk7I6MRqbVzibJVJoNtkEg/0");
+ }
+
+ @Test
+ public void testSetGuideWordMaterial() throws WxErrorException {
+ this.wxService.getGuideMaterialService().setGuideWordMaterial(0, "文字素材测试");
+ }
+
+ @Test
+ public void testGetGuideWordMaterial() throws WxErrorException {
+ WxMpGuideWordMaterialInfoList guideWordMaterial = this.wxService.getGuideMaterialService().getGuideWordMaterial(0, 0, 20);
+ assertThat(guideWordMaterial).isNotNull();
+ }
+
+ @Test
+ public void testDelGuideWordMaterial() throws WxErrorException {
+ this.wxService.getGuideMaterialService().delGuideWordMaterial(0, "文字素材测试");
+ }
+}
diff --git a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpGuideServiceImplTest.java b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpGuideServiceImplTest.java
index 5742191f91..13ec80c168 100644
--- a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpGuideServiceImplTest.java
+++ b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpGuideServiceImplTest.java
@@ -4,11 +4,13 @@
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.api.test.ApiTestModule;
-import me.chanjar.weixin.mp.bean.guide.WxMpGuideInfo;
-import me.chanjar.weixin.mp.bean.guide.WxMpGuideList;
+import me.chanjar.weixin.mp.bean.guide.*;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;
+import java.util.ArrayList;
+import java.util.List;
+
import static org.assertj.core.api.Assertions.assertThat;
/**
@@ -22,30 +24,35 @@ public class WxMpGuideServiceImplTest {
@Inject
protected WxMpService wxService;
+ /**
+ * 顾问微信号 guide_account
+ */
+ private static final String ACCOUNT = "sxc_Warm";
+
@Test
public void testAddGuide() throws WxErrorException {
- this.wxService.getGuideService().addGuide("wx1java", "", null, null);
+ this.wxService.getGuideService().addGuide(ACCOUNT, "", null, null);
}
@Test
public void testAddGuide_another() throws WxErrorException {
- this.wxService.getGuideService().addGuide(WxMpGuideInfo.builder().account("wx1java").build());
+ this.wxService.getGuideService().addGuide(WxMpGuideInfo.builder().account(ACCOUNT).build());
}
@Test
public void testGetGuide() throws WxErrorException {
- final WxMpGuideInfo guideInfo = this.wxService.getGuideService().getGuide("wx1java", null);
+ final WxMpGuideInfo guideInfo = this.wxService.getGuideService().getGuide(ACCOUNT, null);
assertThat(guideInfo).isNotNull();
}
@Test
public void testUpdateGuide() throws WxErrorException {
- this.wxService.getGuideService().updateGuide(WxMpGuideInfo.builder().account("wx1java").nickName("我是谁").build());
+ this.wxService.getGuideService().updateGuide(WxMpGuideInfo.builder().account(ACCOUNT).nickName("我是谁").build());
}
@Test
public void testDelGuide() throws WxErrorException {
- this.wxService.getGuideService().delGuide("wx1java", null);
+ this.wxService.getGuideService().delGuide(ACCOUNT, null);
}
@Test
@@ -53,4 +60,92 @@ public void testListGuide() throws WxErrorException {
final WxMpGuideList guideList = this.wxService.getGuideService().listGuide(0, 10);
assertThat(guideList).isNotNull();
}
+
+ @Test
+ public void testCreateGuideQrCode() throws WxErrorException {
+ String guideQrCode = this.wxService.getGuideService().createGuideQrCode(ACCOUNT, null, null);
+ assertThat(guideQrCode).isNotNull();
+ }
+
+ @Test
+ public void testGetGuideChatRecord() throws WxErrorException {
+ final WxMpGuideMsgList guideChatRecord = this.wxService.getGuideService().getGuideChatRecord(ACCOUNT, null, null, null, null, 0, 10);
+ assertThat(guideChatRecord).isNotNull();
+ }
+
+ @Test
+ public void testSetGuideConfig() throws WxErrorException {
+ List list = new ArrayList<>();
+ list.add("自动回复设置" + ACCOUNT);
+ list.add("自动回复设置" + ACCOUNT);
+
+ this.wxService.getGuideService().setGuideConfig(null, null, true, list,
+ WxMpAddGuideAutoReply.builder().content("欢迎测试1").msgType(1).build(),
+ WxMpAddGuideAutoReply.builder().content("欢迎测试2").msgType(1).build());
+ }
+
+ @Test
+ public void testGetGuideConfig() throws WxErrorException {
+ final WxMpGuideConfig guideConfig = this.wxService.getGuideService().getGuideConfig(ACCOUNT, null);
+ assertThat(guideConfig).isNotNull();
+ }
+
+ @Test
+ public void testSetGuideAcctConfig() throws WxErrorException {
+ List list = new ArrayList<>();
+ list.add("敏感词1");
+ list.add("敏感词2");
+ this.wxService.getGuideService().setGuideAcctConfig(false, list, "离线自动回复");
+ }
+
+ @Test
+ public void testGetGuideAcctConfig() throws WxErrorException {
+ final WxMpGuideAcctConfig guideAcctConfig = this.wxService.getGuideService().getGuideAcctConfig();
+ assertThat(guideAcctConfig).isNotNull();
+ }
+
+ @Test
+ public void testPushShowWxaPathMenu() throws WxErrorException {
+ this.wxService.getGuideService().pushShowWxaPathMenu("wx4f793c04fd3be5a8", ACCOUNT);
+ }
+
+ @Test
+ public void testNewGuideGroup() throws WxErrorException {
+ Long id = this.wxService.getGuideService().newGuideGroup("顾问分组名称");
+ assertThat(id).isNotNull();
+ }
+
+ @Test
+ public void testGetGuideGroup() throws WxErrorException {
+ List guideGroupList = this.wxService.getGuideService().getGuideGroupList();
+ assertThat(guideGroupList).isNotNull();
+ }
+
+ @Test
+ public void testGetGroupInfo() throws WxErrorException {
+ WxMpGuideGroupInfoList groupInfo = this.wxService.getGuideService().getGroupInfo(1860131524965138433L, 0, 10);
+ assertThat(groupInfo).isNotNull();
+ }
+
+ @Test
+ public void testAddGuide2GuideGroup() throws WxErrorException {
+ this.wxService.getGuideService().addGuide2GuideGroup(1860131524965138433L, ACCOUNT);
+ }
+
+ @Test
+ public void testDelGuide2GuideGroup() throws WxErrorException {
+ this.wxService.getGuideService().delGuide2GuideGroup(1860131524965138433L, ACCOUNT);
+ }
+
+ @Test
+ public void testGetGroupByGuide() throws WxErrorException {
+ List groupByGuide = this.wxService.getGuideService().getGroupByGuide(ACCOUNT);
+ assertThat(groupByGuide).isNotNull();
+ }
+
+ @Test
+ public void testDelGuideGroup() throws WxErrorException {
+ this.wxService.getGuideService().delGuideGroup(1860131524965138433L);
+ }
}
+
diff --git a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpGuideTagServiceImplTest.java b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpGuideTagServiceImplTest.java
new file mode 100644
index 0000000000..6ba2fae1ff
--- /dev/null
+++ b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpGuideTagServiceImplTest.java
@@ -0,0 +1,115 @@
+package me.chanjar.weixin.mp.api.impl;
+
+import com.google.inject.Inject;
+import me.chanjar.weixin.common.error.WxErrorException;
+import me.chanjar.weixin.mp.api.WxMpService;
+import me.chanjar.weixin.mp.api.test.ApiTestModule;
+import me.chanjar.weixin.mp.bean.guide.WxMpGuideBuyerResp;
+import me.chanjar.weixin.mp.bean.guide.WxMpGuideTagInfo;
+import org.testng.annotations.Guice;
+import org.testng.annotations.Test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * @author 广州跨界-宋心成
+ * @date 2021/5/13/013
+ */
+
+@Guice(modules = ApiTestModule.class)
+public class WxMpGuideTagServiceImplTest {
+ @Inject
+ protected WxMpService wxService;
+
+ /**
+ * 顾问微信号 guide_account
+ */
+ private static final String ACCOUNT = "sxc_Warm";
+
+ @Test
+ public void testNewGuideTagOption() throws WxErrorException {
+ List list = new ArrayList<>();
+ list.add("分类一");
+ list.add("分类二");
+ list.add("分类三");
+ this.wxService.getGuideTagService().newGuideTagOption("A组", list);
+ }
+
+ @Test
+ public void testDelGuideTagOption() throws WxErrorException {
+ this.wxService.getGuideTagService().delGuideTagOption("A组");
+ }
+
+ @Test
+ public void testAddGuideTagOption() throws WxErrorException {
+ List list = new ArrayList<>();
+ list.add("分类四");
+ this.wxService.getGuideTagService().addGuideTagOption("A组", list);
+ }
+
+ @Test
+ public void testGetGuideTagOption() throws WxErrorException {
+ List guideTagOption = this.wxService.getGuideTagService().getGuideTagOption();
+ assertThat(guideTagOption).isNotNull();
+ }
+
+ @Test
+ public void testAddGuideBuyerTag() throws WxErrorException {
+ List list = new ArrayList<>();
+ list.add("oqlk8v0uTJgRnn5eEskNruD4-bc8");
+ list.add("oqlk8vybPMWapMwOfFTFVYqWpGM0");
+ List wxMpGuideBuyerResps = this.wxService.getGuideTagService().addGuideBuyerTag(ACCOUNT, null, "分类一", list);
+ assertThat(wxMpGuideBuyerResps).isNotNull();
+ }
+
+ @Test
+ public void testAddGuideBuyerTagOnce() throws WxErrorException {
+ this.wxService.getGuideTagService().addGuideBuyerTag(ACCOUNT, null, "分类二", "oqlk8v0uTJgRnn5eEskNruD4-bc8");
+ }
+
+ @Test
+ public void testGetGuideBuyerTag() throws WxErrorException {
+ List guideBuyerTag = this.wxService.getGuideTagService().getGuideBuyerTag(ACCOUNT, null, "oqlk8v0uTJgRnn5eEskNruD4-bc8", true);
+ assertThat(guideBuyerTag).isNotNull();
+ }
+
+ @Test
+ public void testQueryGuideBuyerByTag() throws WxErrorException {
+ List list = new ArrayList<>();
+ list.add("分类一");
+ List list1 = this.wxService.getGuideTagService().queryGuideBuyerByTag(ACCOUNT, null, 0, list);
+ assertThat(list1).isNotNull();
+ }
+
+ @Test
+ public void testdelGuideBuyerTag() throws WxErrorException {
+ List list = new ArrayList<>();
+ list.add("oqlk8v0uTJgRnn5eEskNruD4-bc8");
+ list.add("oqlk8vybPMWapMwOfFTFVYqWpGM0");
+ List respList = this.wxService.getGuideTagService().delGuideBuyerTag(ACCOUNT, null, "分类一", list);
+ assertThat(respList).isNotNull();
+ }
+
+ @Test
+ public void testDelGuideBuyerTagOnce() throws WxErrorException {
+ this.wxService.getGuideTagService().delGuideBuyerTag(ACCOUNT, null, "分类一", "oqlk8v0uTJgRnn5eEskNruD4-bc8");
+ }
+
+ @Test
+ public void testAddGuideBuyerDisplayTag() throws WxErrorException {
+ List list = new ArrayList<>();
+ list.add("自定义信息1");
+ list.add("自定义信息2");
+ this.wxService.getGuideTagService().addGuideBuyerDisplayTag(ACCOUNT, null, "oqlk8v0uTJgRnn5eEskNruD4-bc8", list);
+ }
+
+ @Test
+ public void testGetGuideBuyerDisplayTag() throws WxErrorException {
+ List list = this.wxService.getGuideTagService().getGuideBuyerDisplayTag(ACCOUNT, null, "oqlk8v0uTJgRnn5eEskNruD4-bc8");
+ assertThat(list).isNotNull();
+ }
+
+}
From aec9387e2fcf11dfce17a6dab21e9c7f9c3b2b29 Mon Sep 17 00:00:00 2001
From: zpf <178668028@qq.com>
Date: Mon, 17 May 2021 10:45:59 +0800
Subject: [PATCH 02/17] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=85=AC=E4=BC=97?=
=?UTF-8?q?=E5=8F=B7=E3=80=81=E5=B0=8F=E7=A8=8B=E5=BA=8F=E3=80=81=E4=BC=81?=
=?UTF-8?q?=E4=B8=9A=E5=BE=AE=E4=BF=A1=E7=9A=84access=20token=E8=87=AA?=
=?UTF-8?q?=E5=8A=A8=E5=88=B7=E6=96=B0=E9=80=BB=E8=BE=91=EF=BC=8C=E7=94=A8?=
=?UTF-8?q?=E4=BA=8E=E9=81=BF=E5=85=8D=E5=BD=93=E4=BD=BF=E7=94=A8secrete?=
=?UTF-8?q?=E8=AF=AF=E8=B0=83=E7=94=A8=E7=AC=AC=E4=B8=89=E6=96=B9=E5=B9=B3?=
=?UTF-8?q?=E5=8F=B0=E4=B8=93=E5=B1=9E=E6=8E=A5=E5=8F=A3=E7=9A=84=E6=83=85?=
=?UTF-8?q?=E5=86=B5=E4=B8=8B=E5=87=BA=E7=8E=B0=E5=BE=AA=E7=8E=AF=E9=80=92?=
=?UTF-8?q?=E5=BD=92=E8=B0=83=E7=94=A8=E7=94=9A=E8=87=B3=E8=A2=AB=E5=BE=AE?=
=?UTF-8?q?=E4=BF=A1=E9=99=90=E5=88=B6qps=E3=80=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../cp/api/impl/BaseWxCpServiceImpl.java | 10 ++-
.../weixin/cp/api/WxCpBusyRetryTest.java | 2 +-
.../cp/api/impl/BaseWxCpServiceImplTest.java | 70 ++++++++++++++++-
.../miniapp/api/impl/BaseWxMaServiceImpl.java | 10 ++-
.../miniapp/api/impl/WxMaServiceImplTest.java | 40 ++++++++++
.../mp/api/impl/BaseWxMpServiceImpl.java | 10 ++-
.../weixin/mp/api/WxMpBusyRetryTest.java | 10 +--
.../mp/api/impl/BaseWxMpServiceImplTest.java | 76 ++++++++++++++++---
8 files changed, 200 insertions(+), 28 deletions(-)
diff --git a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/BaseWxCpServiceImpl.java b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/BaseWxCpServiceImpl.java
index 65ba5dce51..8c70178213 100644
--- a/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/BaseWxCpServiceImpl.java
+++ b/weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/impl/BaseWxCpServiceImpl.java
@@ -241,7 +241,7 @@ public T execute(RequestExecutor executor, String uri, E data) thro
int retryTimes = 0;
do {
try {
- return this.executeInternal(executor, uri, data);
+ return this.executeInternal(executor, uri, data, false);
} catch (WxErrorException e) {
if (retryTimes + 1 > this.maxRetryTimes) {
log.warn("重试达到最大次数【{}】", this.maxRetryTimes);
@@ -271,7 +271,7 @@ public T execute(RequestExecutor executor, String uri, E data) thro
throw new WxRuntimeException("微信服务端异常,超出重试次数");
}
- protected T executeInternal(RequestExecutor executor, String uri, E data) throws WxErrorException {
+ protected T executeInternal(RequestExecutor executor, String uri, E data, boolean doNotAutoRefresh) throws WxErrorException {
E dataForLog = DataUtils.handleDataWithSecret(data);
if (uri.contains("access_token=")) {
@@ -291,9 +291,11 @@ protected T executeInternal(RequestExecutor executor, String uri, E
if (WxConsts.ACCESS_TOKEN_ERROR_CODES.contains(error.getErrorCode())) {
// 强制设置wxCpConfigStorage它的access token过期了,这样在下一次请求里就会刷新access token
this.configStorage.expireAccessToken();
- if (this.getWxCpConfigStorage().autoRefreshToken()) {
+ if (this.getWxCpConfigStorage().autoRefreshToken() && !doNotAutoRefresh) {
log.warn("即将重新获取新的access_token,错误代码:{},错误信息:{}", error.getErrorCode(), error.getErrorMsg());
- return this.execute(executor, uri, data);
+ //下一次不再自动重试
+ //当小程序误调用第三方平台专属接口时,第三方无法使用小程序的access token,如果可以继续自动获取token会导致无限循环重试,直到栈溢出
+ return this.executeInternal(executor, uri, data, true);
}
}
diff --git a/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/WxCpBusyRetryTest.java b/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/WxCpBusyRetryTest.java
index b8a72add12..34d4065dcf 100644
--- a/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/WxCpBusyRetryTest.java
+++ b/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/WxCpBusyRetryTest.java
@@ -22,7 +22,7 @@ public Object[][] getService() {
@Override
public synchronized T executeInternal(
- RequestExecutor executor, String uri, E data)
+ RequestExecutor executor, String uri, E data, boolean doNotAutoRefresh)
throws WxErrorException {
log.info("Executed");
throw new WxErrorException("something");
diff --git a/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/impl/BaseWxCpServiceImplTest.java b/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/impl/BaseWxCpServiceImplTest.java
index 22cee8f405..739470a2d7 100644
--- a/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/impl/BaseWxCpServiceImplTest.java
+++ b/weixin-java-cp/src/test/java/me/chanjar/weixin/cp/api/impl/BaseWxCpServiceImplTest.java
@@ -1,13 +1,26 @@
package me.chanjar.weixin.cp.api.impl;
import com.google.inject.Inject;
+import me.chanjar.weixin.common.error.WxError;
import me.chanjar.weixin.common.error.WxErrorException;
+import me.chanjar.weixin.common.error.WxMpErrorMsgEnum;
+import me.chanjar.weixin.common.util.http.HttpType;
+import me.chanjar.weixin.common.util.http.RequestExecutor;
import me.chanjar.weixin.cp.api.ApiTestModule;
import me.chanjar.weixin.cp.api.WxCpService;
+import me.chanjar.weixin.cp.config.WxCpConfigStorage;
+import me.chanjar.weixin.cp.config.impl.WxCpDefaultConfigImpl;
+import org.mockito.Mockito;
+import org.testng.Assert;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.concurrent.atomic.AtomicInteger;
+
import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
/**
*
@@ -35,6 +48,61 @@ public void testJsCode2Session() throws WxErrorException {
@Test
public void testGetProviderToken() throws WxErrorException {
- assertThat(this.wxService.getProviderToken("111","123")).isNotNull();
+ assertThat(this.wxService.getProviderToken("111", "123")).isNotNull();
+ }
+
+
+ @Test
+ public void testExecuteAutoRefreshToken() throws WxErrorException, IOException {
+ //测试access token获取时的重试机制
+ WxCpDefaultConfigImpl config = new WxCpDefaultConfigImpl();
+ BaseWxCpServiceImpl service = new BaseWxCpServiceImpl() {
+ @Override
+ public Object getRequestHttpClient() {
+ return null;
+ }
+
+ @Override
+ public Object getRequestHttpProxy() {
+ return null;
+ }
+
+ @Override
+ public HttpType getRequestType() {
+ return null;
+ }
+
+ @Override
+ public String getAccessToken(boolean forceRefresh) throws WxErrorException {
+ return "模拟一个过期的access token:" + System.currentTimeMillis();
+ }
+
+ @Override
+ public void initHttp() {
+
+ }
+
+ @Override
+ public WxCpConfigStorage getWxCpConfigStorage() {
+ return config;
+ }
+ };
+ config.setAgentId(1);
+ service.setWxCpConfigStorage(config);
+ RequestExecutor