🆕 #2113 【公众号】增加对话能力(原导购)相关接口

This commit is contained in:
hywr 2021-05-14 21:32:25 +08:00 committed by GitHub
parent a596228a8d
commit 7359abf7c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
45 changed files with 3462 additions and 27 deletions

View File

@ -0,0 +1,157 @@
package me.chanjar.weixin.mp.api;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.mp.bean.guide.*;
import java.util.List;
/**
* @author <a href="https://www.sacoc.cn">广州跨界-宋心成</a>
* @date 2021/5/13/013
*/
public interface WxMpGuideBuyerService {
/**
* 为顾问分配客户(批量)
*
* <pre>
* 请求地址 POST https://api.weixin.qq.com/cgi-bin/guide/addguidebuyerrelation?access_token=ACCESS_TOKEN
* 文档地址https://developers.weixin.qq.com/doc/offiaccount/Shopping_Guide/buyer-account/shopping-guide.addGuideBuyerRelation.html
* </pre>
*
* @param account 顾问微信号guide_account和guide_openid二选一若同时请求默认为guide_account
* @param openid 顾问openid或者unionidguide_account和guide_openid二选一
* @param infos 客户列表
* @return 客户列表添加结果
* @throws WxErrorException .
*/
List<WxMpGuideBuyerResp> addGuideBuyerRelation(String account, String openid, List<WxMpAddGuideBuyerInfo> infos) throws WxErrorException;
/**
* 为顾问分配客户(单个)
*
* @param account 顾问微信号guide_account和guide_openid二选一若同时请求默认为guide_account
* @param openid 顾问openid或者unionidguide_account和guide_openid二选一
* @param userOpenid 用户openid
* @param nickname 用户昵称
* @throws WxErrorException .
*/
void addGuideBuyerRelation(String account, String openid, String userOpenid, String nickname) throws WxErrorException;
/**
* 为顾问移除客户(批量)
*
* <pre>
* 请求地址 POST https://api.weixin.qq.com/cgi-bin/guide/delguidebuyerrelation?access_token=ACCESS_TOKEN
* 文档地址https://developers.weixin.qq.com/doc/offiaccount/Shopping_Guide/buyer-account/shopping-guide.delGuideBuyerRelation.html
* </pre>
*
* @param account 顾问微信号guide_account和guide_openid二选一若同时请求默认为guide_account
* @param openid 顾问openid或者unionidguide_account和guide_openid二选一
* @param buyerOpenIds 客户openid列表不超过200
* @return 客户列表移除结果
*/
List<WxMpGuideBuyerResp> delGuideBuyerRelation(String account, String openid, List<String> buyerOpenIds) throws WxErrorException;
/**
* 为顾问移除客户(单个)
*
* @param account 顾问微信号guide_account和guide_openid二选一若同时请求默认为guide_account
* @param openid 顾问openid或者unionidguide_account和guide_openid二选一
* @param userOpenid 用户openid
* @throws WxErrorException .
*/
void delGuideBuyerRelation(String account, String openid, String userOpenid) throws WxErrorException;
/**
* 获取顾问的客户列表
*
* <pre>
* 请求地址 POST https://api.weixin.qq.com/cgi-bin/guide/getguidebuyerrelationlist?access_token=ACCESS_TOKEN
* 文档地址https://developers.weixin.qq.com/doc/offiaccount/Shopping_Guide/buyer-account/shopping-guide.getGuideBuyerRelationList.html
* </pre>
*
* @param account 顾问微信号guide_account和guide_openid二选一若同时请求默认为guide_account
* @param openid 顾问openid或者unionidguide_account和guide_openid二选一
* @param page 分页页数从0开始用于组内顾问分页获取
* @param num 每页数量
* @return 顾问的客户列表
* @throws WxErrorException .
*/
WxMpGuideBuyerInfoList getGuideBuyerRelationList(String account, String openid, int page, int num) throws WxErrorException;
/**
* 为客户更换顾问(批量)
*
* <pre>
* 请求地址 POST https://api.weixin.qq.com/cgi-bin/guide/rebindguideacctforbuyer?access_token=ACCESS_TOKEN
* 文档地址https://developers.weixin.qq.com/doc/offiaccount/Shopping_Guide/buyer-account/shopping-guide.rebindGuideAcctForBuyer.html
* </pre>
*
* @param oldAccount 原顾问微信号old_guide_account和new_guide_account配套使用
* @param oldOpenid 原顾问openid或者unionidold_guide_openid和new_guide_openid配套使用
* @param account 新顾问微信号new_guide_account和new_guide_openid二选一
* @param openid 新顾问openid或者unionidnew_guide_account和new_guide_openid二选一
* @param buyerOpenIds 客户列表不超过200
* @return 客户列表换绑结果
* @throws WxErrorException .
*/
List<WxMpGuideBuyerResp> rebindGuideAcctForBuyer(String oldAccount, String oldOpenid, String account, String openid, List<String> buyerOpenIds) throws WxErrorException;
/**
* 为客户更换顾问(单个)
*
* @param oldAccount 原顾问微信号old_guide_account和new_guide_account配套使用
* @param oldOpenid 原顾问openid或者unionidold_guide_openid和new_guide_openid配套使用
* @param account 新顾问微信号new_guide_account和new_guide_openid二选一
* @param openid 新顾问openid或者unionidnew_guide_account和new_guide_openid二选一
* @param userOpenid 用户openid
* @throws WxErrorException
*/
void rebindGuideAcctForBuyer(String oldAccount, String oldOpenid, String account, String openid, String userOpenid) throws WxErrorException;
/**
* 修改客户昵称
*
* <pre>
* 请求地址 POST https://api.weixin.qq.com/cgi-bin/guide/updateguidebuyerrelation?access_token=ACCESS_TOKEN
* 文档地址https://developers.weixin.qq.com/doc/offiaccount/Shopping_Guide/buyer-account/shopping-guide.updateGuideBuyerRelation.html
* </pre>
*
* @param account 顾问微信号guide_account和guide_openid二选一若同时请求默认为guide_account
* @param openid 顾问openid或者unionidguide_account和guide_openid二选一
* @param userOpenid 客户openid
* @param nickname 客户昵称
* @throws WxErrorException .
*/
void updateGuideBuyerRelation(String account, String openid, String userOpenid, String nickname) throws WxErrorException;
/**
* 查询客户所属顾问
*
* <pre>
* 请求地址 POST https://api.weixin.qq.com/cgi-bin/guide/getguidebuyerrelationbybuyer?access_token=ACCESS_TOKEN
* 文档地址https://developers.weixin.qq.com/doc/offiaccount/Shopping_Guide/buyer-account/shopping-guide.getGuideBuyerRelationByBuyer.html
* </pre>
*
* @param openid 客户openid
* @return 客户顾问关系信息
* @throws WxErrorException .
*/
WxMpGuideBuyerRelation getGuideBuyerRelationByBuyer(String openid) throws WxErrorException;
/**
* 查询指定顾问和客户的关系
*
* <pre>
* 请求地址 POST https://api.weixin.qq.com/cgi-bin/guide/getguidebuyerrelation?access_token=ACCESS_TOKEN
* 文档地址https://developers.weixin.qq.com/doc/offiaccount/Shopping_Guide/buyer-account/shopping-guide.getGuideBuyerRelation.html
* </pre>
*
* @param account 顾问微信号guide_account和guide_openid二选一若同时请求默认为guide_account
* @param openid 顾问openid或者unionidguide_account和guide_openid二选一
* @param userOpenid 客户openid
* @return 客户信息
* @throws WxErrorException .
*/
WxMpGuideBuyerInfo getGuideBuyerRelation(String account, String openid, String userOpenid) throws WxErrorException;
}

