diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/BaseWxChannelMessageService.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/BaseWxChannelMessageService.java index 5a1ecce5819d86caa6430453757df7b4c29219cf..a4a2c4240ece5b772b7584f37b14469a8dc6968e 100644 --- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/BaseWxChannelMessageService.java +++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/BaseWxChannelMessageService.java @@ -433,4 +433,17 @@ public interface BaseWxChannelMessageService { */ Object defaultMessageHandler(WxChannelMessage message, final String content, final String appId, final Map context, final WxSessionManager sessionManager); + + + /** + * 分享员变更 + * + * @param message the message + * @param content the content + * @param appId the app id + * @param context the context + * @param sessionManager the session manager + */ + void sharerChange(WxChannelMessage message, final String content, final String appId, + final Map context, final WxSessionManager sessionManager); } diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/BaseWxChannelMessageServiceImpl.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/BaseWxChannelMessageServiceImpl.java index 2cc75d0de1d78a0cea54a14ac0e409d07c5398ec..46837deba860d2a98f84fb3ea2f190f4b6f8ad44 100644 --- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/BaseWxChannelMessageServiceImpl.java +++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/BaseWxChannelMessageServiceImpl.java @@ -23,6 +23,7 @@ import me.chanjar.weixin.channel.bean.message.order.OrderStatusMessage; import me.chanjar.weixin.channel.bean.message.product.BrandMessage; import me.chanjar.weixin.channel.bean.message.product.CategoryAuditMessage; import me.chanjar.weixin.channel.bean.message.product.SpuAuditMessage; +import me.chanjar.weixin.channel.bean.message.sharer.SharerChangeMessage; import me.chanjar.weixin.channel.bean.message.supplier.SupplierItemMessage; import me.chanjar.weixin.channel.bean.message.vip.ExchangeInfoMessage; import me.chanjar.weixin.channel.bean.message.vip.UserInfoMessage; @@ -121,6 +122,10 @@ public abstract class BaseWxChannelMessageServiceImpl implements BaseWxChannelMe this.addRule(UserInfoMessage.class, USER_VIP_SCORE_UPDATE, false, this::vipScoreUpdate); /* 用户积分兑换 */ this.addRule(ExchangeInfoMessage.class, USER_VIP_SCORE_EXCHANGE, false, this::vipScoreExchange); + + + /* 分享员变更 */ + this.addRule(SharerChangeMessage.class,SHARER_CHANGE,false,this::sharerChange); } /** @@ -333,6 +338,10 @@ public abstract class BaseWxChannelMessageServiceImpl implements BaseWxChannelMe return null; } + @Override + public void sharerChange(WxChannelMessage message, String content, String appId, Map context, WxSessionManager sessionManager) { + log.info("分享员变更:{}", JsonUtils.encode(message)); + } @Override public abstract void vipJoin(UserInfoMessage message, String content, String appId, diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/message/sharer/SharerChangeMessage.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/message/sharer/SharerChangeMessage.java new file mode 100644 index 0000000000000000000000000000000000000000..ac997aeb476100df84bb3e6d9480aa7dd9d0b17c --- /dev/null +++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/message/sharer/SharerChangeMessage.java @@ -0,0 +1,47 @@ +package me.chanjar.weixin.channel.bean.message.sharer; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; +import me.chanjar.weixin.channel.message.WxChannelMessage; + +/** + * 分享员变更消息 + * https://developers.weixin.qq.com/doc/channels/API/sharer/callback/channels_ec_sharer_change.html + * + * @author sd-hxf + */ +@Data +@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) +@JacksonXmlRootElement(localName = "xml") +public class SharerChangeMessage extends WxChannelMessage { + + private static final long serialVersionUID = 4219477394934480421L; + + /** + * 分享员OpenID + */ + @JsonProperty("openid") + @JacksonXmlProperty(localName = "openid") + private String openid; + + /** + * 分享员类型:0-普通分享员,1-店铺分享员 + */ + @JsonProperty("sharer_type") + @JacksonXmlProperty(localName = "sharer_type") + private Integer sharerType; + + /** + * 分享员绑定状态:1-绑定,2-解绑 + */ + @JsonProperty("bind_status") + @JacksonXmlProperty(localName = "bind_status") + private String bindStatus; + + +} diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/constant/MessageEventConstants.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/constant/MessageEventConstants.java index f1e445513caeb082cade5cf89af5918f98238ff4..48cf268b062f16ca27d88a27cf0ac94f702a7286 100644 --- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/constant/MessageEventConstants.java +++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/constant/MessageEventConstants.java @@ -79,4 +79,8 @@ public interface MessageEventConstants { String USER_VIP_SCORE_UPDATE = "channels_ec_vip_score_update"; /** 用户积分兑换 */ String USER_VIP_SCORE_EXCHANGE = "channels_ec_vip_score_exchange"; + + // 分享员相关 + /** 分享员变更 **/ + String SHARER_CHANGE = "channels_ec_sharer_change"; }