🆕 #3279【小程序】新增小程序推广员相关接口

This commit is contained in:
zhuangzibin 2024-05-20 15:38:31 +08:00 committed by GitHub
parent 974ecf2797
commit dd6452dfdc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
34 changed files with 2632 additions and 2 deletions

View File

@ -0,0 +1,125 @@
package cn.binarywang.wx.miniapp.api;
import cn.binarywang.wx.miniapp.bean.promoter.request.*;
import cn.binarywang.wx.miniapp.bean.promoter.response.*;
import me.chanjar.weixin.common.error.WxErrorException;
/**
* 小程序推广员
*
* @author zhuangzibin
*/
public interface WxMaPromotionService {
/**
* 管理角色接口-新增角色
*
* @param request 请求参数
* @return WxMaPromotionAddRoleResponse
*/
WxMaPromotionAddRoleResponse addRole(WxMaPromotionAddRoleRequest request) throws WxErrorException;
/**
* 管理角色接口-查询角色
*
* @param request 请求参数
* @return WxMaPromotionGetRoleResponse
*/
WxMaPromotionGetRoleResponse getRole(WxMaPromotionGetRoleRequest request) throws WxErrorException;
/**
* 管理角色接口-修改角色
*
* @param request 请求参数
* @return WxMaPromotionUpdateRoleResponse
*/
WxMaPromotionUpdateRoleResponse updateRole(WxMaPromoterUpdateRoleRequest request) throws WxErrorException;
/**
* 管理推广员接口-声明推广员身份
*
* @param request 请求参数
* @return WxMaPromotionAddPromoterResponse
*/
WxMaPromotionAddPromoterResponse addPromoter(WxMaPromotionAddPromoterRequest request) throws WxErrorException;
/**
* 管理推广员接口-查询推广员身份
*
* @param request 请求参数
* @return WxMaPromotionGetPromoterResponse
*/
WxMaPromotionGetPromoterResponse getPromoter(WxMaPromotionGetPromoterRequest request) throws WxErrorException;
/**
* 管理推广员接口-修改推广员身份
*
* @param request 请求参数
* @return WxMaPromotionUpdatePromoterResponse
*/
WxMaPromotionUpdatePromoterResponse updatePromoter(WxMaPromotionUpdatePromoterRequest request) throws WxErrorException;
/**
* 邀请推广员-获取推广员邀请素材
*
* @param request 请求参数
* @return WxMaPromotionGetInvitationMaterialResponse
*/
WxMaPromotionGetInvitationMaterialResponse getInvitationMaterial(WxMaPromotionGetInvitationMaterialRequest request) throws WxErrorException;
/**
* 推广员消息管理接口-群发消息
*
* @param request 请求参数
* @return WxMaPromotionSendMsgResponse
*/
WxMaPromotionSendMsgResponse sendMsg(WxMaPromotionSendMsgRequest request) throws WxErrorException;
/**
* 推广员消息管理接口-单发消息
*
* @param request 请求参数
* @return WxMaPromotionSingleSendMsgResponse
*/
WxMaPromotionSingleSendMsgResponse singleSendMsg(WxMaPromotionSingleSendMsgRequest request) throws WxErrorException;
/**
* 推广员消息管理接口-查询送达结果
*
* @param request 请求参数
* @return WxMaPromotionGetMsgResponse
*/
WxMaPromotionGetMsgResponse getMsg(WxMaPromotionGetMsgRequest request) throws WxErrorException;
/**
* 推广员消息管理接口-分析点击效果
*
* @param request 请求参数
* @return WxMaPromotionGetMsgClickDataResponse
*/
WxMaPromotionGetMsgClickDataResponse getMsgClickData(WxMaPromotionGetMsgClickDataRequest request) throws WxErrorException;
/**
* 推广数据接口-生成推广素材
*
* @param request 请求参数
* @return WxMaPromotionGetShareMaterialResponse
*/
WxMaPromotionGetShareMaterialResponse getShareMaterial(WxMaPromotionGetShareMaterialRequest request) throws WxErrorException;
/**
* 推广数据接口-分析触达效果
*
* @param request 请求参数
* @return WxMaPromotionGetRelationResponse
*/
WxMaPromotionGetRelationResponse getRelation(WxMaPromotionGetRelationRequest request) throws WxErrorException;
/**
* 推广数据接口-查询推广订单
*
* @param request 请求参数
* @return WxMaPromotionGetOrderResponse
*/
WxMaPromotionGetOrderResponse getOrder(WxMaPromotionGetOrderRequest request) throws WxErrorException;
}

View File

@ -547,4 +547,11 @@ public interface WxMaService extends WxService {
*/
WxMaXPayService getWxMaXPayService();
WxMaExpressDeliveryReturnService getWxMaExpressDeliveryReturnService();
/**
* 小程序推广员
*
* @return WxMaPromotionService
*/
WxMaPromotionService getWxMaPromotionService();
}

View File

@ -93,6 +93,7 @@ public abstract class BaseWxMaServiceImpl<H, P> implements WxMaService, RequestH
private final WxMaVodService wxMaVodService = new WxMaVodServiceImpl(this);
private final WxMaXPayService wxMaXPayService = new WxMaXPayServiceImpl(this);
private final WxMaExpressDeliveryReturnService wxMaExpressDeliveryReturnService = new WxMaExpressDeliveryReturnServiceImpl(this);
private final WxMaPromotionService wxMaPromotionService = new WxMaPromotionServiceImpl(this);
private Map<String, WxMaConfig> configMap = new HashMap<>();
private int retrySleepMillis = 1000;
@ -694,4 +695,9 @@ public abstract class BaseWxMaServiceImpl<H, P> implements WxMaService, RequestH
public WxMaExpressDeliveryReturnService getWxMaExpressDeliveryReturnService() {
return this.wxMaExpressDeliveryReturnService;
}
@Override
public WxMaPromotionService getWxMaPromotionService() {
return this.wxMaPromotionService;
}
}

View File