View File

@ -0,0 +1,100 @@
package me.chanjar.weixin.mp.api;
import me.chanjar.weixin.common.error.WxErrorException;
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 java.util.List;
/**
* @author <a href="https://www.sacoc.cn">广州跨界-宋心成</a>
* @date 2021/5/13/013
*/
public interface WxMpGuideMassedJobService {
/**
* 添加群发任务
*
* <pre>
* 请求地址 POST https://api.weixin.qq.com/cgi-bin/guide/addguidemassendjob?access_token=ACCESS_TOKEN
* 文档地址https://developers.weixin.qq.com/doc/offiaccount/Shopping_Guide/task-account/shopping-guide.addGuideMassendJob.html
* </pre>
*
* @param account 顾问微信号guide_account和guide_openid二选一
* @param openid 顾问openid或者unionidguide_account和guide_openid二选一
* @param taskName 群发任务名称,不超过16字
* @param taskRemark 群发任务备注,不超过100字
* @param pushTime 任务下发给顾问的时间, 秒级时间戳, 范围为当前时间开始到最近一个月内
* @param userOpenIds 客户openid列表
* @param materialInfos 不超过3个素材
* @return 群发任务id与客户openid列表
* @throws WxErrorException
*/
WxMpGuideMassed addGuideMassedJob(String account, String openid, String taskName, String taskRemark, Long pushTime, List<String> userOpenIds, List<WxMpGuideMaterialInfo> materialInfos) throws WxErrorException;
/**
* 获取群发任务列表
*
* <pre>
* 请求地址 POST https://api.weixin.qq.com/cgi-bin/guide/getguidemassendjoblist?access_token=ACCESS_TOKEN
* 文档地址https://developers.weixin.qq.com/doc/offiaccount/Shopping_Guide/task-account/shopping-guide.getGuideMassendJobList.html
* </pre>
*
* @param account 顾问微信号guide_account和guide_openid二选一
* @param openid 顾问openid或者unionidguide_account和guide_openid二选一
* @param taskStatus 获取指定状态的任务为空则表示拉取所有状态的任务
* @param offset 偏移位置(从什么位置开始拉取)
* @param limit 条数默认50
* @return 群发任务列表
* @throws WxErrorException
*/
List<WxMpGuideMassedInfo> getGuideMassedJobList(String account, String openid, List<Integer> taskStatus, Integer offset, Integer limit) throws WxErrorException;
/**
* 获取指定群发任务信息
*
* <pre>
* 请求地址 POST https://api.weixin.qq.com/cgi-bin/guide/getguidemassendjob?access_token=ACCESS_TOKEN
* 文档地址https://developers.weixin.qq.com/doc/offiaccount/Shopping_Guide/task-account/shopping-guide.getGuideMassendJob.html
* </pre>
*
* @param taskId 任务ID
* @return 群发任务信息
* @throws WxErrorException
*/
WxMpGuideMassedInfo getGuideMassedJob(String taskId) throws WxErrorException;
/**
* 修改群发任务
* 无法修改已经执行的任务返回参数错误
*
* <pre>
* 请求地址 POST https://api.weixin.qq.com/cgi-bin/guide/updateguidemassendjob?access_token=ACCESS_TOKEN
* 文档地址https://developers.weixin.qq.com/doc/offiaccount/Shopping_Guide/task-account/shopping-guide.updateGuideMassendJob.html
* </pre>
*
* @param taskId 任务ID
* @param taskName 群发任务名称,不超过16字
* @param taskRemark 群发任务备注,不超过100字
* @param pushTime 下发时间, 秒级时间戳, 范围为当前时间开始到最近一个月内
* @param userOpenIds 客户openid列表
* @param materialInfos 不超过3个素材
* @throws WxErrorException
*/
void updateGuideMassedJob(String taskId, String taskName, String taskRemark, Long pushTime, List<String> userOpenIds, List<WxMpGuideMaterialInfo> materialInfos) throws WxErrorException;
/**
* 取消群发任务
* 取消给顾问分配的群发任务, 已执行的任务无法取消
*
* <pre>
* 请求地址 POST https://api.weixin.qq.com/cgi-bin/guide/cancelguidemassendjob?access_token=ACCESS_TOKEN
* 文档地址https://developers.weixin.qq.com/doc/offiaccount/Shopping_Guide/task-account/shopping-guide.cancelGuideMassendJob.html
* </pre>
*
* @param taskId 任务ID
* @throws WxErrorException .
*/
void cancelGuideMassedJob(String taskId) throws WxErrorException;
}

