mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-03-10 00:13:40 +08:00
🆕 #2113 【公众号】增加对话能力(原导购)相关接口
This commit is contained in:
@@ -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或者unionid(guide_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或者unionid(guide_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或者unionid(guide_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或者unionid(guide_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或者unionid(guide_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或者unionid(old_guide_openid和new_guide_openid配套使用)
|
||||
* @param account 新顾问微信号(new_guide_account和new_guide_openid二选一)
|
||||
* @param openid 新顾问openid或者unionid(new_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或者unionid(old_guide_openid和new_guide_openid配套使用)
|
||||
* @param account 新顾问微信号(new_guide_account和new_guide_openid二选一)
|
||||
* @param openid 新顾问openid或者unionid(new_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或者unionid(guide_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或者unionid(guide_account和guide_openid二选一)
|
||||
* @param userOpenid 客户openid
|
||||
* @return 客户信息
|
||||
* @throws WxErrorException .
|
||||
*/
|
||||
WxMpGuideBuyerInfo getGuideBuyerRelation(String account, String openid, String userOpenid) throws WxErrorException;
|
||||
}
|
||||
@@ -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或者unionid(guide_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或者unionid(guide_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;
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
@@ -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或者unionid(guide_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或者unionid(guide_account和guide_openid二选一)
|
||||
* @param clientOpenid 客户openid 若不填,则拉取该顾问所有客户的聊天记录。若填写,则拉取顾问与某一个客户的聊天记录
|
||||
* @param beginTime 消息的起始UNIX时间戳,如果不填,默认当前时间的前30天(仅支持30天范围内的查询)
|
||||
* @param endTime 消息的截止UNIX时间戳,如果不填,默认当前时间。
|
||||
* @param page 分页页数,从0开始
|
||||
* @param num 每页数量
|
||||
* @return 顾问聊天记录列表
|
||||
*/
|
||||
WxMpGuideMsgList getGuideChatRecord(String account, String openid, String clientOpenid, Long beginTime, Long endTime, int page, int num) throws WxErrorException;
|
||||
|
||||
/**
|
||||
* 设置快捷回复与关注自动回复
|
||||
* <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或者unionid(guide_account和guide_openid二选一)
|
||||
* @param isDelete 操作类型,false表示添加 true表示删除
|
||||
* @param guideFastReplyList 快捷回复列表
|
||||
* @param guideAutoReply 第一条新客户关注自动回复
|
||||
* @param guideAutoReplyPlus 第二条新客户关注自动回复
|
||||
* @throws WxErrorException .
|
||||
*/
|
||||
void setGuideConfig(String account, String openid, boolean isDelete, List<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或者unionid(guide_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;
|
||||
}
|
||||
|
||||
@@ -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或者unionid(guide_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或者unionid(guide_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或者unionid(guide_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或者unionid(guide_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或者unionid(guide_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或者unionid(guide_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或者unionid(guide_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或者unionid(guide_account和guide_openid二选一)
|
||||
* @param userOpenid 用户openid
|
||||
* @return 自定义客户信息列表
|
||||
* @throws WxErrorException 。
|
||||
*/
|
||||
List<String> getGuideBuyerDisplayTag(String account, String openid, String userOpenid) throws WxErrorException;
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)));
|
||||
}
|
||||
}
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user