@ -0,0 +1,196 @@
package cn.binarywang.wx.miniapp.api.impl;
import cn.binarywang.wx.miniapp.api.WxMaPromotionService;
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.bean.promoter.request.*;
import cn.binarywang.wx.miniapp.bean.promoter.response.*;
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
import com.google.gson.JsonObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
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.util.json.GsonParser;
import static cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants.Promotion.*;
import static me.chanjar.weixin.common.api.WxConsts.ERR_CODE;
/**
* @author zhuangzibin
*/
@RequiredArgsConstructor
@Slf4j
public class WxMaPromotionServiceImpl implements WxMaPromotionService {
private final WxMaService wxMaService;
private final static Integer ERR_CODE_OF_EMPTY_LIST = 103006;
@Override
public WxMaPromotionAddRoleResponse addRole(WxMaPromotionAddRoleRequest request) throws WxErrorException {
String responseContent = this.wxMaService.post(PROMOTION_ADD_ROLE, request);
JsonObject jsonObject = GsonParser.parse(responseContent);
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
}
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaPromotionAddRoleResponse.class);
}
@Override
public WxMaPromotionGetRoleResponse getRole(WxMaPromotionGetRoleRequest request) throws WxErrorException {
String responseContent = this.wxMaService.post(PROMOTION_GET_ROLE, request);
JsonObject jsonObject = GsonParser.parse(responseContent);
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
}
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaPromotionGetRoleResponse.class);
}
@Override
public WxMaPromotionUpdateRoleResponse updateRole(WxMaPromoterUpdateRoleRequest request) throws WxErrorException {
String responseContent = this.wxMaService.post(PROMOTION_UPDATE_ROLE, request);
JsonObject jsonObject = GsonParser.parse(responseContent);
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
}
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaPromotionUpdateRoleResponse.class);
}
@Override
public WxMaPromotionAddPromoterResponse addPromoter(WxMaPromotionAddPromoterRequest request) throws WxErrorException {
String responseContent = this.wxMaService.post(PROMOTION_ADD_PROMOTER, request);
JsonObject jsonObject = GsonParser.parse(responseContent);
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
}
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaPromotionAddPromoterResponse.class);
}
@Override
public WxMaPromotionGetPromoterResponse getPromoter(WxMaPromotionGetPromoterRequest request) throws WxErrorException {
String responseContent = this.wxMaService.post(PROMOTION_GET_PROMOTER, request);
JsonObject jsonObject = GsonParser.parse(responseContent);
if (jsonObject.get(ERR_CODE).getAsInt() != 0 || jsonObject.get(ERR_CODE).getAsInt() != ERR_CODE_OF_EMPTY_LIST) {
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
}
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaPromotionGetPromoterResponse.class);
}
@Override
public WxMaPromotionUpdatePromoterResponse updatePromoter(WxMaPromotionUpdatePromoterRequest request) throws WxErrorException {
String responseContent = this.wxMaService.post(PROMOTION_UPDATE_PROMOTER, request);
JsonObject jsonObject = GsonParser.parse(responseContent);
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
}
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaPromotionUpdatePromoterResponse.class);
}
@Override
public WxMaPromotionGetInvitationMaterialResponse getInvitationMaterial(WxMaPromotionGetInvitationMaterialRequest request) throws WxErrorException {
String responseContent = this.wxMaService.post(PROMOTION_GET_INVITATION_MATERIAL, request);
JsonObject jsonObject = GsonParser.parse(responseContent);
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
}
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaPromotionGetInvitationMaterialResponse.class);
}
@Override
public WxMaPromotionSendMsgResponse sendMsg(WxMaPromotionSendMsgRequest request) throws WxErrorException {
String responseContent = this.wxMaService.post(PROMOTION_SEND_MSG, request);
JsonObject jsonObject = GsonParser.parse(responseContent);
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
}
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaPromotionSendMsgResponse.class);
}
@Override
public WxMaPromotionSingleSendMsgResponse singleSendMsg(WxMaPromotionSingleSendMsgRequest request) throws WxErrorException {
String responseContent = this.wxMaService.post(PROMOTION_SINGLE_SEND_MSG, request);
JsonObject jsonObject = GsonParser.parse(responseContent);
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
}
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaPromotionSingleSendMsgResponse.class);
}
@Override
public WxMaPromotionGetMsgResponse getMsg(WxMaPromotionGetMsgRequest request) throws WxErrorException {
String responseContent = this.wxMaService.post(PROMOTION_GET_MSG, request);
JsonObject jsonObject = GsonParser.parse(responseContent);
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
}
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaPromotionGetMsgResponse.class);
}
@Override
public WxMaPromotionGetMsgClickDataResponse getMsgClickData(WxMaPromotionGetMsgClickDataRequest request) throws WxErrorException {
String responseContent = this.wxMaService.post(PROMOTION_GET_MSG_CLICK_DATA, request);
JsonObject jsonObject = GsonParser.parse(responseContent);
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
}
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaPromotionGetMsgClickDataResponse.class);
}
@Override
public WxMaPromotionGetShareMaterialResponse getShareMaterial(WxMaPromotionGetShareMaterialRequest request) throws WxErrorException {
String responseContent = this.wxMaService.post(PROMOTION_GET_SHARE_MATERIAL, request);
JsonObject jsonObject = GsonParser.parse(responseContent);
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
}
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaPromotionGetShareMaterialResponse.class);
}
@Override
public WxMaPromotionGetRelationResponse getRelation(WxMaPromotionGetRelationRequest request) throws WxErrorException {
String responseContent = this.wxMaService.post(PROMOTION_GET_RELATION, request);
JsonObject jsonObject = GsonParser.parse(responseContent);
if (jsonObject.get(ERR_CODE).getAsInt() != 0 || jsonObject.get(ERR_CODE).getAsInt() != ERR_CODE_OF_EMPTY_LIST) {
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
}
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaPromotionGetRelationResponse.class);
}
@Override
public WxMaPromotionGetOrderResponse getOrder(WxMaPromotionGetOrderRequest request) throws WxErrorException {
String responseContent = this.wxMaService.post(PROMOTION_GET_ORDER, request);
JsonObject jsonObject = GsonParser.parse(responseContent);
if (jsonObject.get(ERR_CODE).getAsInt() != 0 || jsonObject.get(ERR_CODE).getAsInt() != ERR_CODE_OF_EMPTY_LIST) {
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MiniApp));
}
return WxMaGsonBuilder.create().fromJson(responseContent, WxMaPromotionGetOrderResponse.class);
}
}

View File

@ -0,0 +1,50 @@
package cn.binarywang.wx.miniapp.bean.promoter.request;
import com.google.gson.annotations.SerializedName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author zhuangzibin
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class WxMaPromoterUpdateRoleRequest implements Serializable {
private static final long serialVersionUID = -3498323828391890607L;
/*
{
"role_id": 1,
"name": "xxxxx",
"desc": "xxxxx"
}
*/
/**
* 角色id
* 必填
*/
@SerializedName("role_id")
private Long roleId;
/**
* 角色名称长度不能超过50个字符
* name和desc二者必填其一
*/
@SerializedName("name")
private String name;
/**
* 角色描述长度不能超过200个字符
* name和desc二者必填其一
*/
@SerializedName("desc")
private String desc;
}

View File

@ -0,0 +1,95 @@
package cn.binarywang.wx.miniapp.bean.promoter.request;
import com.google.gson.annotations.SerializedName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
/**
* @author zhuangzibin
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class WxMaPromotionAddPromoterRequest implements Serializable {
private static final long serialVersionUID = 589547859656958069L;
/*
{
"promoter_list":
[
{
"openid": "xxxxx",
"role_id": 1,
"retail_id": "xxxxx",
"extra_info": "xxxxx",
"name": "xxxxx",
"phone": "xxxxx"
},
{
"openid": "xxxxx",
"role_id": 1,
"retail_id": "xxxxx",
"extra_info": "xxxxx",
"name": "xxxxx",
"phone": "xxxxx"
}
]
}
*/
@SerializedName("promoter_list")
private List<Promoter> promoterList;
@Data
@Builder
public static class Promoter {
/**
* 推广员的openid或unionid
* 必填
*/
@SerializedName("openid")
private String openid;
/**
* 角色idrole_id需调查询角色接口查询
* 必填
*/
@SerializedName("role_id")
private Long roleId;
/**
* 门店id长度不能超过20个字符
* 非必填
*/
@SerializedName("retail_id")
private String retailId;
/**
* 推广员参数用于自定义标识推广员长度不能超过80个字符
* 非必填
*/
@SerializedName("extra_info")
private String extraInfo;
/**
* 推广员名称长度不能超过30个字符
* 非必填
*/
@SerializedName("name")
private String name;
/**
* 推广员手机号长度不能超过20个字符
* 非必填
*/
@SerializedName("phone")
private String phone;
}
}