View File

@ -0,0 +1,153 @@
package me.chanjar.weixin.mp.api;
import me.chanjar.weixin.common.error.WxErrorException;
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 java.util.List;
/**
* @author <a href="https://www.sacoc.cn">广州跨界-宋心成</a>
* @date 2021/5/13/013
*/
public interface WxMpGuideMaterialService {
/**
* 添加小程序卡片素材
* <p>
* 踩坑记录2021/5/12该方法只支持临时素材mediaid
*
* <pre>
* 请求地址 POST https://api.weixin.qq.com/cgi-bin/guide/setguidecardmaterial?access_token=ACCESS_TOKEN
* 文档地址https://developers.weixin.qq.com/doc/offiaccount/Shopping_Guide/model-account/shopping-guide.setGuideCardMaterial.html
* </pre>
*
* @param mediaId 图片素材只能用素材管理获取media_id注意只支持临时素材的media_id
* @param type 操作类型填0表示服务号素材
* @param title 小程序卡片名字
* @param path 小程序路径
* @param appId 小程序的appid
* @throws WxErrorException .
*/
void setGuideCardMaterial(String mediaId, int type, String title, String path, String appId) throws WxErrorException;
/**
* 查询小程序卡片素材
*
* <pre>
* 请求地址 POST https://api.weixin.qq.com/cgi-bin/guide/getguidecardmaterial?access_token=ACCESS_TOKEN
* 文档地址https://developers.weixin.qq.com/doc/offiaccount/Shopping_Guide/model-account/shopping-guide.getGuideCardMaterial.html
* </pre>
*
* @param type 操作类型填0表示服务号素材
* @return 小程序卡片素材信息列表
* @throws WxErrorException .
*/
List<WxMpGuideCardMaterialInfo> getGuideCardMaterial(int type) throws WxErrorException;
/**
* 删除小程序卡片素材
*
* <pre>
* 请求地址 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
* </pre>
*
* @param type 操作类型填0表示服务号素材
* @param title 小程序卡片名字
* @param path 小程序路径
* @param appId 小程序的appid
* @throws WxErrorException .
*/
void delGuideCardMaterial(int type, String title, String path, String appId) throws WxErrorException;
/**
* 添加图片素材
*
* <pre>
* 请求地址 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
* </pre>
*
* @param mediaId 图片素材只能用素材管理获取media_id注意只支持临时素材的media_id
* @param type 操作类型填0表示服务号素材
* @throws WxErrorException .
*/
void setGuideImageMaterial(String mediaId, int type) throws WxErrorException;
/**
* 查询图片素材
*
* <pre>
* 请求地址 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
* </pre>
*
* @param type 操作类型填0表示服务号素材
* @param start 分页查询起始位置
* @param num 分页查询查询个数
* @return 图片素材列表
* @throws WxErrorException .
*/
WxMpGuideImgMaterialInfoList getGuideImageMaterial(int type, int start, int num) throws WxErrorException;
/**
* 删除图片素材
*
* <pre>
* 请求地址 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
* </pre>
*
* @param type 操作类型填0表示服务号素材
* @param picUrl 图片素材内容
* @throws WxErrorException .
*/
void delGuideImageMaterial(int type, String picUrl) throws WxErrorException;
/**
* 添加文字素材
*
* <pre>
* 请求地址 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
* </pre>
*
* @param type 操作类型填0表示服务号素材
* @param word 文字素材内容
* @throws WxErrorException .
*/
void setGuideWordMaterial(int type, String word) throws WxErrorException;
/**
* 查询文字素材
*
* <pre>
* 请求地址 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
* </pre>
*
* @param type 操作类型填0表示服务号素材
* @param start 分页查询起始位置
* @param num 分页查询查询个数
* @return 文字素材列表
* @throws WxErrorException
*/
WxMpGuideWordMaterialInfoList getGuideWordMaterial(int type, int start, int num) throws WxErrorException;
/**
* 删除文字素材
*
* <pre>
* 请求地址 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
* </pre>
*
* @param type 操作类型填0表示服务号素材
* @param word 文字素材内容
* @throws WxErrorException .
*/
void delGuideWordMaterial(int type, String word) throws WxErrorException;
}

View File