View File

@ -0,0 +1,42 @@
package cn.binarywang.wx.miniapp.bean.promoter.request;
import com.google.gson.annotations.SerializedName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author zhuangzibin
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class WxMaPromotionAddRoleRequest implements Serializable {
private static final long serialVersionUID = -2802788361978629822L;
/*
{
"name": "xxxxx",
"desc": "xxxxx"
}
*/
/**
* 角色名称长度不能超过50个字符
* 必填
*/
@SerializedName("name")
private String name;
/**
* 角色描述长度不能超过200个字符
* 非必填
*/
@SerializedName("desc")
private String desc;
}

View File

@ -0,0 +1,42 @@
package cn.binarywang.wx.miniapp.bean.promoter.request;
import com.google.gson.annotations.SerializedName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author zhuangzibin
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class WxMaPromotionGetInvitationMaterialRequest implements Serializable {
private static final long serialVersionUID = 3579475611446461635L;
/*
{
"role_id": 1,
"invitation_type": 0
}
*/
/**
* 角色idrole_id需调查询角色接口查询
* 必填
*/
@SerializedName("role_id")
private Long roleId;
/**
* 0海报 1小程序码 2短链默认返回海报
* 非必填
*/
@SerializedName("invitation_type")
private Long invitationType;
}

View File

@ -0,0 +1,79 @@
package cn.binarywang.wx.miniapp.bean.promoter.request;
import com.google.gson.annotations.SerializedName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author zhuangzibin
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class WxMaPromotionGetMsgClickDataRequest implements Serializable {
private static final long serialVersionUID = 3981311999296086650L;
/*
{
"send_date" : "2023-08-04",
"dimonsion" : 0,
"msg_type" : 1,
"begin_send_time" : 1691114400,
"end_send_time" : 1691128800
}
{
"send_date" : "2023-08-04",
"dimonsion" : 1,
"msg_type" : 1
}
*/
/**
* 消息发送日期格式为yyyy-MM-dd
* 必填
*/
@SerializedName("send_date")
private String sendDate;
/**
* 消息点击数据统计维度0按消息id统计群发数小于50没有数据1按消息类型统计
* 必填
*/
@SerializedName("dimonsion")
private Long dimonsion;
/**
* 消息类型枚举值参考小程序推广员消息模板汇总
* 必填
*/
@SerializedName("msg_type")
private Integer msgType;
/**
* 消息类型枚举值参考小程序推广员消息模板汇总
* 必填
*/
@SerializedName("msg_id")
private String msgId;
/**
* 消息发送开始时间戳必须属于send_date所在自然日dimonsion为0时生效
* 非必填
*/
@SerializedName("begin_send_time")
private Long beginSendTime;
/**
* 消息发送结束时间戳必须属于send_date所在自然日dimonsion为0时生效
* 非必填
*/
@SerializedName("end_send_time")
private Long endSendTime;
}

View File

@ -0,0 +1,34 @@
package cn.binarywang.wx.miniapp.bean.promoter.request;
import com.google.gson.annotations.SerializedName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author zhuangzibin
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class WxMaPromotionGetMsgRequest implements Serializable {
private static final long serialVersionUID = -2445469292144155035L;
/*
{
"msg_type" : 1
}
*/
/**
* 消息id发送模板消息接口返回的值
* 必填
*/
@SerializedName("msg_id")
private String msgId;
}

View File

@ -0,0 +1,89 @@
package cn.binarywang.wx.miniapp.bean.promoter.request;
import com.google.gson.annotations.SerializedName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author zhuangzibin
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class WxMaPromotionGetOrderRequest implements Serializable {
private static final long serialVersionUID = 3773454747090805733L;
/*
{
"openid": "xxxxx",
"mch_id": "xxxxx",
"trade_no": "xxxxx",
"out_trade_no": "xxxxx",
"status": 1,
"start_id": "123",
"need_unionid": 1
}
*/
/**
* 推广员的openid或unionid
* 必填
*/
@SerializedName("openid")
private String openid;
/**
* 商户号
* 非必填
*/
@SerializedName("mch_id")
private String mchId;
/**
* 微信支付订单号
* 非必填
*/
@SerializedName("trade_no")
private String tradeNo;
/**
* 商户订单号
* 非必填
*/
@SerializedName("out_trade_no")
private String outTradeNo;
/**
* 订单状态 1支付完成 2退款受理
* 非必填
*/
@SerializedName("status")
private Long status;
/**
* 用于分页时透传单次拉取上限为1000超过1000须分页
* 非必填
*/
@SerializedName("start_id")
private String startId;
/**
* 默认返回openid填1返回unionid
* 非必填
*/
@SerializedName("need_unionid")
private Long needUnionid;
/**
* 订单支付日期格式为yyyyMMdd例如20230801
* 非必填
*/
@SerializedName("date")
private Long date;
}

View File

@ -0,0 +1,99 @@
package cn.binarywang.wx.miniapp.bean.promoter.request;
import com.google.gson.annotations.SerializedName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author zhuangzibin
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class WxMaPromotionGetPromoterRequest implements Serializable {
private static final long serialVersionUID = 5324767626460338896L;
/*
{
"openid": "xxxxx",
"role_id": 1,
"retail_id": "xxxxx",
"begin_time": 1668614400,
"end_time": 1668666429,
"start_id": "123",
"need_unionid": 1,
"auth_status": 1,
"decl_status": 1
}
*/
/**
* 推广员的openid或unionid
* 非必填
*/
@SerializedName("openid")
private String openid;
/**
* 角色id
* 非必填
*/
@SerializedName("role_id")
private Long roleId;
/**
* 门店id长度不能超过20个字符
* 非必填
*/
@SerializedName("retail_id")
private String retailId;
/**
* 推广员授权状态变更开始秒级时间戳
* 非必填
*/
@SerializedName("begin_time")
private Long beginTime;
/**
* 推广员授权状态变更结束秒级时间戳
* 非必填
*/
@SerializedName("end_time")
private Long endTime;
/**
* 用于分页时透传单次拉取上限为2000超过2000须分页
* 非必填
*/
@SerializedName("start_id")
private String startId;
/**
* 默认返回openid填1返回unionid
* 非必填
*/
@SerializedName("need_unionid")
private Long needUnionid;
/**
* 0推广员未授权 1推广员已授权 2推广员取消授权
* 非必填
*/
@SerializedName("auth_status")
private Long authStatus;
/**
* 1商家已声明 2商家取消声明
* 非必填
*/
@SerializedName("decl_status")
private String declStatus;
}

View File

@ -0,0 +1,83 @@
package cn.binarywang.wx.miniapp.bean.promoter.request;
import com.google.gson.annotations.SerializedName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author zhuangzibin
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class WxMaPromotionGetRelationRequest implements Serializable {
private static final long serialVersionUID = 8525361618611598316L;
/*
{
"openid": "xxxxx",
"begin_time": 1668614400,
"end_time": 1668666429,
"scene": 1077,
"path": "pages/xxxxx",
"start_id": "123",
"need_unionid": 1
}
*/
/**
* 推广员的openid或unionid
* 必填
*/
@SerializedName("openid")
private String openid;
/**
* 触达时间开始秒级时间戳
* 非必填
*/
@SerializedName("begin_time")
private Long beginTime;
/**
* 触达时间结束秒级时间戳
* 非必填
*/
@SerializedName("end_time")
private Long endTime;
/**
* 触达场景值枚举值参考场景值列表
* <a href="https://developers.weixin.qq.com/miniprogram/dev/reference/scene-list.html">场景值列表</a>
* 非必填
*/
@SerializedName("scene")
private Long scene;
/**
* 触达path原生分享path里参数可能乱序导致搜不到
* 非必填
*/
@SerializedName("path")
private String path;
/**
* 用于分页时透传单次拉取上限为1000超过1000须分页
* 非必填
*/
@SerializedName("start_id")
private String startId;
/**
* 默认返回openid填1返回unionid
* 非必填
*/
@SerializedName("need_unionid")
private Long needUnionid;
}

View File

@ -0,0 +1,35 @@
package cn.binarywang.wx.miniapp.bean.promoter.request;
import com.google.gson.annotations.SerializedName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author zhuangzibin
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class WxMaPromotionGetRoleRequest implements Serializable {
private static final long serialVersionUID = 3661919584555497735L;
/*
{
"role_id": 1
}
*/
/**
* 角色id
* 非必填
*/
@SerializedName("role_id")
private Long roleId;
}

View File

@ -0,0 +1,74 @@
package cn.binarywang.wx.miniapp.bean.promoter.request;
import com.google.gson.annotations.SerializedName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author zhuangzibin
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class WxMaPromotionGetShareMaterialRequest implements Serializable {
private static final long serialVersionUID = -7420667215630983582L;
/*
{
"path": "xxxxx",
"openid": "xxxxx",
"extra_info": "xxxxx",
"title": "xxxxx",
"share_type": 0,
"env_version": "trial"
}
*/
/**
* 小程序页面path
* 必填
*/
@SerializedName("path")
private String path;
/**
* 推广员的openid或unionid
* 必填
*/
@SerializedName("openid")
private String openid;
/**
* 自定义参数长度不能超过80个字符
* 非必填
*/
@SerializedName("extra_info")
private String extraInfo;
/**
* 页面名称长度不能超过20个字符默认为推广活动页
* 非必填
*/
@SerializedName("title")
private String title;
/**
* 0三种分享素材全返回 1短链 2带参path 3小程序码默认全部返回
* 非必填
*/
@SerializedName("share_type")
private Long shareType;
/**
* 默认正式版develop: 开发版 trial: 体验版仅短链支持跳转开发版/体验版
* 非必填
*/
@SerializedName("env_version")
private String envVersion;
}

View File

@ -0,0 +1,119 @@
package cn.binarywang.wx.miniapp.bean.promoter.request;
import com.google.gson.annotations.SerializedName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.List;
/**
* @author zhuangzibin
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class WxMaPromotionSendMsgRequest implements Serializable {
private static final long serialVersionUID = -5282382905925607758L;
/*
// list_type不传
{
"msg_type" : 1,
"content" : "{\"title\":\"今日优惠活动\",\"topic\":\"双十一大促\",\"desc\":\"三件五折,两件七折\",\"date\":\"2022/10/28\"}",
"appid" : "xxxxx",
"path" : "pages/index/xxxxx"
}
// list_type为1
{
"msg_type" : 1,
"content" : "{\"title\":\"今日优惠活动\",\"topic\":\"双十一大促\",\"desc\":\"三件五折,两件七折\",\"date\":\"2022/10/28\"}",
"appid" : "xxxxx",
"path" : "pages/index/xxxxx",
"list_type" : 1,
"role_id" : [ 1, 2 ]
}
// list_type为2
{
"msg_type" : 1,
"content" : "{\"title\":\"今日优惠活动\",\"topic\":\"双十一大促\",\"desc\":\"三件五折,两件七折\",\"date\":\"2022/10/28\"}",
"appid" : "xxxxx",
"path" : "pages/index/xxxxx",
"list_type" : 2,
"retail_id" : [ "xxxxx", "xxxxx" ]
}
// list_type为3
{
"msg_type" : 1,
"content" : "{\"title\":\"今日优惠活动\",\"topic\":\"双十一大促\",\"desc\":\"三件五折,两件七折\",\"date\":\"2022/10/28\"}",
"appid" : "xxxxx",
"path" : "pages/index/xxxxx",
"list_type" : 3,
"id" : [ "1", "2" ]
}
*/
/**
* 消息类型枚举值参考小程序推广员消息模板汇总
* <a href="https://docs.qq.com/sheet/DZUVkUFZ6VVhDalZi?tab=BB08J2">小程序推广员消息模板汇总</a>
* 必填
*/
@SerializedName("msg_type")
private Integer msgType;
/**
* 消息内容为json格式的字符串不同类型对应的字符串示例见模板列表
* 必填
*/
@SerializedName("content")
private String content;
/**
* 消息体跳转appid需与调用接口的appid在同OPEN账号下不填默认为调起接口的appid
* 非必填
*/
@SerializedName("appid")
private String appid;
/**
* 消息体跳转path确保path无误否则会报页面不存在
* 必填
*/
@SerializedName("path")
private String path;
/**
* 1发送给所填role_id下的所有推广员2发送给所填retail_id下的所有推广员3发送给所填id对应的推广员0或不填则发送给全部推广员请保证所填参数的正确性错误的参数不会发送
* 非必填
*/
@SerializedName("list_type")
private Long listType;
/**
* list_type为1时必填取值可以参考查询推广员身份api返回的结果
* 非必填
*/
@SerializedName("role_id")
private List<Long> roleId;
/**
* list_type为2时必填取值可以参考查询推广员身份api返回的结果
* 非必填
*/
@SerializedName("retail_id")
private List<String> retailId;
/**
* list_type为3时必填取值可以参考查询推广员身份api返回的结果
* 非必填
*/
@SerializedName("id")
private List<String> id;
}

View File

@ -0,0 +1,75 @@
package cn.binarywang.wx.miniapp.bean.promoter.request;
import com.google.gson.annotations.SerializedName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author zhuangzibin
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class WxMaPromotionSingleSendMsgRequest implements Serializable {
private static final long serialVersionUID = 3552361351502585916L;
/*
{
"msg_type" : 1,
"content" : "{\"title\":\"今日优惠活动\",\"topic\":\"双十一大促\",\"desc\":\"三件五折,两件七折\",\"date\":\"2022/10/28\"}",
"appid" : "xxxxx",
"path" : "pages/index/xxxxx",
"id" : "1"
}
{
"msg_type" : 1,
"content" : "{\"title\":\"今日优惠活动\",\"topic\":\"双十一大促\",\"desc\":\"三件五折,两件七折\",\"date\":\"2022/10/28\"}",
"appid" : "xxxxx",
"path" : "pages/index/xxxxx",
"openid" : "xxxxxxxxxxxx"
}
*/
/**
* 消息类型枚举值参考小程序推广员消息模板汇总
* <a href="https://docs.qq.com/sheet/DZUVkUFZ6VVhDalZi?tab=BB08J2">小程序推广员消息模板汇总</a>
* 必填
*/
@SerializedName("msg_type")
private Integer msgType;
/**
* 消息内容为json格式的字符串不同类型对应的字符串示例见模板列表
* 必填
*/
@SerializedName("content")
private String content;
/**
* 消息体跳转appid需与调用接口的appid在同OPEN账号下不填默认为调起接口的appid
* 非必填
*/
@SerializedName("appid")
private String appid;
/**
* 消息体跳转path确保path无误否则会报页面不存在
* 必填
*/
@SerializedName("path")
private String path;
/**
* 推广员openid或unionid
* 非必填
*/
@SerializedName("openid")
private String openid;
}