@ -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 @@ import me.chanjar.weixin.mp.bean.guide.WxMpGuideList;
* @date 2020 -10-06
*/
public interface WxMpGuideService {
/**
* 为服务号添加顾问
* <pre>
@ -93,4 +95,240 @@ public interface WxMpGuideService {
* @throws WxErrorException .
*/
WxMpGuideList listGuide(int page, int num) throws WxErrorException;
/**
* 生成顾问二维码
* <p>
* 生成顾问二维码后微信用户扫码直接跳转公众号首页分为两种情况
* 1.微信用户已经关注公众号扫码后绑定该顾问
* 2.微信用户未关注公众号扫码后 3 分钟内关注该公众号则绑定该顾问
*
* <pre>
* 请求地址 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
* </pre>
*
* @param account 顾问微信号guide_account和guide_openid二选一若同时请求默认为guide_account
* @param openid 顾问openid或者unionidguide_account和guide_openid二选一
* @param qrcodeInfo 额外参数用于事件推送
* @return 二维码下载链接
* @throws WxErrorException .
*/
String createGuideQrCode(String account, String openid, String qrcodeInfo) throws WxErrorException;
/**
* 获取顾问聊天记录
* <p>
* 支持拉取该顾问近 30 天的聊天记录begin_time end_time 同时非0情况下该参数才会生效否则为默认值
*
* <pre>
* 请求地址 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
* </pre>
*
* @param account 顾问微信号guide_account和guide_openid二选一若同时请求默认为guide_account
* @param openid 顾问openid或者unionidguide_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;
/**
* 设置快捷回复与关注自动回复
* <p>
* 快捷回复指顾问在对话详情页可快速选择的回复内容
* 注意1.快捷回复只允许全部删除 2.快捷回复的添加删除需要指定顾问的guide_account和guide_openid二选一
* <p>
* 关注自动回复是指客户通过扫顾问码扫顾问分组码微信广告三种方式主动关注公众号并绑定顾问
* 顾问会下发的自动回复即顾问欢迎语最多可下发两条消息支持文字图片或小程序素材可更新删除设置好后先后下发
* 不指定 guide_account guide_openid 可设置所有顾问默认的关注自动回复
* 对单个顾问来说如果指定 guide_account guide_openid 设置了自动回复则下发它否则下发所有顾问默认的关注自动回复
* 注意自动回复每次设置会覆盖原有的自动回复只允许出现两条
* <p>
* 特别注意删除需要传递 guideAutoReply:{"msgtype":"1"}
* 删除目前只支持两条全部删除 2021/5/8
* <p>
* 自动回复格式
* String content: 新客户关注自动回复内容,图片填mediaid,获取方式同图片素材,小程序卡片填下面请求demo中字段的json格式
* int msgtype: 1表示文字2表示图片3表示小程序卡片
* 例如JsonObject{"content": "abc","msgtype":"1"}
*
* <pre>
* 请求地址 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
* </pre>
*
* @param account 顾问微信号guide_account和guide_openid二选一若同时请求默认为guide_account
* @param openid 顾问openid或者unionidguide_account和guide_openid二选一
* @param isDelete 操作类型false表示添加 true表示删除
* @param guideFastReplyList 快捷回复列表
* @param guideAutoReply 第一条新客户关注自动回复
* @param guideAutoReplyPlus 第二条新客户关注自动回复
* @throws WxErrorException .
*/
void setGuideConfig(String account, String openid, boolean isDelete, List<String> guideFastReplyList, WxMpAddGuideAutoReply guideAutoReply, WxMpAddGuideAutoReply guideAutoReplyPlus) throws WxErrorException;
/**
* 获取快捷回复与关注自动回复
* 如果要获取服务号维度的新客户关注自动回复不填guide_account与guide_openid即可
*
* <pre>
* 请求地址 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
* </pre>
*
* @param account 顾问微信号guide_account和guide_openid二选一若同时请求默认为guide_account
* @param openid 顾问openid或者unionidguide_account和guide_openid二选一
* @return 顾问的 快捷回复关注顾问自动回复
*/
WxMpGuideConfig getGuideConfig(String account, String openid) throws WxErrorException;
/**
* 为服务号设置敏感词与离线自动回复
* 顾问在小程序离线状态时客户发消息会收到设置的离线自动回复最多支持 300 顾问在小程序内发消息如果触发敏感词将无法发出
* <p>
* 注意添加模式 black_keyword字段传递null将删除全部敏感词
* black_keyword字段有值将对敏感词进行追加而不是全量更新覆盖 实际测试与官方文档有冲突
*
* <pre>
* 请求地址 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
* </pre>
*
* @param isDelete 操作类型false表示添加 true表示删除
* @param blackKeyword 敏感词每次全量更新覆盖原来数据如果不设置就不传black_keyword字段
* @param guideAutoReply 离线自动回复如果不设置就不传guide_auto_reply字段
* @throws WxErrorException .
*/
void setGuideAcctConfig(boolean isDelete, List<String> blackKeyword, String guideAutoReply) throws WxErrorException;
/**
* 获取离线自动回复与敏感词
*
* <pre>
* 请求地址 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
* </pre>
*
* @return 离线自动回复与敏感词
* @throws WxErrorException .
*/
WxMpGuideAcctConfig getGuideAcctConfig() throws WxErrorException;
/**
* 允许微信用户复制小程序页面路径
* 请求成功后该微信号用户可在微信上复制对应小程序的任意页面path有效期为60天若需要添加小程序卡片素材时的path可以用这个方式获取
*
* <pre>
* 请求地址 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
* </pre>
*
* @param appId 小程序appid暂时只支持小程序不支持小游戏
* @param userName 关注该公众号的微信号
* @throws WxErrorException .
*/
void pushShowWxaPathMenu(String appId, String userName) throws WxErrorException;
/**
* 新建顾问分组
*
* <pre>
* 请求地址 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
* </pre>
*
* @param groupName 顾问分组名称
* @return 顾问分组唯一id
* @throws WxErrorException .
*/
Long newGuideGroup(String groupName) throws WxErrorException;
/**
* 获取服务号下所有顾问分组的列表
*
* <pre>
* 请求地址 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
* </pre>
*
* @return 顾问分组列表
* @throws WxErrorException .
*/
List<WxMpGuideGroup> getGuideGroupList() throws WxErrorException;
/**
* 获取指定顾问分组内顾问信息
*
* <pre>
* 请求地址 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
* </pre>
*
* @param groupId 顾问群组id
* @param page 分页页数从0开始用于组内顾问分页获取
* @param num 每页数量
* @return 顾问分组内顾问信息
* @throws WxErrorException .
*/
WxMpGuideGroupInfoList getGroupInfo(long groupId, int page, int num) throws WxErrorException;
/**
* 分组内添加顾问
*
* <pre>
* 请求地址 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
* </pre>
*
* @param groupId 顾问分组id
* @param account 顾问微信号
* @throws WxErrorException .
*/
void addGuide2GuideGroup(long groupId, String account) throws WxErrorException;
/**
* 分组内删除顾问
*
* <pre>
* 请求地址 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
* </pre>
*
* @param groupId 顾问分组id
* @param account 顾问微信号
* @throws WxErrorException .
*/
void delGuide2GuideGroup(long groupId, String account) throws WxErrorException;
/**
* 获取顾问所在分组
*
* <pre>
* 请求地址 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
* </pre>
*
* @param account 顾问微信号
* @return 顾问分组id列表
* @throws WxErrorException .
*/
List<Long> getGroupByGuide(String account) throws WxErrorException;
/**
* 删除指定顾问分组
*
* <pre>
* 请求地址 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
* </pre>
*
* @param groupId 顾问分组id
* @throws WxErrorException .
*/
void delGuideGroup(long groupId) throws WxErrorException;
}