View File

@ -0,0 +1,82 @@
package cn.binarywang.wx.miniapp.bean.promoter.request;
import com.google.gson.annotations.SerializedName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author zhuangzibin
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class WxMaPromotionUpdatePromoterRequest implements Serializable {
private static final long serialVersionUID = 613641392778175502L;
/*
{
"id": "123",
"role_id": 1,
"retail_id": "xxxxx",
"extra_info": "xxxxx",
"decl_status": 2,
"name": "xxxxx",
"phone": "139xxxxxxxx"
}
*/
/**
* 推广员的唯一id
* 必填
*/
@SerializedName("id")
private String id;
/**
* 角色id
* 非必填
*/
@SerializedName("role_id")
private Long roleId;
/**
* 门店id长度不能超过20个字符
* 非必填
*/
@SerializedName("retail_id")
private String retailId;
/**
* 推广员参数用于自定义标识推广员长度不能超过80个字符
* 非必填
*/
@SerializedName("extra_info")
private String extraInfo;
/**
* 推广员名称长度不能超过30个字符
* 非必填
*/
@SerializedName("name")
private String name;
/**
* 推广员手机号长度不能超过20个字符
* 非必填
*/
@SerializedName("phone")
private String phone;
/**
* 1商家已声明 2商家取消声明
* 非必填
*/
@SerializedName("decl_status")
private String declStatus;
}

View File

@ -0,0 +1,119 @@
package cn.binarywang.wx.miniapp.bean.promoter.response;
import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse;
import com.google.gson.annotations.SerializedName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.List;
/**
* @author zhuangzibin
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class WxMaPromotionAddPromoterResponse extends WxMaBaseResponse implements Serializable {
private static final long serialVersionUID = -6310277945996005821L;
/*
{
"total_cnt": 200,
"fail_cnt": 2,
"fail_list":
[
{
"openid": "xxxxx",
"role_id": 1,
"retail_id": "xxxxx",
"extra_info": "xxxxx",
"name": "xxxxx",
"phone": "xxxxx"
},
{
"openid": "xxxxx",
"role_id": 1,
"retail_id": "xxxxx",
"extra_info": "xxxxx",
"name": "xxxxx",
"phone": "xxxxx",
"errcode": 103003,
"errmsg": "data already exists"
}
],
"errcode": 0,
"errmsg": "OK"
}
*/
/**
* 声明推广员总数
*/
@SerializedName("total_cnt")
private Long totalCnt;
/**
* 声明推广员失败数
*/
@SerializedName("fail_cnt")
private Long failCnt;
/**
* 生命推广员失败列表
* 非必填
*/
@SerializedName("fail_list")
private List<Promoter> failList;
@Data
public static class Promoter {
/**
* 声明失败推广员的openid
*/
@SerializedName("openid")
private String openid;
/**
* 角色id
*/
@SerializedName("role_id")
private Long roleId;
/**
* 门店id
*/
@SerializedName("retail_id")
private String retailId;
/**
* 推广员参数
*/
@SerializedName("extra_info")
private String extraInfo;
/**
* 推广员名称
*/
@SerializedName("name")
private String name;
/**
* 推广员手机号
*/
@SerializedName("phone")
private String phone;
/**
* 错误码
*/
@SerializedName("errcode")
private Integer errcode;
/**
* 错误信息
*/
@SerializedName("errmsg")
private String errmsg;
}
}

View File

@ -0,0 +1,37 @@
package cn.binarywang.wx.miniapp.bean.promoter.response;
import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse;
import com.google.gson.annotations.SerializedName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
/**
* @author zhuangzibin
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class WxMaPromotionAddRoleResponse extends WxMaBaseResponse implements Serializable {
private static final long serialVersionUID = 5030950505158018112L;
/**
* 角色Id
*/
@SerializedName("role_id")
private Long roleId;
/**
* 角色名称
*/
@SerializedName("name")
private String name;
/**
* 角色描述
*/
@SerializedName("desc")
private String desc;
}

View File

@ -0,0 +1,48 @@
package cn.binarywang.wx.miniapp.bean.promoter.response;
import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse;
import com.google.gson.annotations.SerializedName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
/**
* @author zhuangzibin
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class WxMaPromotionGetInvitationMaterialResponse extends WxMaBaseResponse implements Serializable {
private static final long serialVersionUID = 7833175570601030853L;
/*
{
"poster": "xxxxx",
"qrcode": "xxxxx",
"tag": "xxxxx",
"errcode": 0,
"errmsg": "OK"
}
*/
/**
* 海报图片base64
*/
@SerializedName("poster")
private String poster;
/**
* 小程序码图片base64
*/
@SerializedName("qrcode")
private String qrcode;
/**
* 短链
*/
@SerializedName("tag")
private String tag;
}

View File

@ -0,0 +1,88 @@
package cn.binarywang.wx.miniapp.bean.promoter.response;
import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse;
import com.google.gson.annotations.SerializedName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.List;
/**
* @author zhuangzibin
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class WxMaPromotionGetMsgClickDataResponse extends WxMaBaseResponse implements Serializable {
private static final long serialVersionUID = -4985995863552139208L;
/*
dimonsion为0时返回
{
"data_list" : [
{
"msg_id" : "123456",
"send_time" : 1691114400,
"click_uv" : 123,
"click_pv" : 200
}
],
"errcode": 0,
"errmsg": "OK"
}
dimonsion为1时返回
{
"data_list" : [
{
"msg_type" : 1,
"click_uv" : 123,
"click_pv" : 200
}
],
"errcode": 0,
"errmsg": "OK"
}
*/
/**
* 数据数组
* 非必填
*/
@SerializedName("data_list")
private List<Dimonsion> dataList;
@Data
public static class Dimonsion {
/**
* 消息点击人数
*/
@SerializedName("click_uv")
private Long clickUv;
/**
* 消息点击次数
*/
@SerializedName("click_pv")
private Long clickPv;
/**
* 消息类型枚举值参考小程序推广员消息模板汇总
*/
@SerializedName("msg_type")
private Long msgType;
/**
* 消息id发送模板消息接口返回的值
*/
@SerializedName("msg_id")
private String msgId;
/**
* 消息发送时间
*/
@SerializedName("send_time")
private Long sendTime;
}
}

View File

@ -0,0 +1,136 @@
package cn.binarywang.wx.miniapp.bean.promoter.response;
import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse;
import com.google.gson.annotations.SerializedName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.List;
/**
* @author zhuangzibin
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class WxMaPromotionGetMsgResponse extends WxMaBaseResponse implements Serializable {
private static final long serialVersionUID = -7807426027724675223L;
/*
{
"send_cnt" : 2,
"fail_cnt" : 1,
"fail_info" : [
{
"id" : "123",
"errcode" : 103010
}
],
"fail_openid_url" : "https://xxxxxxxxxx",
"msg_type" : 1,
"content" : "{\"title\":\"今日优惠活动\",\"topic\":\"双十一大促\",\"desc\":\"三件五折,两件七折\",\"date\":\"2022/10/28\"}",
"appid" : "xxxxx",
"path" : "pages/index/xxxxx",
"list_type" : 1,
"role_id" : [ 1, 2 ],
"errcode": 0,
"errmsg": "OK"
}
*/
/**
* 发送总数
*/
@SerializedName("send_cnt")
private Long sendCnt;
/**
* 当前已发送比例
*/
@SerializedName("percent")
private Long percent;
/**
* 失败总数在全部发送完后更新发送进度参考percent
*/
@SerializedName("fail_cnt")
private Long failCnt;
/**
* 包含推广员唯一id和失败错误码失败数量超过一千会生成文件不会返回明细
* 非必填
*/
@SerializedName("fail_info")
private List<FailInfo> failInfo;
/**
* fail_info文件url
*/
@SerializedName("fail_info_url")
private String failInfoUrl;
/**
* 消息类型枚举值参考小程序推广员消息模板汇总
*/
@SerializedName("msg_type")
private Long msgType;
/**
* 消息内容为json格式的字符串不同类型对应的字符串示例见模板列表
*/
@SerializedName("content")
private String content;
/**
* 消息体跳转appid不填默认为调起接口的appid
*/
@SerializedName("appid")
private String appId;
/**
* 消息体跳转path
*/
@SerializedName("path")
private String path;
/**
* 下发类型0全量下发1按role_id下发2按retail_id下发3按推广员id下发
*/
@SerializedName("list_type")
private Long listType;
/**
* list_type为1有值
*/
@SerializedName("role_id")
private List<Long> roleId;
/**
* list_type为2有值
*/
@SerializedName("retail_id")
private List<String> retailId;
/**
* list_type为3有值
*/
@SerializedName("id")
private List<String> id;
@Data
public static class FailInfo {
/**
* id
*/
@SerializedName("id")
private String id;
/**
* 失败错误码
*/
@SerializedName("errorcode")
private Long errorcode;
}
}

View File

@ -0,0 +1,186 @@
package cn.binarywang.wx.miniapp.bean.promoter.response;
import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse;
import com.google.gson.annotations.SerializedName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.List;
/**
* @author zhuangzibin
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class WxMaPromotionGetOrderResponse extends WxMaBaseResponse implements Serializable {
private static final long serialVersionUID = 7815334184208585836L;
/*
{
"order_list":
[
{
"promoter_openid": "xxxxx",
"role_id": 1,
"retail_id": "xxxxx",
"extra_info": "xxxxx",
"openid": "xxxxx",
"create_time": 1668667349,
"path": "pages/xxxxx",
"scene": 1077,
"share_extra_info": "xxxxx",
"mch_id": "xxxxx",
"trade_no": "xxxxx",
"out_trade_no": "xxxxx",
"status": 1,
"paid_amount": 150,
"paid_time": 1668667360
},
{
"promoter_openid": "xxxxx",
"role_id": 1,
"retail_id": "xxxxx",
"extra_info": "xxxxx",
"openid": "xxxxx",
"create_time": 1668667349,
"path": "pages/xxxxx",
"scene": 1077,
"share_extra_info": "xxxxx",
"mch_id": "xxxxx",
"trade_no": "xxxxx",
"out_trade_no": "xxxxx",
"status": 2,
"paid_amount": 150,
"paid_time": 1668667360,
"paid_time": 1668668000
}
],
"total_cnt": 2,
"start_id": "2",
"errcode": 0,
"errmsg": "OK"
}
*/
/**
* 拉取的推广员总数
*/
@SerializedName("order_list")
private List<Order> orderList;
/**
* 拉取的推广员总数
*/
@SerializedName("total_cnt")
private Long totalCnt;
/**
* 用于分页时透传
*/
@SerializedName("start_id")
private Long startId;
@Data
public static class Order {
/**
* 推广员的openid或unionid
*/
@SerializedName("promoter_openid")
private String promoterOpenid;
/**
* 角色id
*/
@SerializedName("role_id")
private Long roleId;
/**
* 门店id
*/
@SerializedName("retail_id")
private String retailId;
/**
* 推广员参数
*/
@SerializedName("extra_info")
private String extraInfo;
/**
* 付款用户的openid或unionid
*/
@SerializedName("openid")
private String openid;
/**
* 触达时间秒级时间戳
*/
@SerializedName("create_time")
private Long createTime;
/**
* 触达path
*/
@SerializedName("path")
private String path;
/**
* 触达场景值枚举值参考场景值列表
* <a href="https://developers.weixin.qq.com/miniprogram/dev/reference/scene-list.html">场景值列表</a>
*/
@SerializedName("scene")
private Long scene;
/**
* 生成分享素材时的自定义参数
*/
@SerializedName("share_extra_info")
private String shareExtraInfo;
/**
* 商户号
*/
@SerializedName("mch_id")
private String mchId;
/**
* 微信支付订单号
*/
@SerializedName("trade_no")
private String tradeNo;
/**
* 商户订单号
*/
@SerializedName("out_trade_no")
private String outTradeNo;
/**
* 订单状态 1支付完成 2退款受理
*/
@SerializedName("status")
private Long status;
/**
* 用户支付金额单位为分
*/
@SerializedName("paid_amount")
private Long paidAmount;
/**
* 支付完成时间
*/
@SerializedName("paid_time")
private Long paidTime;
/**
* 退款创建时间
*/
@SerializedName("refunded_time")
private Long refundedTime;
}
}

View File

@ -0,0 +1,132 @@
package cn.binarywang.wx.miniapp.bean.promoter.response;
import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse;
import com.google.gson.annotations.SerializedName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.List;
/**
* @author zhuangzibin
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class WxMaPromotionGetPromoterResponse extends WxMaBaseResponse implements Serializable {
private static final long serialVersionUID = -2443311045690767883L;
/*
{
"promoter_list":
[
{
"openid": "xxxxx",
"role_id": 1,
"retail_id": "xxxxx",
"extra_info": "xxxxx",
"auth_status": 1,
"decl_status": 1,
"update_time": 1668667349,
"id": "100",
"name": "xxxxx",
"phone": "xxxxx"
},
{
"openid": "xxxxx",
"role_id": 1,
"retail_id": "xxxxx",
"extra_info": "xxxxx",
"auth_status": 1,
"decl_status": 1,
"update_time": 1668667349,
"id": "123",
"name": "xxxxx",
"phone": "xxxxx"
}
],
"total_cnt": 2,
"errcode": 0,
"errmsg": "OK"
}
*/
/**
* 推广员的openid或unionid
* 必填
*/
@SerializedName("total_cnt")
private String total_cnt;
/**
* 门店id长度不能超过20个字符
* 非必填
*/
@SerializedName("promoter_list")
private List<Promoter> promoterList;
@Data
public static class Promoter {
/**
* 推广员的openid或unionid
*/
@SerializedName("openid")
private String openid;
/**
* 角色id
*/
@SerializedName("role_id")
private Long roleId;
/**
* 门店id
*/
@SerializedName("retail_id")
private String retailId;
/**
* 推广员参数
*/
@SerializedName("extra_info")
private String extraInfo;
/**
* 推广员名称
*/
@SerializedName("name")
private String name;
/**
* 推广员手机号
*/
@SerializedName("phone")
private String phone;
/**
* 0推广员未授权 1推广员已授权 2推广员取消授权
*/
@SerializedName("auth_status")
private Long authStatus;
/**
* 1商家已声明 2商家取消声明
*/
@SerializedName("decl_status")
private String declStatus;
/**
* 推广员授权状态变更秒级时间戳
*/
@SerializedName("update_time")
private Long updateTime;
/**
* 唯一id分页和更新时回传
*/
@SerializedName("id")
private String id;
}
}