View File

@ -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 <a href="https://www.sacoc.cn">广州跨界-宋心成</a>
* @date 2021/5/13/013
*/
public interface WxMpGuideTagService {
/**
* 新建标签类型
* 最多 4 类标签类型50 个可选值所有的标签可选值不能有相等重复的值
*
* <pre>
* 请求地址 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
* </pre>
*
* @param tagName 标签类型的名字
* @param values 标签可选值列表可选值不能为空值所有的标签可选值不能有相等重复的值
* @throws WxErrorException
*/
void newGuideTagOption(String tagName, List<String> values) throws WxErrorException;
/**
* 删除指定标签类型
* 此操作会更新所有相关客户的标签信息存在延迟
*
* <pre>
* 请求地址 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
* </pre>
*
* @param tagName 标签类型的名字
* @throws WxErrorException
*/
void delGuideTagOption(String tagName) throws WxErrorException;
/**
* 为标签添加可选值
*
* <pre>
* 请求地址 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
* </pre>
*
* @param tagName 标签类型的名字
* @param values 标签可选值列表可选值不能为空值所有的标签可选值不能有相等重复的值
* @throws WxErrorException
*/
void addGuideTagOption(String tagName, List<String> values) throws WxErrorException;
/**
* 获取标签和可选值
*
* <pre>
* 请求地址 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
* </pre>
*
* @return 标签信息列表
*/
List<WxMpGuideTagInfo> getGuideTagOption() throws WxErrorException;
/**
* 为客户设置标签批量
*
* <pre>
* 请求地址 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
* </pre>
*
* @param account 顾问微信号guide_account和guide_openid二选一
* @param openid 顾问openid或者unionidguide_account和guide_openid二选一
* @param value 标签的可选值该值必须在标签的可选值集合中
* @param userOpenIds 客户列表不超过200
* @return 客户列表添加结果
* @throws WxErrorException .
*/
List<WxMpGuideBuyerResp> addGuideBuyerTag(String account, String openid, String value, List<String> userOpenIds) throws WxErrorException;
/**
* 为客户设置标签单个
*
* @param account 顾问微信号guide_account和guide_openid二选一
* @param openid 顾问openid或者unionidguide_account和guide_openid二选一
* @param value 标签的可选值该值必须在标签的可选值集合中
* @param userOpenid 用户openid
* @throws WxErrorException .
*/
void addGuideBuyerTag(String account, String openid, String value, String userOpenid) throws WxErrorException;
/**
* 查询客户标签
*
* <pre>
* 请求地址 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
* </pre>
* <p>
* 踩坑记录2021/5/12这里不只是返回标签值
* 如果该客户设置了自定义信息也会同样返回在标签数组的末尾
* 未设置则只返回客户标签列表
* 为此坑我添加一个参数是否排除客户自定义信息
*
* @param account 顾问微信号guide_account和guide_openid二选一
* @param openid 顾问openid或者unionidguide_account和guide_openid二选一
* @param userOpenid 用户openid
* @param isExclude 是否排除客户自定义信息
* @return 标签值列表
* @throws WxErrorException
*/
List<String> getGuideBuyerTag(String account, String openid, String userOpenid, Boolean isExclude) throws WxErrorException;
/**
* 根据标签值筛选客户
*
* <pre>
* 请求地址 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
* </pre>
* <p>
* 踩坑记录2021/5/12 不传递pushCount参数会返回-1
* 传递0查询所有 推荐传递0
* 当pushCount > 0 该条件查询逻辑有问题
* 目前发现传递1可以查询出可发次数为4次的用户而传递4是查询不出来的
* <p>
* 注意该查询是查询所有条件均符合的 例如查询A标签的客户 假如客户标签为A,B两个 将无法查询到该客户
*
* @param account 顾问微信号guide_account和guide_openid二选一
* @param openid 顾问openid或者unionidguide_account和guide_openid二选一
* @param pushCount 本月还可主动发消息次数 建议传递0查询
* @param value 标签值集合该值必须在标签可选值集合中
* @return 客户openid集合
* @throws WxErrorException
*/
List<String> queryGuideBuyerByTag(String account, String openid, Integer pushCount, List<String> value) throws WxErrorException;
/**
* 删除客户标签(批量)
*
* <pre>
* 请求地址 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
* </pre>
*
* @param account 顾问微信号guide_account和guide_openid二选一
* @param openid 顾问openid或者unionidguide_account和guide_openid二选一
* @param value 标签的可选值该值必须在标签的可选值集合中
* @param userOpenIds 客户列表不超过200
* @return 客户列表处理结果
* @throws WxErrorException
*/
List<WxMpGuideBuyerResp> delGuideBuyerTag(String account, String openid, String value, List<String> userOpenIds) throws WxErrorException;
/**
* 删除客户标签(单个)
*
* @param account 顾问微信号guide_account和guide_openid二选一
* @param openid 顾问openid或者unionidguide_account和guide_openid二选一
* @param value 标签的可选值该值必须在标签的可选值集合中
* @param userOpenid 用户openid
* @throws WxErrorException .
*/
void delGuideBuyerTag(String account, String openid, String value, String userOpenid) throws WxErrorException;
/**
* 设置自定义客户信息
*
* <pre>
* 请求地址 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
* </pre>
*
* @param account 顾问微信号guide_account和guide_openid二选一
* @param openid 顾问openid或者unionidguide_account和guide_openid二选一
* @param userOpenid 用户openid
* @param msgList 自定义客户信息全量更新调用时传所有信息
* @throws WxErrorException .
*/
void addGuideBuyerDisplayTag(String account, String openid, String userOpenid, List<String> msgList) throws WxErrorException;
/**
* 获取自定义客户信息
*
* <pre>
* 请求地址 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
* </pre>
*
* @param account 顾问微信号guide_account和guide_openid二选一
* @param openid 顾问openid或者unionidguide_account和guide_openid二选一
* @param userOpenid 用户openid
* @return 自定义客户信息列表
* @throws WxErrorException
*/
List<String> getGuideBuyerDisplayTag(String account, String openid, String userOpenid) throws WxErrorException;
}