View File

@ -0,0 +1,131 @@
package cn.binarywang.wx.miniapp.bean.promoter.response;
import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse;
import com.google.gson.annotations.SerializedName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.List;
/**
* @author zhuangzibin
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class WxMaPromotionGetRelationResponse extends WxMaBaseResponse implements Serializable {
private static final long serialVersionUID = 8507306550498671699L;
/*
{
"relation_list":
[
{
"promoter_openid": "xxxxx",
"role_id": 1,
"retail_id": "xxxxx",
"extra_info": "xxxxx",
"openid": "xxxxx",
"create_time": 1668667349,
"path": "pages/xxxxx",
"scene": 1077,
"share_extra_info": "xxxxx"
},
{
"promoter_openid": "xxxxx",
"role_id": 1,
"retail_id": "xxxxx",
"extra_info": "xxxxx",
"openid": "xxxxx",
"create_time": 1668667349,
"path": "pages/xxxxx",
"scene": 1077,
"share_extra_info": "xxxxx"
}
],
"total_cnt": 2,
"start_id": "2",
"errcode": 0,
"errmsg": "OK"
}
*/
/**
* 数据数组
*/
@SerializedName("relation_list")
private List<Relation> relationList;
/**
* 拉取的推广员总数
*/
@SerializedName("total_cnt")
private Long totalCnt;
/**
* 用于分页时透传
*/
@SerializedName("start_id")
private String startId;
@Data
public static class Relation {
/**
* 推广员的openid或unionid
*/
@SerializedName("promoter_openid")
private String promoterOpenid;
/**
* 角色id
*/
@SerializedName("role_id")
private Long roleId;
/**
* 门店id
*/
@SerializedName("retail_id")
private String retailId;
/**
* 推广员参数
*/
@SerializedName("extra_info")
private String extraInfo;
/**
* 触达后访问小程序的用户openid或unionid
*/
@SerializedName("openid")
private String openid;
/**
* 触达时间秒级时间戳
*/
@SerializedName("create_time")
private Long createTime;
/**
* 触达path
*/
@SerializedName("path")
private String path;
/**
* 触达场景值枚举值参考场景值列表
* <a href="https://developers.weixin.qq.com/miniprogram/dev/reference/scene-list.html">场景值列表</a>
* 非必填
*/
@SerializedName("scene")
private Long scene;
/**
* 生成分享素材时的自定义参数
*/
@SerializedName("share_extra_info")
private String shareExtraInfo;
}
}

View File

@ -0,0 +1,54 @@
package cn.binarywang.wx.miniapp.bean.promoter.response;
import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse;
import com.google.gson.annotations.SerializedName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.util.List;
/**
* @author zhuangzibin
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class WxMaPromotionGetRoleResponse extends WxMaBaseResponse implements Serializable {
private static final long serialVersionUID = 5030950505158018112L;
/**
* 角色集合
*/
@SerializedName("role_list")
private List<Role> roleList;
/**
* 角色总数
*/
@SerializedName("total_cnt")
private Integer totalCnt;
@Data
public static class Role {
/**
* 角色Id
*/
@SerializedName("role_id")
private Long roleId;
/**
* 角色名称
*/
@SerializedName("name")
private String name;
/**
* 角色描述
*/
@SerializedName("desc")
private String desc;
}
}

View File

@ -0,0 +1,47 @@
package cn.binarywang.wx.miniapp.bean.promoter.response;
import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse;
import com.google.gson.annotations.SerializedName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
/**
* @author zhuangzibin
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class WxMaPromotionGetShareMaterialResponse extends WxMaBaseResponse implements Serializable {
private static final long serialVersionUID = -7085856752639339737L;
/*
{
"share_path": "xxxxx",
"qrcode": "xxxxx",
"tag": "xxxxx",
"errcode": 0,
"errmsg": "OK"
}
*/
/**
* 带参path
*/
@SerializedName("share_path")
private String sharePath;
/**
* 小程序码图片base64
*/
@SerializedName("qrcode")
private String qrcode;
/**
* 短链
*/
@SerializedName("tag")
private String tag;
}

View File

@ -0,0 +1,33 @@
package cn.binarywang.wx.miniapp.bean.promoter.response;
import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse;
import com.google.gson.annotations.SerializedName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
/**
* @author zhuangzibin
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class WxMaPromotionSendMsgResponse extends WxMaBaseResponse implements Serializable {
private static final long serialVersionUID = -7485009740371167375L;
/*
{
"msg_id": "123456",
"errcode": 0,
"errmsg": "OK"
}
*/
/**
* 消息 id
*/
@SerializedName("msg_id")
private String msgId;
}

View File

@ -0,0 +1,24 @@
package cn.binarywang.wx.miniapp.bean.promoter.response;
import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
/**
* @author zhuangzibin
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class WxMaPromotionSingleSendMsgResponse extends WxMaBaseResponse implements Serializable {
private static final long serialVersionUID = -3710873744532645527L;
/*
{
"errcode": 0,
"errmsg": "OK"
}
*/
}

View File

@ -0,0 +1,18 @@
package cn.binarywang.wx.miniapp.bean.promoter.response;
import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
/**
* @author zhuangzibin
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class WxMaPromotionUpdatePromoterResponse extends WxMaBaseResponse implements Serializable {
private static final long serialVersionUID = 4181066183104514177L;
}

View File

@ -0,0 +1,19 @@
package cn.binarywang.wx.miniapp.bean.promoter.response;
import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
/**
* @author zhuangzibin
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class WxMaPromotionUpdateRoleResponse extends WxMaBaseResponse implements Serializable {
private static final long serialVersionUID = -7820893467305453782L;
}

View File

@ -859,6 +859,7 @@ public class WxMaApiUrlConstants {
String GET_CDN_LOGS_URL = "https://api.weixin.qq.com/wxa/sec/vod/getcdnlogs";
}
/**
* 小程序虚拟支付服务相关接口
* <pre>
@ -888,12 +889,33 @@ public class WxMaApiUrlConstants {
* <pre>
* 文档地址https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/express/business/express_sale_return.html
* </pre>
*
*/
public interface ExpressDeliveryReturn{
public interface ExpressDeliveryReturn {
String ADD_DELIVERY_RETURN_URL = "https://api.weixin.qq.com/cgi-bin/express/delivery/return/add";
String GET_DELIVERY_RETURN_URL = "https://api.weixin.qq.com/cgi-bin/express/delivery/return/get";
String UNBIND_DELIVERY_RETURN_URL = "https://api.weixin.qq.com/cgi-bin/express/delivery/return/unbind";
}
/**
* <pre> 小程序推广员
* 文档地址https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/promoter/instruction/instruction.html
* </pre>
*/
public interface Promotion {
String PROMOTION_ADD_ROLE = "https://api.weixin.qq.com/promoter/addrole";
String PROMOTION_GET_ROLE = "https://api.weixin.qq.com/promoter/getrole";
String PROMOTION_UPDATE_ROLE = "https://api.weixin.qq.com/promoter/updaterole";
String PROMOTION_ADD_PROMOTER = "https://api.weixin.qq.com/promoter/addpromoter";
String PROMOTION_GET_PROMOTER = "https://api.weixin.qq.com/promoter/getpromoter";
String PROMOTION_UPDATE_PROMOTER = "https://api.weixin.qq.com/promoter/updatepromoter";
String PROMOTION_GET_INVITATION_MATERIAL = "https://api.weixin.qq.com/promoter/getinvitationmaterial";
String PROMOTION_SEND_MSG = "https://api.weixin.qq.com/promoter/sendmsg";
String PROMOTION_SINGLE_SEND_MSG = "https://api.weixin.qq.com/promoter/singlesendmsg";
String PROMOTION_GET_MSG = "https://api.weixin.qq.com/promoter/getmsg";
String PROMOTION_GET_MSG_CLICK_DATA = "https://api.weixin.qq.com/promoter/getmsgclickdata";
String PROMOTION_GET_SHARE_MATERIAL = "https://api.weixin.qq.com/promoter/getsharematerial";
String PROMOTION_GET_RELATION = "https://api.weixin.qq.com/promoter/getrelation";
String PROMOTION_GET_ORDER = "https://api.weixin.qq.com/promoter/getorder";
}
}

View File

@ -0,0 +1,204 @@
package cn.binarywang.wx.miniapp.api.impl;
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.bean.promoter.request.*;
import com.google.inject.Inject;
import me.chanjar.weixin.common.error.WxErrorException;
import org.testng.annotations.Test;
import java.util.Collections;
import static org.assertj.core.api.Assertions.assertThat;
public class WxMaPromotionServiceTest {
@Inject
private WxMaService wxService;
@Test
public void testAddRole() throws WxErrorException {
WxMaPromotionAddRoleRequest request = WxMaPromotionAddRoleRequest.builder()
.name("推广员1号名字")
.desc("推广员1号描述")
.build();
var response = wxService.getWxMaPromotionService().addRole(request);
assertThat(response).isNotNull();
}
@Test
public void testGetRole() throws WxErrorException {
WxMaPromotionGetRoleRequest request = WxMaPromotionGetRoleRequest.builder()
.roleId(1L)
.build();
var response = wxService.getWxMaPromotionService().getRole(request);
assertThat(response).isNotNull();
}
@Test
public void testUpdateRole() throws WxErrorException {
WxMaPromoterUpdateRoleRequest request = WxMaPromoterUpdateRoleRequest.builder()
.roleId(1L)
.name("推广员1号名字")
.desc("推广员1号描述")
.build();
var response = wxService.getWxMaPromotionService().updateRole(request);
assertThat(response).isNotNull();
}
@Test
public void testAddPromoter() throws WxErrorException {
WxMaPromotionAddPromoterRequest.Promoter promoter = WxMaPromotionAddPromoterRequest.Promoter.builder()
.phone("15600000000")
.openid("")
.extraInfo("{}")
.retailId("1")
.roleId(1L)
.name("15600000000")
.build();
WxMaPromotionAddPromoterRequest request = WxMaPromotionAddPromoterRequest.builder()
.promoterList(Collections.singletonList(promoter))
.build();
var response = wxService.getWxMaPromotionService().addPromoter(request);
assertThat(response).isNotNull();
}
@Test
public void testGetPromoter() throws WxErrorException {
WxMaPromotionGetPromoterRequest request = WxMaPromotionGetPromoterRequest.builder()
.openid("")
.roleId(1L)
.retailId("")
.beginTime(1715938250L)
.endTime(1715938250L)
.startId("")
.needUnionid(null)
.authStatus(null)
.declStatus("1")
.build();
var response = wxService.getWxMaPromotionService().getPromoter(request);
assertThat(response).isNotNull();
}
@Test
public void testUpdatePromoter() throws WxErrorException {
WxMaPromotionUpdatePromoterRequest request = WxMaPromotionUpdatePromoterRequest.builder()
.id("")
.roleId(1L)
.retailId("")
.extraInfo("{}")
.name("15600000000")
.phone("15600000000")
.declStatus("1")
.build();
var response = wxService.getWxMaPromotionService().updatePromoter(request);
assertThat(response).isNotNull();
}
@Test
public void testGetInvitationMaterial() throws WxErrorException {
WxMaPromotionGetInvitationMaterialRequest request = WxMaPromotionGetInvitationMaterialRequest.builder()
.roleId(1L)
.invitationType(0L)
.build();
var response = wxService.getWxMaPromotionService().getInvitationMaterial(request);
assertThat(response).isNotNull();
}
@Test
public void testSendMsg() throws WxErrorException {
WxMaPromotionSendMsgRequest request = WxMaPromotionSendMsgRequest.builder()
.msgType(1)
.content("{}")
.appid("")
.path("")
.listType(0L)
.roleId(null)
.retailId(null)
.id(null)
.build();
var response = wxService.getWxMaPromotionService().sendMsg(request);
assertThat(response).isNotNull();
}
@Test
public void testSingleSendMsg() throws WxErrorException {
WxMaPromotionSingleSendMsgRequest request = WxMaPromotionSingleSendMsgRequest.builder()
.msgType(1)
.content("{}")
.appid("")
.path("")
.openid("")
.build();
var response = wxService.getWxMaPromotionService().singleSendMsg(request);
assertThat(response).isNotNull();
}
@Test
public void testGetMsg() throws WxErrorException {
WxMaPromotionGetMsgRequest request = WxMaPromotionGetMsgRequest.builder()
.msgId("")
.build();
var response = wxService.getWxMaPromotionService().getMsg(request);
assertThat(response).isNotNull();
}
@Test
public void testGetMsgClickData() throws WxErrorException {
WxMaPromotionGetMsgClickDataRequest request = WxMaPromotionGetMsgClickDataRequest.builder()
.sendDate("2024-05-17")
.dimonsion(0L)
.msgType(1)
.msgId("")
.beginSendTime(1715938250L)
.endSendTime(1715938250L)
.build();
var response = wxService.getWxMaPromotionService().getMsgClickData(request);
assertThat(response).isNotNull();
}
@Test
public void testGetShareMaterial() throws WxErrorException {
WxMaPromotionGetShareMaterialRequest request = WxMaPromotionGetShareMaterialRequest.builder()
.path("")
.openid("")
.extraInfo("{}")
.title("")
.shareType(0L)
.envVersion("")
.build();
var response = wxService.getWxMaPromotionService().getShareMaterial(request);
assertThat(response).isNotNull();
}
@Test
public void testGetRelation() throws WxErrorException {
WxMaPromotionGetRelationRequest request = WxMaPromotionGetRelationRequest.builder()
.openid("")
.beginTime(1715938250L)
.endTime(1715938250L)
.scene(0L)
.path("")
.startId("")
.needUnionid(0L)
.build();
var response = wxService.getWxMaPromotionService().getRelation(request);
assertThat(response).isNotNull();
}
@Test
public void testGetOrder() throws WxErrorException {
WxMaPromotionGetOrderRequest request = WxMaPromotionGetOrderRequest.builder()
.openid("")
.mchId("")
.tradeNo("")
.outTradeNo("")
.status(0L)
.startId("")
.needUnionid(0L)
.date(1715938250L)
.build();
var response = wxService.getWxMaPromotionService().getOrder(request);
assertThat(response).isNotNull();
}
}