View File

@ -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);
}

View File

@ -8,8 +8,6 @@ import lombok.Getter;
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.enums.WxType;
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<H, P> 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

View File

@ -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 <a href="https://www.sacoc.cn">广州跨界-宋心成</a>
* @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<WxMpGuideBuyerResp> addGuideBuyerRelation(String account, String openid, List<WxMpAddGuideBuyerInfo> infos) throws WxErrorException {
Map<String, Object> 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<List<WxMpGuideBuyerResp>>() {
}.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<WxMpGuideBuyerResp> delGuideBuyerRelation(String account, String openid, List<String> buyerOpenIds) throws WxErrorException {
Map<String, Object> 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<List<WxMpGuideBuyerResp>>() {
}.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<WxMpGuideBuyerResp> rebindGuideAcctForBuyer(String oldAccount, String oldOpenid, String account, String openid, List<String> buyerOpenIds) throws WxErrorException {
Map<String, Object> 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<List<WxMpGuideBuyerResp>>() {
}.getType());
}
@Override
public void rebindGuideAcctForBuyer(String oldAccount, String oldOpenid, String account, String openid, String userOpenid) throws WxErrorException {
Map<String, Object> 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)));
}
}

View File

@ -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 <a href="https://www.sacoc.cn">广州跨界-宋心成</a>
* @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<String> userOpenIds, List<WxMpGuideMaterialInfo> materialInfos) throws WxErrorException {
Map<String, Object> 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<WxMpGuideMassedInfo> getGuideMassedJobList(String account, String openid, List<Integer> taskStatus, Integer offset, Integer limit) throws WxErrorException {
Map<String, Object> 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<List<WxMpGuideMassedInfo>>() {
}.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<String> userOpenIds, List<WxMpGuideMaterialInfo> materialInfos) throws WxErrorException {
Map<String, Object> 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));
}
}

View File

@ -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 <a href="https://www.sacoc.cn">广州跨界-宋心成</a>
* @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<String, Object> 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<WxMpGuideCardMaterialInfo> 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<List<WxMpGuideCardMaterialInfo>>() {
}.getType());
}
@Override
public void delGuideCardMaterial(int type, String title, String path, String appId) throws WxErrorException {
Map<String, Object> 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));
}
}

View File

@ -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 class WxMpGuideServiceImpl implements WxMpGuideService {
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<String> 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<String, Object> 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<String> 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<WxMpGuideGroup> 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<List<WxMpGuideGroup>>() {
}.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<Long> 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<List<Long>>() {
}.getType());
}
@Override
public void delGuideGroup(long groupId) throws WxErrorException {
this.mpService.post(WxMpApiUrl.Guide.DEL_GROUP,
GsonHelper.buildJsonObject("group_id", groupId));
}
}

View File

@ -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 <a href="https://www.sacoc.cn">广州跨界-宋心成</a>
* @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<String> values) throws WxErrorException {
Map<String, Object> 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<String> values) throws WxErrorException {
Map<String, Object> 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<WxMpGuideTagInfo> getGuideTagOption() throws WxErrorException {
String returnString = this.mpService.post(WxMpApiUrl.Guide.GET_GUIDE_TAG_OPTION, new JsonObject());
List<WxMpGuideTagInfo> infoList = WxGsonBuilder.create().fromJson(GsonParser.parse(returnString).getAsJsonArray("options"),
new TypeToken<List<WxMpGuideTagInfo>>() {
}.getType());
return infoList.stream().filter(it -> !it.getTagName().equals("")).collect(Collectors.toList());
}
@Override
public List<WxMpGuideBuyerResp> addGuideBuyerTag(String account, String openid, String value, List<String> userOpenIds) throws WxErrorException {
Map<String, Object> 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<List<WxMpGuideBuyerResp>>() {
}.getType());
}
@Override
public void addGuideBuyerTag(String account, String openid, String value, String userOpenid) throws WxErrorException {
Map<String, Object> 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<String> 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<String> list = WxGsonBuilder.create().fromJson(GsonParser.parse(returnString).getAsJsonArray("tag_values"),
new TypeToken<List<String>>() {
}.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<String> queryGuideBuyerByTag(String account, String openid, Integer pushCount, List<String> value) throws WxErrorException {
Map<String, Object> 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<List<String>>() {
}.getType());
}
@Override
public List<WxMpGuideBuyerResp> delGuideBuyerTag(String account, String openid, String value, List<String> userOpenIds) throws WxErrorException {
Map<String, Object> 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<List<WxMpGuideBuyerResp>>() {
}.getType());
}
@Override
public void delGuideBuyerTag(String account, String openid, String value, String userOpenid) throws WxErrorException {
Map<String, Object> 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<String> msgList) throws WxErrorException {
Map<String, Object> 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<String> getGuideBuyerDisplayTag(String account, String openid, String userOpenid) throws WxErrorException {
Map<String, Object> 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<List<String>>() {
}.getType());
}
}

View File

@ -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 <a href="https://www.sacoc.cn">广州跨界-宋心成</a>
* @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);
}
}

View File

@ -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 <a href="https://www.sacoc.cn">广州跨界-宋心成</a>
* @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);
}
}

View File

@ -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 <a href="https://www.sacoc.cn">广州跨界-宋心成</a>
* @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);
}
}

View File

@ -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 <a href="https://www.sacoc.cn">广州跨界-宋心成</a>
* @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);
}
}

View File

@ -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 <a href="https://www.sacoc.cn">广州跨界-宋心成</a>
* @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);
}
}

View File

@ -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 <a href="https://www.sacoc.cn">广州跨界-宋心成</a>
* @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<WxMpGuideBuyerInfo> list;
public static WxMpGuideBuyerInfoList fromJson(String json) {
return WxGsonBuilder.create().fromJson(json, WxMpGuideBuyerInfoList.class);
}
}

View File

@ -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 <a href="https://www.sacoc.cn">广州跨界-宋心成</a>
* @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);
}
}

View File

@ -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 <a href="https://www.sacoc.cn">广州跨界-宋心成</a>
* @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);
}
}

View File

@ -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 <a href="https://www.sacoc.cn">广州跨界-宋心成</a>
* @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);
}
}

View File

@ -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 <a href="https://www.sacoc.cn">广州跨界-宋心成</a>
* @date 2021/5/8/008
*/
@Data
public class WxMpGuideConfig implements Serializable {
private static final long serialVersionUID = -343579331927473027L;
/**
* 快捷回复列表
*/
@SerializedName("guide_fast_reply_list")
private List<WxMpGuideFastReply> 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);
}
}

View File

@ -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 <a href="https://www.sacoc.cn">广州跨界-宋心成</a>
* @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);
}
}

View File

@ -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 <a href="https://www.sacoc.cn">广州跨界-宋心成</a>
* @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);
}
}

View File

@ -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 <a href="https://www.sacoc.cn">广州跨界-宋心成</a>
* @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);
}
}

View File

@ -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 <a href="https://www.sacoc.cn">广州跨界-宋心成</a>
* @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<WxMpGuideGroupInfo> list;
public static WxMpGuideGroupInfoList fromJson(String json) {
return WxGsonBuilder.create().fromJson(json, WxMpGuideGroupInfoList.class);
}
}

View File

@ -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 <a href="https://www.sacoc.cn">广州跨界-宋心成</a>
* @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);
}
}

View File

@ -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 <a href="https://www.sacoc.cn">广州跨界-宋心成</a>
* @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<WxMpGuideImgMaterialInfo> list;
public static WxMpGuideImgMaterialInfoList fromJson(String json) {
return WxGsonBuilder.create().fromJson(json, WxMpGuideImgMaterialInfoList.class);
}
}

View File

@ -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 <a href="https://www.sacoc.cn">广州跨界-宋心成</a>
* @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<String> list;
@Override
public String toJson() {
return WxGsonBuilder.create().toJson(this);
}
public static <T> 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;
}
}

View File

@ -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 <a href="https://www.sacoc.cn">广州跨界-宋心成</a>
* @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);
}
}

View File

@ -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 <a href="https://www.sacoc.cn">广州跨界-宋心成</a>
* @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<WxMpGuideMaterialInfo> material;
/**
* 客户列表
*/
@SerializedName("buyer_info")
private List<WxMpGuideMassedBuyerInfo> buyerInfos;
@Override
public String toJson() {
return WxGsonBuilder.create().toJson(this);
}
public static <T> 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;
}
}

View File

@ -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 <a href="https://www.sacoc.cn">广州跨界-宋心成</a>
* @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);
}
}

View File

@ -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 <a href="https://www.sacoc.cn">广州跨界-宋心成</a>
* @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);
}
}

View File

@ -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 <a href="https://www.sacoc.cn">广州跨界-宋心成</a>
* @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<WxMpGuideMsg> msgList;
public static WxMpGuideMsgList fromJson(String json) {
return WxGsonBuilder.create().fromJson(json, WxMpGuideMsgList.class);
}
}

View File

@ -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 <a href="https://www.sacoc.cn">广州跨界-宋心成</a>
* @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);
}
}

View File

@ -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 <a href="https://www.sacoc.cn">广州跨界-宋心成</a>
* @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);
}
}

View File

@ -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 <a href="https://www.sacoc.cn">广州跨界-宋心成</a>
* @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<String> values;
@Override
public String toJson() {
return WxGsonBuilder.create().toJson(this);
}
public static WxMpGuideTagInfo fromJson(String json) {
return WxGsonBuilder.create().fromJson(json, WxMpGuideTagInfo.class);
}
}

View File

@ -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 <a href="https://www.sacoc.cn">广州跨界-宋心成</a>
* @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);
}
}

View File

@ -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 <a href="https://www.sacoc.cn">广州跨界-宋心成</a>
* @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<WxMpGuideWordMaterialInfo> list;
public static WxMpGuideWordMaterialInfoList fromJson(String json) {
return WxGsonBuilder.create().fromJson(json, WxMpGuideWordMaterialInfoList.class);
}
}

View File

@ -2,8 +2,8 @@ package me.chanjar.weixin.mp.enums;
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 @@ public interface 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 @@ public interface 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 @@ public interface 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;

View File

@ -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 <a href="https://www.sacoc.cn">广州跨界-宋心成</a>
* @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<WxMpAddGuideBuyerInfo> list = new ArrayList<>();
list.add(WxMpAddGuideBuyerInfo.builder().nickname("小执花").openid("oqlk8v0uTJgRnn5eEskNruD4-bc8").build());
List<WxMpGuideBuyerResp> 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<String> list = new ArrayList<>();
list.add("oqlk8v0uTJgRnn5eEskNruD4-bc8");
List<WxMpGuideBuyerResp> 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<String> list = new ArrayList<>();
list.add("oqlk8v0uTJgRnn5eEskNruD4-bc8");
list.add("oqlk8vybPMWapMwOfFTFVYqWpGM0");
List<WxMpGuideBuyerResp> 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();
}
}

View File

@ -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 <a href="https://www.sacoc.cn">广州跨界-宋心成</a>
* @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<String> userOpenId = new ArrayList<>();
userOpenId.add("oqlk8v0uTJgRnn5eEskNruD4-bc8");
List<WxMpGuideMaterialInfo> 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<WxMpGuideMassedInfo> 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");
}
}

View File

@ -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 <a href="https://www.sacoc.cn">广州跨界-宋心成</a>
* @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<WxMpGuideCardMaterialInfo> 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, "文字素材测试");
}
}

View File

@ -4,11 +4,13 @@ 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.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 class WxMpGuideServiceImplTest {
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<String> 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<String> 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<WxMpGuideGroup> 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<Long> groupByGuide = this.wxService.getGuideService().getGroupByGuide(ACCOUNT);
assertThat(groupByGuide).isNotNull();
}
@Test
public void testDelGuideGroup() throws WxErrorException {
this.wxService.getGuideService().delGuideGroup(1860131524965138433L);
}
}

View File

@ -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 <a href="https://www.sacoc.cn">广州跨界-宋心成</a>
* @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<String> 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<String> list = new ArrayList<>();
list.add("分类四");
this.wxService.getGuideTagService().addGuideTagOption("A组", list);
}
@Test
public void testGetGuideTagOption() throws WxErrorException {
List<WxMpGuideTagInfo> guideTagOption = this.wxService.getGuideTagService().getGuideTagOption();
assertThat(guideTagOption).isNotNull();
}
@Test
public void testAddGuideBuyerTag() throws WxErrorException {
List<String> list = new ArrayList<>();
list.add("oqlk8v0uTJgRnn5eEskNruD4-bc8");
list.add("oqlk8vybPMWapMwOfFTFVYqWpGM0");
List<WxMpGuideBuyerResp> 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<String> guideBuyerTag = this.wxService.getGuideTagService().getGuideBuyerTag(ACCOUNT, null, "oqlk8v0uTJgRnn5eEskNruD4-bc8", true);
assertThat(guideBuyerTag).isNotNull();
}
@Test
public void testQueryGuideBuyerByTag() throws WxErrorException {
List<String> list = new ArrayList<>();
list.add("分类一");
List<String> list1 = this.wxService.getGuideTagService().queryGuideBuyerByTag(ACCOUNT, null, 0, list);
assertThat(list1).isNotNull();
}
@Test
public void testdelGuideBuyerTag() throws WxErrorException {
List<String> list = new ArrayList<>();
list.add("oqlk8v0uTJgRnn5eEskNruD4-bc8");
list.add("oqlk8vybPMWapMwOfFTFVYqWpGM0");
List<WxMpGuideBuyerResp> 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<String> 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<String> list = this.wxService.getGuideTagService().getGuideBuyerDisplayTag(ACCOUNT, null, "oqlk8v0uTJgRnn5eEskNruD4-bc8");
assertThat(list).isNotNull();
}
}