context, final WxSessionManager sessionManager);
/**
* 默认消息处理
*
* @param message 消息
- * @param content 内容
+ * @param content 消息原始内容
* @param appId appId
* @param context 上下文
* @param sessionManager session管理器
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/BaseWxChannelService.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/BaseWxChannelService.java
index f745ff3e41..f9f4cbed68 100644
--- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/BaseWxChannelService.java
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/BaseWxChannelService.java
@@ -41,8 +41,7 @@ public interface BaseWxChannelService extends WxService {
*
* 获取access_token,本方法线程安全.
* 且在多线程同时刷新时只刷新一次,避免超出2000次/日的调用次数上限
- *
- * 另:本service的所有方法都会在access_token过期是调用此方法
+ * 使用【稳定版接口】获取access_token时,限制【20次/日】,连续使用该模式时,请保证调用时间隔至少为30s,否则不会刷新
*
* 程序员在非必要情况下尽量不要主动调用此方法
*
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxChannelCategoryService.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxChannelCategoryService.java
index ddbc99e5d4..0b357a5d1c 100644
--- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxChannelCategoryService.java
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxChannelCategoryService.java
@@ -4,17 +4,20 @@
import java.util.List;
import me.chanjar.weixin.channel.bean.audit.AuditApplyResponse;
import me.chanjar.weixin.channel.bean.audit.AuditResponse;
+import me.chanjar.weixin.channel.bean.audit.CategoryAuditInfo;
import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
import me.chanjar.weixin.channel.bean.category.CategoryDetailResult;
import me.chanjar.weixin.channel.bean.category.CategoryQualificationResponse;
import me.chanjar.weixin.channel.bean.category.PassCategoryResponse;
import me.chanjar.weixin.channel.bean.category.ShopCategory;
+import me.chanjar.weixin.channel.bean.category.ShopCategoryResponse;
import me.chanjar.weixin.common.error.WxErrorException;
/**
* 视频号小店 商品类目相关接口
*
* @author Zeyes
+ * @see 新旧类目树差异
*/
public interface WxChannelCategoryService {
@@ -30,12 +33,27 @@ public interface WxChannelCategoryService {
/**
* 获取商品类目列表(全量) 有频率限制
*
- * @param parentId 类目父id
+ * @param fCatId 类目父id
* @return 类目列表
*
* @throws WxErrorException 异常
+ * @deprecated 接口返回更新,请使用 {@link #listAvailableCategories(String)}
*/
- List listAvailableCategory(String parentId) throws WxErrorException;
+ @Deprecated
+ List listAvailableCategory(String fCatId) throws WxErrorException;
+
+ /**
+ * 获取可用的子类目详情
+ *
+ * 1.f_cat_id 为旧类目树中的非叶子类目,仅设置 cat_list 字段。
+ * 2.f_cat_id 为新类目树中的非叶子类目,仅设置 cat_list_v2 字段。
+ * 3.f_cat_id 为0,同时设置 cat_list 和 cat_list_v2 字段
+ *
+ * @param fCatId 父类目ID,可先填0获取根部类目
+ * @return 类目列表
+ * @throws WxErrorException 异常
+ */
+ ShopCategoryResponse listAvailableCategories(String fCatId) throws WxErrorException;
/**
* 获取类目信息
@@ -58,10 +76,23 @@ public interface WxChannelCategoryService {
*
* @throws WxErrorException 异常
* @see WxChannelBasicService#uploadQualificationFile(File)
+ * @deprecated 请使用 {@link #addCategory(CategoryAuditInfo)}
*/
+ @Deprecated
AuditApplyResponse addCategory(String level1, String level2, String level3, List certificate)
throws WxErrorException;
+ /**
+ * 上传类目资质
+ *
+ * @param info 类目资质信息
+ * @return 审核id
+ *
+ * @throws WxErrorException 异常
+ * @see WxChannelBasicService#uploadQualificationFile(File)
+ */
+ AuditApplyResponse addCategory(CategoryAuditInfo info) throws WxErrorException;
+
/**
* 取消类目提审
*
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxChannelOrderService.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxChannelOrderService.java
index 6179510e78..d426a39805 100644
--- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxChannelOrderService.java
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxChannelOrderService.java
@@ -3,14 +3,17 @@
import java.util.List;
import me.chanjar.weixin.channel.bean.base.AddressInfo;
import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
+import me.chanjar.weixin.channel.bean.delivery.PackageAuditInfo;
import me.chanjar.weixin.channel.bean.delivery.DeliveryCompanyResponse;
import me.chanjar.weixin.channel.bean.delivery.DeliveryInfo;
import me.chanjar.weixin.channel.bean.order.ChangeOrderInfo;
+import me.chanjar.weixin.channel.bean.order.DecodeSensitiveInfoResponse;
import me.chanjar.weixin.channel.bean.order.DeliveryUpdateParam;
import me.chanjar.weixin.channel.bean.order.OrderInfoResponse;
import me.chanjar.weixin.channel.bean.order.OrderListParam;
import me.chanjar.weixin.channel.bean.order.OrderListResponse;
import me.chanjar.weixin.channel.bean.order.OrderSearchParam;
+import me.chanjar.weixin.channel.bean.order.VirtualTelNumberResponse;
import me.chanjar.weixin.common.error.WxErrorException;
/**
@@ -143,4 +146,37 @@ WxChannelBaseResponse updatePrice(String orderId, Integer expressFee, List deliveryList) throws WxErrorException;
+
+ /**
+ * 上传生鲜质检信息
+ *
+ * 注意事项:
+ * 1. 非生鲜质检的订单不能进行上传
+ * 2. 图片url必须用图片上传接口获取 {@link WxChannelBasicService#uploadImg(int, String)}
+ *
+ * @param orderId 订单id
+ * @param items 商品打包信息
+ * @return BaseResponse
+ *
+ * @throws WxErrorException 异常
+ */
+ WxChannelBaseResponse uploadFreshInspect(String orderId, List items) throws WxErrorException;
+
+ /**
+ * 兑换虚拟号
+ *
+ * @param orderId 订单id
+ * @return 虚拟号信息
+ * @throws WxErrorException 异常
+ */
+ VirtualTelNumberResponse getVirtualTelNumber(String orderId) throws WxErrorException;
+
+ /**
+ * 解码订单包含的敏感数据
+ *
+ * @param orderId 订单id
+ * @return 解码结果
+ * @throws WxErrorException 异常
+ */
+ DecodeSensitiveInfoResponse decodeSensitiveInfo(String orderId) throws WxErrorException;
}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxChannelProductService.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxChannelProductService.java
index b962b9ec85..7064adf70f 100644
--- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxChannelProductService.java
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxChannelProductService.java
@@ -1,21 +1,29 @@
package me.chanjar.weixin.channel.api;
+import java.util.List;
import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
import me.chanjar.weixin.channel.bean.limit.LimitTaskAddResponse;
import me.chanjar.weixin.channel.bean.limit.LimitTaskListResponse;
import me.chanjar.weixin.channel.bean.limit.LimitTaskParam;
+import me.chanjar.weixin.channel.bean.product.SkuStockBatchResponse;
import me.chanjar.weixin.channel.bean.product.SkuStockResponse;
+import me.chanjar.weixin.channel.bean.product.SpuFastInfo;
import me.chanjar.weixin.channel.bean.product.SpuGetResponse;
import me.chanjar.weixin.channel.bean.product.SpuInfo;
import me.chanjar.weixin.channel.bean.product.SpuListResponse;
+import me.chanjar.weixin.channel.bean.product.SpuUpdateInfo;
import me.chanjar.weixin.channel.bean.product.SpuUpdateResponse;
+import me.chanjar.weixin.channel.bean.product.link.ProductH5UrlResponse;
+import me.chanjar.weixin.channel.bean.product.link.ProductQrCodeResponse;
+import me.chanjar.weixin.channel.bean.product.link.ProductTagLinkResponse;
import me.chanjar.weixin.common.error.WxErrorException;
/**
* 视频号小店 商品服务接口
*
* @author Zeyes
+ * @see 商品状态流转图
*/
public interface WxChannelProductService {
@@ -27,6 +35,28 @@ public interface WxChannelProductService {
*
* @throws WxErrorException 异常
*/
+ SpuUpdateResponse addProduct(SpuUpdateInfo info) throws WxErrorException;
+
+ /**
+ * 更新商品
+ *
+ * @param info 商品信息
+ * @return 返回商品的状态和id
+ *
+ * @throws WxErrorException 异常
+ */
+ SpuUpdateResponse updateProduct(SpuUpdateInfo info) throws WxErrorException;
+
+ /**
+ * 添加商品
+ *
+ * @param info 商品信息
+ * @return 返回商品的状态和id
+ *
+ * @throws WxErrorException 异常
+ * @deprecated 请使用 {@link #addProduct(SpuUpdateInfo)}
+ */
+ @Deprecated
SpuUpdateResponse addProduct(SpuInfo info) throws WxErrorException;
/**
@@ -36,15 +66,28 @@ public interface WxChannelProductService {
* @return 返回商品的状态和id
*
* @throws WxErrorException 异常
+ * @deprecated 请使用 {@link #updateProduct(SpuUpdateInfo)}
*/
+ @Deprecated
SpuUpdateResponse updateProduct(SpuInfo info) throws WxErrorException;
+ /**
+ * 免审更新商品
+ *
+ * @param info 商品信息
+ * @return 返回商品的状态和id
+ *
+ * @throws WxErrorException 异常
+ */
+ WxChannelBaseResponse updateProductAuditFree(SpuFastInfo info) throws WxErrorException;
+
/**
* 更新商品库存 (仅对edit_status != 2 的商品适用,其他状态的商品无法通过该接口修改库存)
*
* @param productId 内部商品ID
* @param skuId 内部sku_id
* @param diffType 修改类型 1增加 2减少 3设置
+ * 建议使用1或2,不建议使用3,因为使用3在高并发场景可能会出现预期外表现
* @param num 增加、减少或者设置的库存值
* @return WxChannelBaseResponse
*
@@ -127,6 +170,42 @@ WxChannelBaseResponse updateStock(String productId, String skuId, Integer diffTy
*/
SkuStockResponse getSkuStock(String productId, String skuId) throws WxErrorException;
+ /**
+ * 批量获取库存信息 (单次请求不能超过50个商品ID)
+ *
+ * @param productIds 商品ID列表
+ * @return 库存信息
+ * @throws WxErrorException 异常
+ */
+ SkuStockBatchResponse getSkuStockBatch(List productIds) throws WxErrorException;
+
+ /**
+ * 获取商品H5链接
+ *
+ * @param productId 商品ID
+ * @return 商品H5链接
+ * @throws WxErrorException 异常
+ */
+ ProductH5UrlResponse getProductH5Url(String productId) throws WxErrorException;
+
+ /**
+ * 获取商品二维码
+ *
+ * @param productId 商品ID
+ * @return 商品二维码
+ * @throws WxErrorException 异常
+ */
+ ProductQrCodeResponse getProductQrCode(String productId) throws WxErrorException;
+
+ /**
+ * 获取商品口令
+ *
+ * @param productId 商品ID
+ * @return 商品口令
+ * @throws WxErrorException 异常
+ */
+ ProductTagLinkResponse getProductTagLink(String productId) throws WxErrorException;
+
/**
* 添加限时抢购任务
*
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxChannelService.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxChannelService.java
index 48d82206b3..89f6b00964 100644
--- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxChannelService.java
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxChannelService.java
@@ -91,6 +91,13 @@ public interface WxChannelService extends BaseWxChannelService {
*/
WxChannelFundService getFundService();
+ /**
+ * 主页管理服务
+ *
+ * @return 主页管理服务
+ */
+ WxStoreHomePageService getHomePageService();
+
/**
* 优选联盟-团长合作达人管理服务
*
@@ -140,7 +147,6 @@ public interface WxChannelService extends BaseWxChannelService {
*/
WxAssistantService getAssistantService();
-
/**
* 会员功能
*
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxChannelVipService.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxChannelVipService.java
index 0909844f06..4100659200 100644
--- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxChannelVipService.java
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxChannelVipService.java
@@ -45,11 +45,11 @@ public interface WxChannelVipService {
*
* @param needPhoneNumber the need phone number
* @param pageNum the page num
- * @param PageSize the page size
+ * @param pageSize the page size
* @return the vip list
* @throws WxErrorException the wx error exception
*/
- VipListResponse getVipList(Boolean needPhoneNumber, Integer pageNum, Integer PageSize) throws WxErrorException;
+ VipListResponse getVipList(Boolean needPhoneNumber, Integer pageNum, Integer pageSize) throws WxErrorException;
/**
* 获取用户积分
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxStoreHomePageService.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxStoreHomePageService.java
new file mode 100644
index 0000000000..bd11e471b3
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxStoreHomePageService.java
@@ -0,0 +1,188 @@
+package me.chanjar.weixin.channel.api;
+
+import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
+import me.chanjar.weixin.channel.bean.home.background.BackgroundApplyResponse;
+import me.chanjar.weixin.channel.bean.home.background.BackgroundGetResponse;
+import me.chanjar.weixin.channel.bean.home.banner.BannerApplyResponse;
+import me.chanjar.weixin.channel.bean.home.banner.BannerGetResponse;
+import me.chanjar.weixin.channel.bean.home.banner.BannerInfo;
+import me.chanjar.weixin.channel.bean.home.tree.TreeProductEditInfo;
+import me.chanjar.weixin.channel.bean.home.tree.TreeProductListInfo;
+import me.chanjar.weixin.channel.bean.home.tree.TreeProductListResponse;
+import me.chanjar.weixin.channel.bean.home.tree.TreeShowGetResponse;
+import me.chanjar.weixin.channel.bean.home.tree.TreeShowInfo;
+import me.chanjar.weixin.channel.bean.home.tree.TreeShowSetResponse;
+import me.chanjar.weixin.channel.bean.home.window.WindowProductSettingResponse;
+import me.chanjar.weixin.common.error.WxErrorException;
+
+/**
+ * 微信小店 主页管理相关接口
+ *
+ * @author Zeyes
+ */
+public interface WxStoreHomePageService {
+
+ /**
+ * 添加分类关联的商品
+ *
+ * @param info 商品分类以及商品id
+ * @return BaseResponse
+ *
+ * @throws WxErrorException 异常
+ */
+ WxChannelBaseResponse addTreeProduct(TreeProductEditInfo info) throws WxErrorException;
+
+ /**
+ * 删除分类关联的商品
+ *
+ * @param info 商品分类以及商品id
+ * @return BaseResponse
+ *
+ * @throws WxErrorException 异常
+ */
+ WxChannelBaseResponse delTreeProduct(TreeProductEditInfo info) throws WxErrorException;
+
+ /**
+ * 获取分类关联的商品ID列表
+ *
+ * @param info 分类id、分页大小、分页上下文
+ * @return 商品id、分页上下文
+ *
+ * @throws WxErrorException 异常
+ */
+ TreeProductListResponse getTreeProductList(TreeProductListInfo info) throws WxErrorException;
+
+ /**
+ * 设置展示在店铺主页的商品分类
+ *
+ * @param info 分类id
+ * @return 商品分类审核结果
+ *
+ * @throws WxErrorException 异常
+ */
+ TreeShowSetResponse setShowTree(TreeShowInfo info) throws WxErrorException;
+
+ /**
+ * 获取展示在店铺主页的商品分类
+ *
+ * @return 商品分类信息
+ *
+ * @throws WxErrorException 异常
+ */
+ TreeShowGetResponse getShowTree() throws WxErrorException;
+
+ /**
+ * 获取主页展示商品列表
+ *
+ * @param pageSize 分页大小
+ * @param nextKey 分页上下文
+ * @return WindowProductSettingResponse
+ *
+ * @throws WxErrorException 异常
+ */
+ WindowProductSettingResponse listWindowProduct(Integer pageSize, String nextKey) throws WxErrorException;
+
+ /**
+ * 删除主页展示商品
+ *
+ * @param productId 商品id
+ * @param indexNum 商品重新排序后的新序号,最大移动步长为500(即新序号与当前序号的距离小于500)
+ * @return BaseResponse
+ *
+ * @throws WxErrorException 异常
+ */
+ WxChannelBaseResponse reorderWindowProduct(String productId, Integer indexNum) throws WxErrorException;
+
+ /**
+ * 隐藏小店主页商品
+ *
+ * @param productId 商品id
+ * @param setHide 是否隐藏。1-隐藏,0-取消隐藏
+ * @return BaseResponse
+ *
+ * @throws WxErrorException 异常
+ */
+ WxChannelBaseResponse hideWindowProduct(String productId, Integer setHide) throws WxErrorException;
+
+ /**
+ * 置顶小店主页商品
+ *
+ * @param productId 商品id
+ * @param setTop 是否顶置。1-置顶,0-取消置顶
+ * @return BaseResponse
+ *
+ * @throws WxErrorException 异常
+ */
+ WxChannelBaseResponse topWindowProduct(String productId, Integer setTop) throws WxErrorException;
+
+ /**
+ * 提交背景图申请
+ *
+ * @param imgUrl 图片链接。请务必使用接口上传图片(参数resp_type=1),并将返回的img_url填入此处,不接受其他任何格式的图片url。
+ * 若url曾经做过转换(url前缀为mmecimage.cn/p/),则可以直接提交。
+ * @return 申请编号
+ *
+ * @throws WxErrorException 异常
+ * @see WxChannelBasicService#uploadImg(int, String)
+ */
+ BackgroundApplyResponse applyBackground(String imgUrl) throws WxErrorException;
+
+ /**
+ * 查询背景图
+ *
+ * @return 背景图信息
+ * @throws WxErrorException 异常
+ */
+ BackgroundGetResponse getBackground() throws WxErrorException;
+
+ /**
+ * 撤销主页背景图申请
+ *
+ * @param applyId 申请编号
+ * @return BaseResponse
+ * @throws WxErrorException 异常
+ */
+ WxChannelBaseResponse cancelBackground(Integer applyId) throws WxErrorException;
+
+ /**
+ * 清空主页背景图并撤销流程中的申请
+ *
+ * @return BaseResponse
+ * @throws WxErrorException 异常
+ */
+ WxChannelBaseResponse removeBackground() throws WxErrorException;
+
+ /**
+ * 提交精选展示位申请
+ *
+ * @param info 展示位信息
+ * @return 申请编号
+ * @throws WxErrorException 异常
+ */
+ BannerApplyResponse applyBanner(BannerInfo info) throws WxErrorException;
+
+ /**
+ * 查询精选展示位
+ *
+ * @return 展示位信息
+ * @throws WxErrorException 异常
+ */
+ BannerGetResponse getBanner() throws WxErrorException;
+
+ /**
+ * 撤销精选展示位申请
+ *
+ * @param applyId 申请编号
+ * @return BaseResponse
+ * @throws WxErrorException 异常
+ */
+ WxChannelBaseResponse cancelBanner(Integer applyId) throws WxErrorException;
+
+ /**
+ * 清空精选展示位并撤销流程中的申请
+ *
+ * @return BaseResponse
+ * @throws WxErrorException 异常
+ */
+ WxChannelBaseResponse removeBanner() throws WxErrorException;
+}
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 46837deba8..200021b37d 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
@@ -24,6 +24,8 @@
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.store.CloseStoreMessage;
+import me.chanjar.weixin.channel.bean.message.store.NicknameUpdateMessage;
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;
@@ -111,7 +113,6 @@ protected void addDefaultRule() {
/* 团长 */
this.addRule(SupplierItemMessage.class, SUPPLIER_ITEM_UPDATE, this::supplierItemUpdate);
-
/* 用户加入会员 */
this.addRule(UserInfoMessage.class, USER_VIP_JOIN, false, this::vipJoin);
/* 用户注销会员 */
@@ -123,9 +124,13 @@ protected void addDefaultRule() {
/* 用户积分兑换 */
this.addRule(ExchangeInfoMessage.class, USER_VIP_SCORE_EXCHANGE, false, this::vipScoreExchange);
-
/* 分享员变更 */
this.addRule(SharerChangeMessage.class,SHARER_CHANGE,false,this::sharerChange);
+
+ /* 小店注销 */
+ this.addRule(CloseStoreMessage.class, CLOSE_STORE, this::closeStore);
+ /* 小店修改名称 */
+ this.addRule(NicknameUpdateMessage.class, SET_SHOP_NICKNAME, this::updateNickname);
}
/**
@@ -344,22 +349,44 @@ public void sharerChange(WxChannelMessage message, String content, String appId,
}
@Override
- public abstract void vipJoin(UserInfoMessage message, String content, String appId,
- Map context, WxSessionManager sessionManager);
+ public void vipJoin(UserInfoMessage message, String content, String appId,
+ Map context, WxSessionManager sessionManager) {
+ log.info("用户加入会员:{}", JsonUtils.encode(message));
+ }
+
+ @Override
+ public void vipClose(UserInfoMessage message, String content, String appId,
+ Map context, WxSessionManager sessionManager) {
+ log.info("用户注销会员:{}", JsonUtils.encode(message));
+ }
+
+ @Override
+ public void vipGradeUpdate(UserInfoMessage message, String content, String appId,
+ Map context, WxSessionManager sessionManager) {
+ log.info("用户等级信息更新:{}", JsonUtils.encode(message));
+ }
@Override
- public abstract void vipClose(UserInfoMessage message, String content, String appId,
- Map context, WxSessionManager sessionManager);
+ public void vipScoreUpdate(UserInfoMessage message, String content, String appId,
+ Map context, WxSessionManager sessionManager) {
+ log.info("用户积分更新:{}", JsonUtils.encode(message));
+ }
@Override
- public abstract void vipGradeUpdate(UserInfoMessage message, String content, String appId,
- Map context, WxSessionManager sessionManager);
+ public void vipScoreExchange(ExchangeInfoMessage message, String content, String appId,
+ Map context, WxSessionManager sessionManager) {
+ log.info("用户积分兑换:{}", JsonUtils.encode(message));
+ }
@Override
- public abstract void vipScoreUpdate(UserInfoMessage message, String content, String appId,
- Map context, WxSessionManager sessionManager);
+ public void closeStore(CloseStoreMessage message, String content, String appId,
+ Map context, WxSessionManager sessionManager) {
+ log.info("小店注销:{}", JsonUtils.encode(message));
+ }
@Override
- public abstract void vipScoreExchange(ExchangeInfoMessage message, String content, String appId,
- Map context, WxSessionManager sessionManager);
+ public void updateNickname(NicknameUpdateMessage message, String content, String appId,
+ Map context, WxSessionManager sessionManager) {
+ log.info("小店修改名称:{}", JsonUtils.encode(message));
+ }
}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/BaseWxChannelServiceImpl.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/BaseWxChannelServiceImpl.java
index c9f874c99e..ee4625c1a3 100644
--- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/BaseWxChannelServiceImpl.java
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/BaseWxChannelServiceImpl.java
@@ -47,6 +47,7 @@ public abstract class BaseWxChannelServiceImpl implements WxChannelService
private final WxChannelCouponService couponService = new WxChannelCouponServiceImpl(this);
private final WxChannelSharerService sharerService = new WxChannelSharerServiceImpl(this);
private final WxChannelFundService fundService = new WxChannelFundServiceImpl(this);
+ private WxStoreHomePageService homePageService = null;
private WxLeagueWindowService leagueWindowService = null;
private WxLeagueSupplierService leagueSupplierService = null;
private WxLeaguePromoterService leaguePromoterService = null;
@@ -54,7 +55,7 @@ public abstract class BaseWxChannelServiceImpl implements WxChannelService
private WxLeadComponentService leadComponentService = null;
private WxFinderLiveService finderLiveService = null;
private WxAssistantService assistantService = null;
- private WxChannelVipService vipService = new WxChannelVipServiceImpl(this);
+ private WxChannelVipService vipService = null;
private final WxChannelCompassFinderService compassFinderService =
new WxChannelCompassFinderServiceImpl(this);
private final WxChannelLiveDashboardService liveDashboardService =
@@ -99,9 +100,14 @@ public String getAccessToken(boolean forceRefresh) throws WxErrorException {
return this.getConfig().getAccessToken();
}
} while (!locked);
- String response = doGetAccessTokenRequest();
+ String response;
+ if (getConfig().isStableAccessToken()) {
+ response = doGetStableAccessTokenRequest(forceRefresh);
+ } else {
+ response = doGetAccessTokenRequest();
+ }
return extractAccessToken(response);
- } catch (WxErrorException | InterruptedException e) {
+ } catch (IOException | InterruptedException e) {
throw new WxRuntimeException(e);
} finally {
if (locked) {
@@ -113,10 +119,18 @@ public String getAccessToken(boolean forceRefresh) throws WxErrorException {
/**
* 通过网络请求获取AccessToken
*
- * @return .
- * @throws IOException .
+ * @return AccessToken
+ * @throws IOException IOException
+ */
+ protected abstract String doGetAccessTokenRequest() throws IOException;
+
+ /**
+ * 通过网络请求获取稳定版AccessToken
+ *
+ * @return Stable AccessToken
+ * @throws IOException IOException
*/
- protected abstract String doGetAccessTokenRequest() throws WxErrorException;
+ protected abstract String doGetStableAccessTokenRequest(boolean forceRefresh) throws IOException;
@Override
public String get(String url, String queryParam) throws WxErrorException {
@@ -262,9 +276,9 @@ protected T executeInternal(RequestExecutor executor, String uri, E
* @throws WxErrorException 异常
*/
protected String extractAccessToken(String resultContent) throws WxErrorException {
- log.info("resultContent: " + resultContent);
+ log.debug("access-token response: " + resultContent);
WxChannelConfig config = this.getConfig();
- WxError error = WxError.fromJson(resultContent, WxType.MiniApp);
+ WxError error = WxError.fromJson(resultContent, WxType.Channel);
if (error.getErrorCode() != 0) {
throw new WxErrorException(error);
}
@@ -354,6 +368,14 @@ public WxChannelFundService getFundService() {
return fundService;
}
+ @Override
+ public synchronized WxStoreHomePageService getHomePageService() {
+ if (homePageService == null) {
+ homePageService = new WxStoreHomePageServiceImpl(this);
+ }
+ return homePageService;
+ }
+
@Override
public synchronized WxLeagueWindowService getLeagueWindowService() {
if (leagueWindowService == null) {
@@ -413,6 +435,9 @@ public WxAssistantService getAssistantService() {
@Override
public WxChannelVipService getVipService() {
+ if (vipService == null) {
+ vipService = new WxChannelVipServiceImpl(this);
+ }
return vipService;
}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/WxChannelCategoryServiceImpl.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/WxChannelCategoryServiceImpl.java
index 52fdf3cdf8..e5940e9879 100644
--- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/WxChannelCategoryServiceImpl.java
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/WxChannelCategoryServiceImpl.java
@@ -66,6 +66,14 @@ public List listAvailableCategory(String parentId) throws WxErrorE
return response.getCategories();
}
+ @Override
+ public ShopCategoryResponse listAvailableCategories(String fCatId) throws WxErrorException {
+ String reqJson = "{\"f_cat_id\": " + fCatId + "}";
+ String resJson = (String) shopService.executeWithoutLog(SimplePostRequestExecutor.create(shopService),
+ AVAILABLE_CATEGORY_URL, reqJson);
+ return ResponseUtils.decode(resJson, ShopCategoryResponse.class);
+ }
+
@Override
public CategoryDetailResult getCategoryDetail(String id) throws WxErrorException {
Long catId = null;
@@ -89,7 +97,11 @@ public AuditApplyResponse addCategory(String level1, String level2, String level
Long l1 = Long.parseLong(level1);
Long l2 = Long.parseLong(level2);
Long l3 = Long.parseLong(level3);
- CategoryAuditInfo categoryInfo = new CategoryAuditInfo(l1, l2, l3, certificate);
+ CategoryAuditInfo categoryInfo = new CategoryAuditInfo();
+ categoryInfo.setLevel1(l1);
+ categoryInfo.setLevel2(l2);
+ categoryInfo.setLevel3(l3);
+ categoryInfo.setCertificates(certificate);
reqJson = JsonUtils.encode(new CategoryAuditRequest(categoryInfo));
} catch (Throwable e) {
log.error("微信请求异常", e);
@@ -98,6 +110,13 @@ public AuditApplyResponse addCategory(String level1, String level2, String level
return ResponseUtils.decode(resJson, AuditApplyResponse.class);
}
+ @Override
+ public AuditApplyResponse addCategory(CategoryAuditInfo info) throws WxErrorException {
+ String reqJson = JsonUtils.encode(new CategoryAuditRequest(info));
+ String resJson = shopService.post(ADD_CATEGORY_URL, reqJson);
+ return ResponseUtils.decode(resJson, AuditApplyResponse.class);
+ }
+
@Override
public WxChannelBaseResponse cancelCategoryAudit(String auditId) throws WxErrorException {
String resJson = shopService.post(CANCEL_CATEGORY_AUDIT_URL, "{\"audit_id\": \"" + auditId + "\"}");
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/WxChannelOrderServiceImpl.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/WxChannelOrderServiceImpl.java
index 65eec5dd29..e98294d189 100644
--- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/WxChannelOrderServiceImpl.java
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/WxChannelOrderServiceImpl.java
@@ -9,10 +9,13 @@
import me.chanjar.weixin.channel.api.WxChannelOrderService;
import me.chanjar.weixin.channel.bean.base.AddressInfo;
import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
+import me.chanjar.weixin.channel.bean.delivery.PackageAuditInfo;
import me.chanjar.weixin.channel.bean.delivery.DeliveryCompanyResponse;
import me.chanjar.weixin.channel.bean.delivery.DeliveryInfo;
import me.chanjar.weixin.channel.bean.delivery.DeliverySendParam;
+import me.chanjar.weixin.channel.bean.delivery.FreshInspectParam;
import me.chanjar.weixin.channel.bean.order.ChangeOrderInfo;
+import me.chanjar.weixin.channel.bean.order.DecodeSensitiveInfoResponse;
import me.chanjar.weixin.channel.bean.order.DeliveryUpdateParam;
import me.chanjar.weixin.channel.bean.order.OrderAddressParam;
import me.chanjar.weixin.channel.bean.order.OrderIdParam;
@@ -22,6 +25,7 @@
import me.chanjar.weixin.channel.bean.order.OrderPriceParam;
import me.chanjar.weixin.channel.bean.order.OrderRemarkParam;
import me.chanjar.weixin.channel.bean.order.OrderSearchParam;
+import me.chanjar.weixin.channel.bean.order.VirtualTelNumberResponse;
import me.chanjar.weixin.channel.util.ResponseUtils;
import me.chanjar.weixin.common.error.WxErrorException;
@@ -122,4 +126,26 @@ public WxChannelBaseResponse deliveryOrder(String orderId, List de
String resJson = shopService.post(DELIVERY_SEND_URL, param);
return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
}
+
+ @Override
+ public WxChannelBaseResponse uploadFreshInspect(String orderId, List items)
+ throws WxErrorException {
+ FreshInspectParam param = new FreshInspectParam(orderId, items);
+ String resJson = shopService.post(UPLOAD_FRESH_INSPECT_URL, param);
+ return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
+ }
+
+ @Override
+ public VirtualTelNumberResponse getVirtualTelNumber(String orderId) throws WxErrorException {
+ String reqJson = "{\"order_id\":\"" + orderId + "\"}";
+ String resJson = shopService.post(VIRTUAL_TEL_NUMBER_URL, reqJson);
+ return ResponseUtils.decode(resJson, VirtualTelNumberResponse.class);
+ }
+
+ @Override
+ public DecodeSensitiveInfoResponse decodeSensitiveInfo(String orderId) throws WxErrorException {
+ String reqJson = "{\"order_id\":\"" + orderId + "\"}";
+ String resJson = shopService.post(DECODE_SENSITIVE_INFO_URL, reqJson);
+ return ResponseUtils.decode(resJson, DecodeSensitiveInfoResponse.class);
+ }
}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/WxChannelProductServiceImpl.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/WxChannelProductServiceImpl.java
index eb168a09e3..bb131d2eaa 100644
--- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/WxChannelProductServiceImpl.java
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/WxChannelProductServiceImpl.java
@@ -6,16 +6,22 @@
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.DELETE_LIMIT_TASK_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.LIST_LIMIT_TASK_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_ADD_URL;
+import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_AUDIT_FREE_UPDATE_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_DELISTING_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_DEL_URL;
+import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_GET_STOCK_BATCH_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_GET_STOCK_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_GET_URL;
+import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_H5URL_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_LISTING_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_LIST_URL;
+import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_QRCODE_URL;
+import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_TAGLINK_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_UPDATE_STOCK_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.SPU_UPDATE_URL;
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Spu.STOP_LIMIT_TASK_URL;
+import java.util.List;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.channel.api.WxChannelProductService;
import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
@@ -23,13 +29,20 @@
import me.chanjar.weixin.channel.bean.limit.LimitTaskListParam;
import me.chanjar.weixin.channel.bean.limit.LimitTaskListResponse;
import me.chanjar.weixin.channel.bean.limit.LimitTaskParam;
+import me.chanjar.weixin.channel.bean.product.SkuStockBatchParam;
+import me.chanjar.weixin.channel.bean.product.SkuStockBatchResponse;
import me.chanjar.weixin.channel.bean.product.SkuStockParam;
import me.chanjar.weixin.channel.bean.product.SkuStockResponse;
+import me.chanjar.weixin.channel.bean.product.SpuFastInfo;
import me.chanjar.weixin.channel.bean.product.SpuGetResponse;
import me.chanjar.weixin.channel.bean.product.SpuInfo;
import me.chanjar.weixin.channel.bean.product.SpuListParam;
import me.chanjar.weixin.channel.bean.product.SpuListResponse;
+import me.chanjar.weixin.channel.bean.product.SpuUpdateInfo;
import me.chanjar.weixin.channel.bean.product.SpuUpdateResponse;
+import me.chanjar.weixin.channel.bean.product.link.ProductH5UrlResponse;
+import me.chanjar.weixin.channel.bean.product.link.ProductQrCodeResponse;
+import me.chanjar.weixin.channel.bean.product.link.ProductTagLinkResponse;
import me.chanjar.weixin.channel.util.JsonUtils;
import me.chanjar.weixin.channel.util.ResponseUtils;
import me.chanjar.weixin.common.error.WxErrorException;
@@ -49,6 +62,20 @@ public WxChannelProductServiceImpl(BaseWxChannelServiceImpl shopService) {
this.shopService = shopService;
}
+ @Override
+ public SpuUpdateResponse addProduct(SpuUpdateInfo info) throws WxErrorException {
+ String reqJson = JsonUtils.encode(info);
+ String resJson = shopService.post(SPU_ADD_URL, reqJson);
+ return ResponseUtils.decode(resJson, SpuUpdateResponse.class);
+ }
+
+ @Override
+ public SpuUpdateResponse updateProduct(SpuUpdateInfo info) throws WxErrorException {
+ String reqJson = JsonUtils.encode(info);
+ String resJson = shopService.post(SPU_UPDATE_URL, reqJson);
+ return ResponseUtils.decode(resJson, SpuUpdateResponse.class);
+ }
+
@Override
public SpuUpdateResponse addProduct(SpuInfo info) throws WxErrorException {
String reqJson = JsonUtils.encode(info);
@@ -63,6 +90,13 @@ public SpuUpdateResponse updateProduct(SpuInfo info) throws WxErrorException {
return ResponseUtils.decode(resJson, SpuUpdateResponse.class);
}
+ @Override
+ public WxChannelBaseResponse updateProductAuditFree(SpuFastInfo info) throws WxErrorException {
+ String reqJson = JsonUtils.encode(info);
+ String resJson = shopService.post(SPU_AUDIT_FREE_UPDATE_URL, reqJson);
+ return ResponseUtils.decode(resJson, SpuUpdateResponse.class);
+ }
+
@Override
public WxChannelBaseResponse updateStock(String productId, String skuId, Integer diffType, Integer num)
throws WxErrorException {
@@ -148,6 +182,35 @@ public SkuStockResponse getSkuStock(String productId, String skuId) throws WxErr
return ResponseUtils.decode(resJson, SkuStockResponse.class);
}
+ @Override
+ public SkuStockBatchResponse getSkuStockBatch(List productIds) throws WxErrorException {
+ SkuStockBatchParam param = new SkuStockBatchParam(productIds);
+ String reqJson = JsonUtils.encode(param);
+ String resJson = shopService.post(SPU_GET_STOCK_BATCH_URL, reqJson);
+ return ResponseUtils.decode(resJson, SkuStockBatchResponse.class);
+ }
+
+ @Override
+ public ProductH5UrlResponse getProductH5Url(String productId) throws WxErrorException {
+ String reqJson = "{\"product_id\":\"" + productId + "\"}";
+ String resJson = shopService.post(SPU_H5URL_URL, reqJson);
+ return ResponseUtils.decode(resJson, ProductH5UrlResponse.class);
+ }
+
+ @Override
+ public ProductQrCodeResponse getProductQrCode(String productId) throws WxErrorException {
+ String reqJson = "{\"product_id\":\"" + productId + "\"}";
+ String resJson = shopService.post(SPU_QRCODE_URL, reqJson);
+ return ResponseUtils.decode(resJson, ProductQrCodeResponse.class);
+ }
+
+ @Override
+ public ProductTagLinkResponse getProductTagLink(String productId) throws WxErrorException {
+ String reqJson = "{\"product_id\":\"" + productId + "\"}";
+ String resJson = shopService.post(SPU_TAGLINK_URL, reqJson);
+ return ResponseUtils.decode(resJson, ProductTagLinkResponse.class);
+ }
+
@Override
public LimitTaskAddResponse addLimitTask(LimitTaskParam param) throws WxErrorException {
String reqJson = JsonUtils.encode(param);
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/WxChannelServiceHttpClientImpl.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/WxChannelServiceHttpClientImpl.java
index e0cb767619..d4b5afde0c 100644
--- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/WxChannelServiceHttpClientImpl.java
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/WxChannelServiceHttpClientImpl.java
@@ -5,22 +5,20 @@
import java.io.IOException;
import lombok.extern.slf4j.Slf4j;
-import me.chanjar.weixin.channel.api.WxChannelVipService;
-import me.chanjar.weixin.channel.bean.token.StableToken;
+import me.chanjar.weixin.channel.bean.token.StableTokenParam;
import me.chanjar.weixin.channel.config.WxChannelConfig;
import me.chanjar.weixin.channel.util.JsonUtils;
-import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.common.util.http.HttpType;
import me.chanjar.weixin.common.util.http.apache.ApacheHttpClientBuilder;
import me.chanjar.weixin.common.util.http.apache.DefaultApacheHttpClientBuilder;
import org.apache.commons.lang3.StringUtils;
-import org.apache.http.Consts;
import org.apache.http.HttpHost;
import org.apache.http.client.HttpClient;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.BasicResponseHandler;
import org.apache.http.impl.client.CloseableHttpClient;
@@ -33,19 +31,6 @@ public class WxChannelServiceHttpClientImpl extends BaseWxChannelServiceImpl {
private OkHttpClient httpClient;
private OkHttpProxyInfo httpProxy;
- private Boolean stabled = false;
- private Boolean forceRefresh = false;
- protected final Object globalAccessTokenRefreshLock = new Object();
- /**
- * 设置调用接口参数.
- *
- * @param stabled false 表示调用AccessToken接口, true调用稳定版接口
- * @param forceRefresh stabled=true使用, true表示强制刷新模式
- */
- public WxChannelServiceOkHttpImpl(Boolean stabled, Boolean forceRefresh) {
- this.stabled = stabled;
- this.forceRefresh = forceRefresh;
+ public WxChannelServiceOkHttpImpl() {
}
@Override
@@ -79,76 +70,40 @@ public HttpType getRequestType() {
}
@Override
- protected String doGetAccessTokenRequest() throws WxErrorException {
- if (stabled) {
- return internalGetStableAccessToken(this.forceRefresh);
- } else{
- return internalGetAccessToken(forceRefresh);
- }
- }
-
- public String internalGetStableAccessToken(boolean forceRefresh) throws WxErrorException {
- if (!this.config.isAccessTokenExpired() && !forceRefresh) {
- return this.config.getAccessToken();
- } else {
- synchronized(this.globalAccessTokenRefreshLock) {
- OkHttpClient client = this.getRequestHttpClient();
-
- String url = String.format(GET_STABLE_ACCESS_TOKEN_URL, config.getAppid(), config.getSecret());
+ protected String doGetAccessTokenRequest() throws IOException {
+ WxChannelConfig config = this.getConfig();
+ String url = StringUtils.isNotEmpty(config.getAccessTokenUrl()) ? config.getAccessTokenUrl() :
+ StringUtils.isNotEmpty(config.getApiHostUrl()) ?
+ GET_ACCESS_TOKEN_URL.replace("https://api.weixin.qq.com", config.getApiHostUrl()) : GET_ACCESS_TOKEN_URL;
- StableToken stableToken = new StableToken("client_credential", config.getAppid(),config.getSecret(), forceRefresh);
+ url = String.format(url, config.getAppid(), config.getSecret());
- RequestBody body = RequestBody.Companion.create(JsonUtils.encode(stableToken), MediaType.parse("application/json; charset=utf-8"));
-
- Request request = (new Request.Builder()).url(url).post(body).build();
- String resultContent = null;
- try {
- Response response = client.newCall(request).execute();
- resultContent = response.body().string();
- } catch (IOException var9) {
- log.error(var9.getMessage(), var9);
- }
-
- WxError error = WxError.fromJson(resultContent, WxType.CP);
- if (error.getErrorCode() != 0) {
- throw new WxErrorException(error);
- }
-
- WxAccessToken accessToken = WxAccessToken.fromJson(resultContent);
- this.config.updateAccessToken(accessToken.getAccessToken(), accessToken.getExpiresIn());
- }
- return this.config.getAccessToken();
+ Request request = new Request.Builder().url(url).get().build();
+ try (Response response = getRequestHttpClient().newCall(request).execute()) {
+ return Objects.requireNonNull(response.body()).string();
}
}
- public String internalGetAccessToken(boolean forceRefresh) throws WxErrorException {
- if (!this.config.isAccessTokenExpired() && !forceRefresh) {
- return this.config.getAccessToken();
- } else {
- synchronized(this.globalAccessTokenRefreshLock) {
- OkHttpClient client = this.getRequestHttpClient();
-
- String url = String.format(GET_ACCESS_TOKEN_URL, config.getAppid(), config.getSecret());
-
- Request request = (new Request.Builder()).url(url).get().build();
-
- String resultContent = null;
- try {
- Response response = client.newCall(request).execute();
- resultContent = response.body().string();
- } catch (IOException var9) {
- log.error(var9.getMessage(), var9);
- }
-
- WxError error = WxError.fromJson(resultContent, WxType.CP);
- if (error.getErrorCode() != 0) {
- throw new WxErrorException(error);
- }
-
- WxAccessToken accessToken = WxAccessToken.fromJson(resultContent);
- this.config.updateAccessToken(accessToken.getAccessToken(), accessToken.getExpiresIn());
- }
- return this.config.getAccessToken();
+ @Override
+ protected String doGetStableAccessTokenRequest(boolean forceRefresh) throws IOException {
+ WxChannelConfig config = this.getConfig();
+ String url = StringUtils.isNotEmpty(config.getAccessTokenUrl()) ?
+ config.getAccessTokenUrl() : StringUtils.isNotEmpty(config.getApiHostUrl()) ?
+ GET_STABLE_ACCESS_TOKEN_URL.replace("https://api.weixin.qq.com", config.getApiHostUrl()) :
+ GET_STABLE_ACCESS_TOKEN_URL;
+
+ StableTokenParam requestParam = new StableTokenParam();
+ requestParam.setAppId(config.getAppid());
+ requestParam.setSecret(config.getSecret());
+ requestParam.setGrantType("client_credential");
+ requestParam.setForceRefresh(forceRefresh);
+ String requestJson = JsonUtils.encode(requestParam);
+ assert requestJson != null;
+
+ RequestBody body = RequestBody.Companion.create(requestJson, MediaType.parse("application/json; charset=utf-8"));
+ Request request = new Request.Builder().url(url).post(body).build();
+ try (Response response = getRequestHttpClient().newCall(request).execute()) {
+ return Objects.requireNonNull(response.body()).string();
}
}
}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/WxChannelVipServiceImpl.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/WxChannelVipServiceImpl.java
index 1bad47593d..c06e7ff7a4 100644
--- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/WxChannelVipServiceImpl.java
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/WxChannelVipServiceImpl.java
@@ -18,51 +18,51 @@
@Slf4j
public class WxChannelVipServiceImpl implements WxChannelVipService {
- private BaseWxChannelServiceImpl vipHttpService;
+ private BaseWxChannelServiceImpl shopService;
- public WxChannelVipServiceImpl(BaseWxChannelServiceImpl vipHttpService) {
- this.vipHttpService = vipHttpService;
+ public WxChannelVipServiceImpl(BaseWxChannelServiceImpl shopService) {
+ this.shopService = shopService;
}
@Override
public VipInfoResponse getVipInfo(String openId, Boolean needPhoneNumber) throws WxErrorException {
VipInfoParam param = new VipInfoParam(openId, needPhoneNumber);
- String respJson = vipHttpService.post(VIP_USER_INFO_URL, param);
+ String respJson = shopService.post(VIP_USER_INFO_URL, param);
return ResponseUtils.decode(respJson, VipInfoResponse.class);
}
@Override
- public VipListResponse getVipList(Boolean needPhoneNumber, Integer pageNum, Integer PageSize) throws WxErrorException {
- VipListParam param = new VipListParam(needPhoneNumber, pageNum, PageSize);
- String respJson = vipHttpService.post(VIP_USER_LIST_URL, param);
+ public VipListResponse getVipList(Boolean needPhoneNumber, Integer pageNum, Integer pageSize) throws WxErrorException {
+ VipListParam param = new VipListParam(needPhoneNumber, pageNum, pageSize);
+ String respJson = shopService.post(VIP_USER_LIST_URL, param);
return ResponseUtils.decode(respJson, VipListResponse.class);
}
@Override
public VipScoreResponse getVipScore(String openId) throws WxErrorException {
- VipParam param = new VipParam(openId);
- String respJson = vipHttpService.post(VIP_SCORE_URL, param);
+ VipOpenIdParam param = new VipOpenIdParam(openId);
+ String respJson = shopService.post(VIP_SCORE_URL, param);
return ResponseUtils.decode(respJson, VipScoreResponse.class);
}
@Override
public WxChannelBaseResponse increaseVipScore(String openId, String score, String remark, String requestId) throws WxErrorException {
VipScoreParam param = new VipScoreParam(openId, score, remark, requestId);
- String respJson = vipHttpService.post(SCORE_INCREASE_URL, param);
+ String respJson = shopService.post(SCORE_INCREASE_URL, param);
return ResponseUtils.decode(respJson, WxChannelBaseResponse.class);
}
@Override
public WxChannelBaseResponse decreaseVipScore(String openId, String score, String remark, String requestId) throws WxErrorException {
VipScoreParam param = new VipScoreParam(openId, score, remark, requestId);
- String respJson = vipHttpService.post(SCORE_DECREASE_URL, param);
+ String respJson = shopService.post(SCORE_DECREASE_URL, param);
return ResponseUtils.decode(respJson, WxChannelBaseResponse.class);
}
@Override
public WxChannelBaseResponse updateVipGrade(String openId, Integer score) throws WxErrorException {
VipGradeParam param = new VipGradeParam(openId, score);
- String respJson = vipHttpService.post(GRADE_UPDATE_URL, param);
+ String respJson = shopService.post(GRADE_UPDATE_URL, param);
return ResponseUtils.decode(respJson, WxChannelBaseResponse.class);
}
}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/WxStoreHomePageServiceImpl.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/WxStoreHomePageServiceImpl.java
new file mode 100644
index 0000000000..b5f3038e98
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/WxStoreHomePageServiceImpl.java
@@ -0,0 +1,164 @@
+package me.chanjar.weixin.channel.api.impl;
+
+import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.HomePage.*;
+
+
+import lombok.extern.slf4j.Slf4j;
+import me.chanjar.weixin.channel.api.WxStoreHomePageService;
+import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
+import me.chanjar.weixin.channel.bean.home.background.BackgroundApplyResponse;
+import me.chanjar.weixin.channel.bean.home.background.BackgroundGetResponse;
+import me.chanjar.weixin.channel.bean.home.banner.BannerApplyParam;
+import me.chanjar.weixin.channel.bean.home.banner.BannerApplyResponse;
+import me.chanjar.weixin.channel.bean.home.banner.BannerGetResponse;
+import me.chanjar.weixin.channel.bean.home.banner.BannerInfo;
+import me.chanjar.weixin.channel.bean.home.tree.TreeProductEditInfo;
+import me.chanjar.weixin.channel.bean.home.tree.TreeProductEditParam;
+import me.chanjar.weixin.channel.bean.home.tree.TreeProductListInfo;
+import me.chanjar.weixin.channel.bean.home.tree.TreeProductListParam;
+import me.chanjar.weixin.channel.bean.home.tree.TreeProductListResponse;
+import me.chanjar.weixin.channel.bean.home.tree.TreeShowGetResponse;
+import me.chanjar.weixin.channel.bean.home.tree.TreeShowInfo;
+import me.chanjar.weixin.channel.bean.home.tree.TreeShowParam;
+import me.chanjar.weixin.channel.bean.home.tree.TreeShowSetResponse;
+import me.chanjar.weixin.channel.bean.home.window.WindowProductIndexParam;
+import me.chanjar.weixin.channel.bean.home.window.WindowProductListParam;
+import me.chanjar.weixin.channel.bean.home.window.WindowProductSetting;
+import me.chanjar.weixin.channel.bean.home.window.WindowProductSettingResponse;
+import me.chanjar.weixin.channel.util.ResponseUtils;
+import me.chanjar.weixin.common.error.WxErrorException;
+
+/**
+ * 微信小店 主页管理相关接口
+ *
+ * @author Zeyes
+ */
+@Slf4j
+public class WxStoreHomePageServiceImpl implements WxStoreHomePageService {
+
+ /** 微信小店服务 */
+ private final BaseWxChannelServiceImpl storeService;
+
+ public WxStoreHomePageServiceImpl(BaseWxChannelServiceImpl storeService) {
+ this.storeService = storeService;
+ }
+
+
+ @Override
+ public WxChannelBaseResponse addTreeProduct(TreeProductEditInfo info) throws WxErrorException {
+ TreeProductEditParam param = new TreeProductEditParam(info);
+ String resJson = storeService.post(ADD_TREE_PRODUCT_URL, param);
+ return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
+ }
+
+ @Override
+ public WxChannelBaseResponse delTreeProduct(TreeProductEditInfo info) throws WxErrorException {
+ TreeProductEditParam param = new TreeProductEditParam(info);
+ String resJson = storeService.post(DEL_TREE_PRODUCT_URL, param);
+ return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
+ }
+
+ @Override
+ public TreeProductListResponse getTreeProductList(TreeProductListInfo info) throws WxErrorException {
+ TreeProductListParam param = new TreeProductListParam(info);
+ String resJson = storeService.post(LIST_TREE_PRODUCT_URL, param);
+ return ResponseUtils.decode(resJson, TreeProductListResponse.class);
+ }
+
+ @Override
+ public TreeShowSetResponse setShowTree(TreeShowInfo info) throws WxErrorException {
+ TreeShowParam param = new TreeShowParam(info);
+ String resJson = storeService.post(SET_SHOW_TREE_URL, param);
+ return ResponseUtils.decode(resJson, TreeShowSetResponse.class);
+ }
+
+ @Override
+ public TreeShowGetResponse getShowTree() throws WxErrorException {
+ String resJson = storeService.post(GET_SHOW_TREE_URL, "");
+ return ResponseUtils.decode(resJson, TreeShowGetResponse.class);
+ }
+
+ @Override
+ public WindowProductSettingResponse listWindowProduct(Integer pageSize, String nextKey) throws WxErrorException {
+ WindowProductListParam param = new WindowProductListParam(pageSize, nextKey);
+ String resJson = storeService.post(LIST_WINDOW_PRODUCT_URL, param);
+ return ResponseUtils.decode(resJson, WindowProductSettingResponse.class);
+ }
+
+ @Override
+ public WxChannelBaseResponse reorderWindowProduct(String productId, Integer indexNum) throws WxErrorException {
+ WindowProductIndexParam param = new WindowProductIndexParam(productId, indexNum);
+ String resJson = storeService.post(REORDER_WINDOW_PRODUCT_URL, param);
+ return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
+ }
+
+ @Override
+ public WxChannelBaseResponse hideWindowProduct(String productId, Integer setHide) throws WxErrorException {
+ WindowProductSetting param = new WindowProductSetting();
+ param.setProductId(productId);
+ param.setSetHide(setHide);
+ String resJson = storeService.post(HIDE_WINDOW_PRODUCT_URL, param);
+ return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
+ }
+
+ @Override
+ public WxChannelBaseResponse topWindowProduct(String productId, Integer setTop) throws WxErrorException {
+ WindowProductSetting param = new WindowProductSetting();
+ param.setProductId(productId);
+ param.setSetTop(setTop);
+ String resJson = storeService.post(TOP_WINDOW_PRODUCT_URL, param);
+ return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
+ }
+
+ @Override
+ public BackgroundApplyResponse applyBackground(String imgUrl) throws WxErrorException {
+ String paramJson = "{\"img_url\":\"" + imgUrl + "\"}";
+ String resJson = storeService.post(APPLY_BACKGROUND_URL, paramJson);
+ return ResponseUtils.decode(resJson, BackgroundApplyResponse.class);
+ }
+
+ @Override
+ public BackgroundGetResponse getBackground() throws WxErrorException {
+ String resJson = storeService.post(GET_BACKGROUND_URL, "");
+ return ResponseUtils.decode(resJson, BackgroundGetResponse.class);
+ }
+
+ @Override
+ public WxChannelBaseResponse cancelBackground(Integer applyId) throws WxErrorException {
+ String paramJson = "{\"apply_id\":" + applyId + "}";
+ String resJson = storeService.post(CANCEL_BACKGROUND_URL, paramJson);
+ return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
+ }
+
+ @Override
+ public WxChannelBaseResponse removeBackground() throws WxErrorException {
+ String resJson = storeService.post(REMOVE_BACKGROUND_URL, "");
+ return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
+ }
+
+ @Override
+ public BannerApplyResponse applyBanner(BannerInfo info) throws WxErrorException {
+ BannerApplyParam param = new BannerApplyParam(info);
+ String resJson = storeService.post(APPLY_BANNER_URL, param);
+ return ResponseUtils.decode(resJson, BannerApplyResponse.class);
+ }
+
+ @Override
+ public BannerGetResponse getBanner() throws WxErrorException {
+ String resJson = storeService.post(GET_BANNER_URL, "");
+ return ResponseUtils.decode(resJson, BannerGetResponse.class);
+ }
+
+ @Override
+ public WxChannelBaseResponse cancelBanner(Integer applyId) throws WxErrorException {
+ String paramJson = "{\"apply_id\":" + applyId + "}";
+ String resJson = storeService.post(CANCEL_BANNER_URL, paramJson);
+ return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
+ }
+
+ @Override
+ public WxChannelBaseResponse removeBanner() throws WxErrorException {
+ String resJson = storeService.post(REMOVE_BANNER_URL, "");
+ return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
+ }
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/audit/CategoryAuditInfo.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/audit/CategoryAuditInfo.java
index 72a84bc922..485092704d 100644
--- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/audit/CategoryAuditInfo.java
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/audit/CategoryAuditInfo.java
@@ -1,5 +1,6 @@
package me.chanjar.weixin.channel.bean.audit;
+import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
import java.util.List;
@@ -15,6 +16,7 @@
@Data
@NoArgsConstructor
@AllArgsConstructor
+@JsonInclude(JsonInclude.Include.NON_NULL)
public class CategoryAuditInfo implements Serializable {
private static final long serialVersionUID = -8792967130645424788L;
@@ -31,7 +33,47 @@ public class CategoryAuditInfo implements Serializable {
@JsonProperty("level3")
private Long level3;
- /** 资质材料,图片url,图片类型,最多不超过10张 */
+ /** 新类目树类目ID */
+ @JsonProperty("cats_v2")
+ private List catsV2;
+
+ /** 资质材料,图片fileid,图片类型,最多不超过10张 */
@JsonProperty("certificate")
private List certificates;
+
+ /** 报备函,图片fileid,图片类型,最多不超过10张 */
+ @JsonProperty("baobeihan")
+ private List baobeihan;
+
+ /** 经营证明,图片fileid,图片类型,最多不超过10张 */
+ @JsonProperty("jingyingzhengming")
+ private List jingyingzhengming;
+
+ /** 带货口碑,图片fileid,图片类型,最多不超过10张 */
+ @JsonProperty("daihuokoubei")
+ private List daihuokoubei;
+
+ /** 入住资质,图片fileid,图片类型,最多不超过10张 */
+ @JsonProperty("ruzhuzhizhi")
+ private List ruzhuzhizhi;
+
+ /** 经营流水,图片fileid,图片类型,最多不超过10张 */
+ @JsonProperty("jingyingliushui")
+ private List jingyingliushui;
+
+ /** 补充材料,图片fileid,图片类型,最多不超过10张 */
+ @JsonProperty("buchongcailiao")
+ private List buchongcailiao;
+
+ /** 经营平台,仅支持taobao,jd,douyin,kuaishou,pdd,other这些取值 */
+ @JsonProperty("jingyingpingtai")
+ private String jingyingpingtai;
+
+ /** 账号名称 */
+ @JsonProperty("zhanghaomingcheng")
+ private String zhanghaomingcheng;
+
+ /** 品牌列表,获取类目信息中的attr.is_limit_brand为true时必传 */
+ @JsonProperty("brand_list")
+ private List brandList;
}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/audit/CategoryBrand.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/audit/CategoryBrand.java
new file mode 100644
index 0000000000..632096e4d2
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/audit/CategoryBrand.java
@@ -0,0 +1,23 @@
+package me.chanjar.weixin.channel.bean.audit;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.Serializable;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 分类中的品牌
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class CategoryBrand implements Serializable {
+ private static final long serialVersionUID = -5437441266080209907L;
+
+ /** 品牌ID,是店铺申请且已审核通过的品牌ID */
+ @JsonProperty("brand_id")
+ private String brand_id;
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/audit/CatsV2.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/audit/CatsV2.java
new file mode 100644
index 0000000000..b7cc6f39bc
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/audit/CatsV2.java
@@ -0,0 +1,22 @@
+package me.chanjar.weixin.channel.bean.audit;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.Serializable;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 新类目树类目ID
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class CatsV2 implements Serializable {
+ private static final long serialVersionUID = -2484092110142035589L;
+
+ /** 新类目树类目ID */
+ @JsonProperty("cat_id")
+ private String catId;
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/category/CategoryDetailResult.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/category/CategoryDetailResult.java
index 8819e94312..a59559fb6c 100644
--- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/category/CategoryDetailResult.java
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/category/CategoryDetailResult.java
@@ -74,6 +74,34 @@ public static class Attr implements Serializable {
/** 佣金信息 */
@JsonProperty("transactionfee_info")
private FeeInfo feeInfo;
+
+ /** 折扣规则 */
+ @JsonProperty("coupon_rule")
+ private CouponRule couponRule;
+
+ /** 价格下限,单位分,商品售价不可低于此价格 */
+ @JsonProperty("floor_price")
+ private Long floorPrice;
+
+ /** 收货时间选项 */
+ @JsonProperty("confirm_receipt_days")
+ private List confirmReceiptDays;
+
+ /** 是否品牌定向准入,即该类目一定要有品牌 */
+ @JsonProperty("is_limit_brand")
+ private Boolean limitBrand;
+
+ /** 商品编辑要求 */
+ @JsonProperty("product_requirement")
+ private ProductRequirement productRequirement;
+
+ /** 尺码表 */
+ @JsonProperty("size_chart")
+ private SizeChart sizeChart;
+
+ /** 资质信息 */
+ @JsonProperty("product_qua_list")
+ private List productQuaList;
}
@Data
@@ -93,11 +121,27 @@ public static class ProductAttr implements Serializable {
@JsonProperty("name")
private String name;
- /** 类目必填项类型,string为自定义,select_one为多选一 */
+ /** 属性类型,string为自定义,select_one为多选一,该参数短期保留,用于兼容。将来废弃,使用type_v2替代 */
@JsonProperty("type")
private String type;
- /** 类目必填项值 */
+ /**
+ * 属性类型v2,共7种类型
+ * string:文本
+ * select_one:单选,选项列表在value中
+ * select_many:多选,选项列表在value中
+ * integer:整数,数字必须为整数
+ * decimal4:小数(4 位精度),小数部分最多 4 位
+ * integer_unit:整数 + 单位,单位的选项列表在value中
+ * decimal4_unit:小数(4 位精度) + 单位,单位的选项列表在value中
+ */
+ @JsonProperty("type_v2")
+ private String typeV2;
+
+ /**
+ * 可选项列表,当type为:select_one/select_many时,为选项列表
+ * 当type为:integer_unit/decimal4_unit时,为单位的列表
+ */
@JsonProperty("value")
private String value;
@@ -105,7 +149,13 @@ public static class ProductAttr implements Serializable {
@JsonProperty("is_required")
private Boolean required;
+ /** 输入提示,请填写提示语 */
+ @JsonProperty("hint")
+ private String hint;
+ /** 允许添加选项,当type为select_one/select_many时,标识是否允许添加新选项(value中不存在的选项) */
+ @JsonProperty("append_allowed")
+ private Boolean appendAllowed;
}
@Data
@@ -123,8 +173,78 @@ public static class FeeInfo implements Serializable {
/** 佣金激励类型,0:无激励措施,1:新店佣金减免 */
@JsonProperty("incentive_type")
private Integer incentiveType;
+ }
+
+ @Data
+ @NoArgsConstructor
+ public static class CouponRule implements Serializable {
+
+ /** 最高的折扣比例,百分比, 0表示无限制 */
+ @JsonProperty("discount_ratio_limit")
+ private Integer supportCoupon;
+
+ /** 最高的折扣金额,单位分,0表示无限制 */
+ @JsonProperty("discount_limit")
+ private Integer couponType;
+ }
+
+ @Data
+ @NoArgsConstructor
+ public static class ProductRequirement implements Serializable {
+ /** 商品标题的编辑要求 */
+ @JsonProperty("product_title_requirement")
+ private String productTitleRequirement;
+
+ /** 商品主图的编辑要求 */
+ @JsonProperty("product_img_requirement")
+ private String productImgRequirement;
+
+ /** 商品描述的编辑要求 */
+ @JsonProperty("product_desc_requirement")
+ private String productDescRequirement;
+ }
+
+ @Data
+ @NoArgsConstructor
+ public static class SizeChart implements Serializable {
+
+ /** 是否支持尺码表 */
+ @JsonProperty("is_support")
+ private Boolean support;
+ /** 尺码配置要求列表 */
+ @JsonProperty("item_list")
+ private List itemList;
}
+
+ @Data
+ @NoArgsConstructor
+ public static class SizeChartItem implements Serializable {
+ /** 尺码属性名称 */
+ @JsonProperty("name")
+ private String name;
+
+ /** 尺码属性值的单位 */
+ @JsonProperty("unit")
+ private String unit;
+
+ /** 尺码属性值的类型,1:字符型,2:整数型,3:小数型 */
+ @JsonProperty("type")
+ private String type;
+
+ /** 尺码属性值的填写格式,1:单值填写,2:区间值填写,3:支持单值或区间值 */
+ @JsonProperty("format")
+ private String format;
+
+ /** 尺码属性值的限制 */
+ @JsonProperty("limit")
+ private String limit;
+
+ /** 是否必填 */
+ @JsonProperty("is_required")
+ private Boolean required;
+ }
+
}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/category/CategoryQualification.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/category/CategoryQualification.java
index f384eaae45..40258e067f 100644
--- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/category/CategoryQualification.java
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/category/CategoryQualification.java
@@ -2,6 +2,7 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
+import java.util.List;
import lombok.Data;
import lombok.NoArgsConstructor;
@@ -24,8 +25,18 @@ public class CategoryQualification implements Serializable {
@JsonProperty("qua")
private QualificationInfo info;
- /** 商品资质信息 */
+ /** 商品资质信息,将废弃,使用product_qua_list代替 */
@JsonProperty("product_qua")
+ @Deprecated
private QualificationInfo productInfo;
+ /** 品牌资质信息 */
+ @JsonProperty("brand_qua")
+ @Deprecated
+ private QualificationInfo brandQua;
+
+ /** 商品资质列表,替代product_qua */
+ @JsonProperty("product_qua_list")
+ private List productQuaList;
+
}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/category/CategoryQualificationResponse.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/category/CategoryQualificationResponse.java
index 984a3ad79b..cbd588ebf9 100644
--- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/category/CategoryQualificationResponse.java
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/category/CategoryQualificationResponse.java
@@ -22,4 +22,7 @@ public class CategoryQualificationResponse extends WxChannelBaseResponse {
@JsonProperty("cats")
private List list;
+ @JsonProperty("cats_v2")
+ private List catsV2;
+
}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/category/QualificationInfo.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/category/QualificationInfo.java
index 197ac46528..efb7249fe3 100644
--- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/category/QualificationInfo.java
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/category/QualificationInfo.java
@@ -29,4 +29,8 @@ public class QualificationInfo implements Serializable {
/** 该类目申请的时候是否一定要提交资质 */
@JsonProperty("mandatory")
private Boolean mandatory;
+
+ /** 资质名称 */
+ @JsonProperty("name")
+ private String name;
}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/category/ShopCategory.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/category/ShopCategory.java
index b36edfa9e2..5dd04582f3 100644
--- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/category/ShopCategory.java
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/category/ShopCategory.java
@@ -29,4 +29,8 @@ public class ShopCategory implements Serializable {
/** 层级 */
@JsonProperty("level")
private Integer level;
+
+ /** 是否为叶子类目(品类) */
+ @JsonProperty("leaf")
+ private Boolean leaf;
}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/category/ShopCategoryResponse.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/category/ShopCategoryResponse.java
index 2af64ad1c3..fff7362a7a 100644
--- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/category/ShopCategoryResponse.java
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/category/ShopCategoryResponse.java
@@ -23,5 +23,7 @@ public class ShopCategoryResponse extends WxChannelBaseResponse {
@JsonProperty("cat_list")
private List categories;
-
+ /** 类目列表 */
+ @JsonProperty("cat_list_v2")
+ private List catListV2;
}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/delivery/FreshInspectParam.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/delivery/FreshInspectParam.java
new file mode 100644
index 0000000000..a6db90f2f9
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/delivery/FreshInspectParam.java
@@ -0,0 +1,31 @@
+package me.chanjar.weixin.channel.bean.delivery;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.Serializable;
+import java.util.List;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 商品打包信息 参数
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@JsonInclude(Include.NON_NULL)
+public class FreshInspectParam implements Serializable {
+ private static final long serialVersionUID = -1635894867602084789L;
+
+ /** 订单ID */
+ @JsonProperty("order_id")
+ private String orderId;
+
+ /** 商品打包信息 */
+ @JsonProperty("audit_items")
+ private List auditItems;
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/delivery/PackageAuditInfo.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/delivery/PackageAuditInfo.java
new file mode 100644
index 0000000000..bbb4e6c484
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/delivery/PackageAuditInfo.java
@@ -0,0 +1,32 @@
+package me.chanjar.weixin.channel.bean.delivery;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.Serializable;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import me.chanjar.weixin.channel.enums.PackageAuditItemType;
+
+/**
+ * 商品打包信息
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class PackageAuditInfo implements Serializable {
+ private static final long serialVersionUID = 1118087167138310282L;
+
+ /**
+ * 审核项名称,枚举类型参考 {@link PackageAuditItemType}
+ * 使用方法:DeliveryAuditItemType.EXPRESS_PIC.getKey()
+ */
+ @JsonProperty("item_name")
+ private String itemName;
+
+ /** 图片/视频url */
+ @JsonProperty("item_value")
+ private String itemValue;
+
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/background/BackgroundApplyResponse.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/background/BackgroundApplyResponse.java
new file mode 100644
index 0000000000..b0d8769874
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/background/BackgroundApplyResponse.java
@@ -0,0 +1,25 @@
+package me.chanjar.weixin.channel.bean.home.background;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
+
+/**
+ * 提交背景图申请 结果
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+@EqualsAndHashCode(callSuper = true)
+public class BackgroundApplyResponse extends WxChannelBaseResponse {
+
+ private static final long serialVersionUID = -5627456997199822109L;
+
+ /** 申请编号 */
+ @JsonProperty("apply_id")
+ private Integer applyId;
+
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/background/BackgroundApplyResult.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/background/BackgroundApplyResult.java
new file mode 100644
index 0000000000..45ca4ac1dd
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/background/BackgroundApplyResult.java
@@ -0,0 +1,35 @@
+package me.chanjar.weixin.channel.bean.home.background;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 背景图审核信息
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+public class BackgroundApplyResult implements Serializable {
+
+ private static final long serialVersionUID = 3154900058221168732L;
+
+ /** 申请编号 */
+ @JsonProperty("apply_id")
+ private Integer applyId;
+
+ /** 申请状态。1审核中 2审核驳回 */
+ @JsonProperty("state")
+ private Integer state;
+
+ /** 审核结果描述。state为审核驳回时有值。 */
+ @JsonProperty("audit_desc")
+ private String auditDesc;
+
+ /** 图片url */
+ @JsonProperty("img_url")
+ private String imgUrl;
+
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/background/BackgroundGetResponse.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/background/BackgroundGetResponse.java
new file mode 100644
index 0000000000..a0fbf33a80
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/background/BackgroundGetResponse.java
@@ -0,0 +1,28 @@
+package me.chanjar.weixin.channel.bean.home.background;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
+
+/**
+ * 背景图返回结果
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+@EqualsAndHashCode(callSuper = true)
+public class BackgroundGetResponse extends WxChannelBaseResponse {
+
+ private static final long serialVersionUID = -9158761351220981959L;
+
+ /** 当前生效的背景图片url */
+ @JsonProperty("img_url")
+ private String imgUrl;
+
+ /** 背景图审核信息 */
+ @JsonProperty("apply")
+ private BackgroundApplyResult apply;
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/banner/BannerApplyDetail.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/banner/BannerApplyDetail.java
new file mode 100644
index 0000000000..e9e58057fd
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/banner/BannerApplyDetail.java
@@ -0,0 +1,33 @@
+package me.chanjar.weixin.channel.bean.home.banner;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 精选展示位申请详情
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+@JsonInclude(Include.NON_NULL)
+public class BannerApplyDetail implements Serializable {
+
+ private static final long serialVersionUID = -4622897527243343862L;
+
+ /** 审核状态。 1-审核中;2-审核驳回 */
+ @JsonProperty("audit_state")
+ private Integer auditState;
+
+ /** 审核结果描述。audit_state为驳回时有值。 */
+ @JsonProperty("audit_desc")
+ private String auditDesc;
+
+ /** 精选展示位申请明细 */
+ @JsonProperty("banner")
+ private BannerItem banner;
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/banner/BannerApplyInfo.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/banner/BannerApplyInfo.java
new file mode 100644
index 0000000000..651c5c76fe
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/banner/BannerApplyInfo.java
@@ -0,0 +1,35 @@
+package me.chanjar.weixin.channel.bean.home.banner;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.Serializable;
+import java.util.List;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 精选展示位申请信息
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+public class BannerApplyInfo implements Serializable {
+
+ private static final long serialVersionUID = 72190625450999960L;
+
+ /** 申请编号 */
+ @JsonProperty("apply_id")
+ private Integer applyId;
+
+ /** 申请状态 1-审核中;2-审核驳回 */
+ @JsonProperty("state")
+ private Integer state;
+
+ /** 展示位的展示样式 1-小图模式;2-大图模式 */
+ @JsonProperty("scale")
+ private Integer scale;
+
+ /** 精选展示位申请明细 */
+ @JsonProperty("banner")
+ private List banner;
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/banner/BannerApplyParam.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/banner/BannerApplyParam.java
new file mode 100644
index 0000000000..04c7abc2a7
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/banner/BannerApplyParam.java
@@ -0,0 +1,28 @@
+package me.chanjar.weixin.channel.bean.home.banner;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.Serializable;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 精选展示位申请参数
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@JsonInclude(Include.NON_NULL)
+public class BannerApplyParam implements Serializable {
+
+ private static final long serialVersionUID = 9083668032979490150L;
+
+ /** banner */
+ @JsonProperty("banner")
+ private BannerInfo banner;
+
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/banner/BannerApplyResponse.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/banner/BannerApplyResponse.java
new file mode 100644
index 0000000000..f83f119d13
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/banner/BannerApplyResponse.java
@@ -0,0 +1,25 @@
+package me.chanjar.weixin.channel.bean.home.banner;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
+
+/**
+ * 提交精选展位申请 结果
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+@EqualsAndHashCode(callSuper = true)
+public class BannerApplyResponse extends WxChannelBaseResponse {
+
+ private static final long serialVersionUID = -2194587734444499201L;
+
+ /** 申请编号 */
+ @JsonProperty("apply_id")
+ private Integer applyId;
+
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/banner/BannerGetResponse.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/banner/BannerGetResponse.java
new file mode 100644
index 0000000000..1c6a920636
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/banner/BannerGetResponse.java
@@ -0,0 +1,28 @@
+package me.chanjar.weixin.channel.bean.home.banner;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
+
+/**
+ * 精选展位返回结果
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+@EqualsAndHashCode(callSuper = true)
+public class BannerGetResponse extends WxChannelBaseResponse {
+
+ private static final long serialVersionUID = -1563254921362215934L;
+
+ /** 当前生效的展示位 */
+ @JsonProperty("banner")
+ private BannerInfo banner;
+
+ /** 最近一次流程中的申请。不返回已生效或已撤销的申请 */
+ @JsonProperty("apply")
+ private BannerApplyInfo apply;
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/banner/BannerInfo.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/banner/BannerInfo.java
new file mode 100644
index 0000000000..24b501a97d
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/banner/BannerInfo.java
@@ -0,0 +1,31 @@
+package me.chanjar.weixin.channel.bean.home.banner;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.Serializable;
+import java.util.List;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 精选展示位
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+@JsonInclude(Include.NON_NULL)
+public class BannerInfo implements Serializable {
+
+ private static final long serialVersionUID = -2003175482038217418L;
+
+ /** 展示位的展示样式 1-小图模式;2-大图模式 */
+ @JsonProperty("scale")
+ private Integer scale;
+
+ /** 精选展示位明细 */
+ @JsonProperty("banner")
+ private List banner;
+
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/banner/BannerItem.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/banner/BannerItem.java
new file mode 100644
index 0000000000..9a5cad9649
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/banner/BannerItem.java
@@ -0,0 +1,41 @@
+package me.chanjar.weixin.channel.bean.home.banner;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 精选展示位明细
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+@JsonInclude(Include.NON_NULL)
+public class BannerItem implements Serializable {
+
+ private static final long serialVersionUID = 6982412458700854481L;
+
+ /** 展示位类型 1-商品 3-视频号 4-公众号 {@link me.chanjar.weixin.channel.enums.BannerType} */
+ @JsonProperty("type")
+ private Integer type;
+
+ /** 展示位信息 */
+ @JsonProperty("banner")
+ private BannerItemDetail banner;
+
+ /** 商品 */
+ @JsonProperty("product")
+ private BannerItemProduct product;
+
+ /** 视频号 */
+ @JsonProperty("finder")
+ private BannerItemFinder finder;
+
+ /** 公众号 */
+ @JsonProperty("official_account")
+ private BannerItemOfficialAccount officialAccount;
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/banner/BannerItemDetail.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/banner/BannerItemDetail.java
new file mode 100644
index 0000000000..b5cfb4a38c
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/banner/BannerItemDetail.java
@@ -0,0 +1,33 @@
+package me.chanjar.weixin.channel.bean.home.banner;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 精选展示位明细中的明细
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+@JsonInclude(Include.NON_NULL)
+public class BannerItemDetail implements Serializable {
+
+ private static final long serialVersionUID = 5975434996207526173L;
+
+ /** 图片url */
+ @JsonProperty("img_url")
+ private String imgUrl;
+
+ /** 标题 */
+ @JsonProperty("title")
+ private String title;
+
+ /** 描述 */
+ @JsonProperty("description")
+ private String description;
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/banner/BannerItemFinder.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/banner/BannerItemFinder.java
new file mode 100644
index 0000000000..735a2038da
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/banner/BannerItemFinder.java
@@ -0,0 +1,29 @@
+package me.chanjar.weixin.channel.bean.home.banner;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 精选展示位明细中的视频号数据
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+@JsonInclude(Include.NON_NULL)
+public class BannerItemFinder implements Serializable {
+
+ private static final long serialVersionUID = -7397790079913284012L;
+
+ /** 视频号ID */
+ @JsonProperty("finder_user_name")
+ private String finderUserName;
+
+ /** 视频号视频的唯一标识 */
+ @JsonProperty("feed_id")
+ private String feedId;
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/banner/BannerItemOfficialAccount.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/banner/BannerItemOfficialAccount.java
new file mode 100644
index 0000000000..0488829642
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/banner/BannerItemOfficialAccount.java
@@ -0,0 +1,25 @@
+package me.chanjar.weixin.channel.bean.home.banner;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 精选展示位明细中的公众号数据
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+@JsonInclude(Include.NON_NULL)
+public class BannerItemOfficialAccount implements Serializable {
+
+ private static final long serialVersionUID = -5596947592282082891L;
+
+ /** 公众号文章url */
+ @JsonProperty("url")
+ private String url;
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/banner/BannerItemProduct.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/banner/BannerItemProduct.java
new file mode 100644
index 0000000000..87a51823f0
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/banner/BannerItemProduct.java
@@ -0,0 +1,25 @@
+package me.chanjar.weixin.channel.bean.home.banner;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 精选展示位明细中的商品
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+@JsonInclude(Include.NON_NULL)
+public class BannerItemProduct implements Serializable {
+
+ private static final long serialVersionUID = 8034487065591522594L;
+
+ /** 商品id */
+ @JsonProperty("product_id")
+ private Long productId;
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/CatTreeNode.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/CatTreeNode.java
new file mode 100644
index 0000000000..fda794428c
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/CatTreeNode.java
@@ -0,0 +1,32 @@
+package me.chanjar.weixin.channel.bean.home.tree;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.Serializable;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 主页分类信息
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class CatTreeNode implements Serializable {
+
+ private static final long serialVersionUID = 3154219180098003510L;
+
+ /** 分类id */
+ @JsonProperty("id")
+ private Integer id;
+
+ /** 分类名字 */
+ @JsonProperty("name")
+ private String name;
+
+ /** 是否在用户端展示该分类。1为是,0为否 */
+ @JsonProperty("is_displayed")
+ private Integer displayed;
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/LevelTreeInfo.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/LevelTreeInfo.java
new file mode 100644
index 0000000000..c74fff1246
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/LevelTreeInfo.java
@@ -0,0 +1,23 @@
+package me.chanjar.weixin.channel.bean.home.tree;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.Serializable;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 分类信息
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class LevelTreeInfo implements Serializable {
+
+ /** 一级分类 */
+ @JsonProperty("level1")
+ private OneLevelTreeNode level1;
+
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/OneLevelTreeNode.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/OneLevelTreeNode.java
new file mode 100644
index 0000000000..74103e2b89
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/OneLevelTreeNode.java
@@ -0,0 +1,24 @@
+package me.chanjar.weixin.channel.bean.home.tree;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+
+/**
+ * 一级分类
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@EqualsAndHashCode(callSuper = true)
+public class OneLevelTreeNode extends CatTreeNode {
+
+ /** 二级分类 */
+ @JsonProperty("level2")
+ private CatTreeNode level2;
+
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/TreeAuditResult.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/TreeAuditResult.java
new file mode 100644
index 0000000000..b85dda46dd
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/TreeAuditResult.java
@@ -0,0 +1,27 @@
+package me.chanjar.weixin.channel.bean.home.tree;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.Serializable;
+import java.util.List;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 展示在店铺主页的商品分类
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+public class TreeAuditResult implements Serializable {
+
+ private static final long serialVersionUID = 8142657614529852121L;
+
+ /** 版本号。设置分类树的接口会用到 */
+ @JsonProperty("version")
+ private Integer version;
+
+ /** 展示在店铺主页的商品分类 */
+ @JsonProperty("audit_results")
+ private List auditResults;
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/TreeAuditResultDetail.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/TreeAuditResultDetail.java
new file mode 100644
index 0000000000..92df865061
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/TreeAuditResultDetail.java
@@ -0,0 +1,27 @@
+package me.chanjar.weixin.channel.bean.home.tree;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 分类审核结果
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+public class TreeAuditResultDetail implements Serializable {
+
+ private static final long serialVersionUID = -6085892397971684732L;
+
+ /** 该分类ID的审核结果 */
+ @JsonProperty("level_id")
+ private Integer level_id;
+
+ /** 审核结果枚举。1:不通过;2:通过 */
+ @JsonProperty("result_code")
+ private Integer result_code;
+
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/TreeProductEditInfo.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/TreeProductEditInfo.java
new file mode 100644
index 0000000000..d7dd831c3d
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/TreeProductEditInfo.java
@@ -0,0 +1,33 @@
+package me.chanjar.weixin.channel.bean.home.tree;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.Serializable;
+import java.util.List;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 添加/删除分类关联的商品 参数
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class TreeProductEditInfo implements Serializable {
+
+ private static final long serialVersionUID = -5596947592282082891L;
+
+ /** 一级分类id */
+ @JsonProperty("level_1_id")
+ private Integer level1Id;
+
+ /** 二级分类id */
+ @JsonProperty("level_2_id")
+ private Integer level2Id;
+
+ /** 商品id列表 */
+ @JsonProperty("product_ids")
+ private List productIds;
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/TreeProductEditParam.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/TreeProductEditParam.java
new file mode 100644
index 0000000000..fb42162ca6
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/TreeProductEditParam.java
@@ -0,0 +1,25 @@
+package me.chanjar.weixin.channel.bean.home.tree;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.Serializable;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 添加/删除分类关联的商品 参数
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class TreeProductEditParam implements Serializable {
+
+ private static final long serialVersionUID = -4906016235749892703L;
+
+ /** 参数 */
+ @JsonProperty("req")
+ private TreeProductEditInfo req;
+
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/TreeProductListInfo.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/TreeProductListInfo.java
new file mode 100644
index 0000000000..a37e784d14
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/TreeProductListInfo.java
@@ -0,0 +1,36 @@
+package me.chanjar.weixin.channel.bean.home.tree;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.Serializable;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 查询分类关联的商品 参数
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class TreeProductListInfo implements Serializable {
+
+ private static final long serialVersionUID = 2774682583380930076L;
+
+ /** 一级分类id */
+ @JsonProperty("level_1_id")
+ private Integer level1Id;
+
+ /** 二级分类id */
+ @JsonProperty("level_2_id")
+ private Integer level2Id;
+
+ /** 分页大小 */
+ @JsonProperty("page_size")
+ private Integer pageSize;
+
+ /** 从头拉取填空。翻页拉取的话填resp返回的值 */
+ @JsonProperty("page_context")
+ private String pageContext;
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/TreeProductListParam.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/TreeProductListParam.java
new file mode 100644
index 0000000000..7bb6a700e2
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/TreeProductListParam.java
@@ -0,0 +1,24 @@
+package me.chanjar.weixin.channel.bean.home.tree;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.Serializable;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 查询分类关联的商品 参数
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class TreeProductListParam implements Serializable {
+
+ private static final long serialVersionUID = -8444106841479328711L;
+
+ /** 参数 */
+ @JsonProperty("req")
+ private TreeProductListInfo req;
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/TreeProductListResponse.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/TreeProductListResponse.java
new file mode 100644
index 0000000000..ed0081d70c
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/TreeProductListResponse.java
@@ -0,0 +1,24 @@
+package me.chanjar.weixin.channel.bean.home.tree;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
+
+/**
+ * 资金流水响应
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+@EqualsAndHashCode(callSuper = true)
+public class TreeProductListResponse extends WxChannelBaseResponse {
+
+ private static final long serialVersionUID = 4566848209585635054L;
+
+ /** 结果 */
+ @JsonProperty("resp")
+ private TreeProductListResult resp;
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/TreeProductListResult.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/TreeProductListResult.java
new file mode 100644
index 0000000000..6e0fdfea6c
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/TreeProductListResult.java
@@ -0,0 +1,31 @@
+package me.chanjar.weixin.channel.bean.home.tree;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.Serializable;
+import java.util.List;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 资金流水响应 结果
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+public class TreeProductListResult implements Serializable {
+
+ private static final long serialVersionUID = 4566848209585635054L;
+
+ /** 关联的商品ID。如果返回为空,返回翻页到底了 */
+ @JsonProperty("product_ids")
+ private List productIds;
+
+ /** 总条数 */
+ @JsonProperty("total_count")
+ private Integer totalCount;
+
+ /** 拉取下一页的话,需要把这个值填到req的page_context里面 */
+ @JsonProperty("page_context")
+ private String pageContext;
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/TreeShowGetResponse.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/TreeShowGetResponse.java
new file mode 100644
index 0000000000..f3784c48fb
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/TreeShowGetResponse.java
@@ -0,0 +1,20 @@
+package me.chanjar.weixin.channel.bean.home.tree;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
+
+/**
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+@EqualsAndHashCode(callSuper = true)
+public class TreeShowGetResponse extends WxChannelBaseResponse {
+
+ /** resp */
+ @JsonProperty("resp")
+ private TreeShowInfo resp;
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/TreeShowInfo.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/TreeShowInfo.java
new file mode 100644
index 0000000000..485d29ce15
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/TreeShowInfo.java
@@ -0,0 +1,103 @@
+package me.chanjar.weixin.channel.bean.home.tree;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.Serializable;
+import java.util.List;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 分类展示信息
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class TreeShowInfo implements Serializable {
+
+ /** 分类树 */
+ @JsonProperty("tree")
+ private LevelTreeInfo tree;
+
+ /** 版本号。通过获取商品分类树或者本接口得到 */
+ @JsonProperty("version")
+ private Integer version;
+
+ /** 表示有哪一些分类ID清空关联得商品,如果不清空,那么分类ID和商品得关联关系会一直存在。如果是一级分类,就填"1"。如果是二级分类,就填"1.2"。 */
+ @JsonProperty("classification_id_deleted")
+ private List classificationIdDeleted;
+
+ // 一些自定义的方法
+
+ /**
+ * 创建Tree节点
+ *
+ * @return Tree节点
+ */
+ protected LevelTreeInfo createTree() {
+ if (tree == null) {
+ tree = new LevelTreeInfo();
+ }
+ return tree;
+ }
+
+ /**
+ * 创建一级分类节点
+ *
+ * @return 一级分类节点
+ */
+ protected OneLevelTreeNode createLevel1() {
+ this.createTree();
+ if (tree.getLevel1() == null) {
+ tree.setLevel1(new OneLevelTreeNode());
+ }
+ return tree.getLevel1();
+ }
+
+ /**
+ * 创建二级分类节点
+ *
+ * @return 二级分类节点
+ */
+ protected CatTreeNode createLevel2() {
+ OneLevelTreeNode level1 = this.createLevel1();
+ if (level1.getLevel2() == null) {
+ level1.setLevel2(new CatTreeNode());
+ }
+ return level1.getLevel2();
+ }
+
+
+ @JsonIgnore
+ public void setLevel1Id(Integer id) {
+ createLevel1().setId(id);
+ }
+
+ @JsonIgnore
+ public void setLevel1Name(String name) {
+ createLevel1().setName(name);
+ }
+
+ @JsonIgnore
+ public void setLevel1Displayed(Integer displayed) {
+ createLevel1().setDisplayed(displayed);
+ }
+
+ @JsonIgnore
+ public void setLevel2Id(Integer id) {
+ createLevel2().setId(id);
+ }
+
+ @JsonIgnore
+ public void setLevel2Name(String name) {
+ createLevel2().setName(name);
+ }
+
+ @JsonIgnore
+ public void setLevel2Displayed(Integer displayed) {
+ createLevel2().setDisplayed(displayed);
+ }
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/TreeShowParam.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/TreeShowParam.java
new file mode 100644
index 0000000000..7277c528f4
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/TreeShowParam.java
@@ -0,0 +1,24 @@
+package me.chanjar.weixin.channel.bean.home.tree;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.Serializable;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 设置展示在店铺主页的商品分类 参数
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class TreeShowParam implements Serializable {
+
+ private static final long serialVersionUID = -1577647561992899360L;
+
+ /** 分类信息 */
+ @JsonProperty("req")
+ private TreeShowInfo req;
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/TreeShowSetResponse.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/TreeShowSetResponse.java
new file mode 100644
index 0000000000..ad65332644
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/tree/TreeShowSetResponse.java
@@ -0,0 +1,20 @@
+package me.chanjar.weixin.channel.bean.home.tree;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
+
+/**
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+@EqualsAndHashCode(callSuper = true)
+public class TreeShowSetResponse extends WxChannelBaseResponse {
+
+ /** resp */
+ @JsonProperty("resp")
+ private TreeAuditResult resp;
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/window/WindowProductIndexParam.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/window/WindowProductIndexParam.java
new file mode 100644
index 0000000000..fcc16bd0f6
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/window/WindowProductIndexParam.java
@@ -0,0 +1,28 @@
+package me.chanjar.weixin.channel.bean.home.window;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.Serializable;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 主页商品排序参数
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class WindowProductIndexParam implements Serializable {
+
+ private static final long serialVersionUID = 1370480140179330908L;
+
+ /** 商品id */
+ @JsonProperty("product_id")
+ private String productId;
+
+ /** 商品重新排序后的新序号,最大移动步长为500(即新序号与当前序号的距离小于500) */
+ @JsonProperty("index_num")
+ private Integer indexNum;
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/window/WindowProductListParam.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/window/WindowProductListParam.java
new file mode 100644
index 0000000000..9245df9887
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/window/WindowProductListParam.java
@@ -0,0 +1,26 @@
+package me.chanjar.weixin.channel.bean.home.window;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.Serializable;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 获取主页展示商品列表 参数
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class WindowProductListParam implements Serializable {
+
+ /** 每页数量(默认10,不超过30) */
+ @JsonProperty("page_size")
+ private Integer pageSize;
+
+ /** 由上次请求返回,记录翻页的上下文。传入时会从上次返回的结果往后翻一页,不传默认获取第一页数据。 */
+ @JsonProperty("next_key")
+ private String nextKey;
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/window/WindowProductSetting.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/window/WindowProductSetting.java
new file mode 100644
index 0000000000..725470b912
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/window/WindowProductSetting.java
@@ -0,0 +1,34 @@
+package me.chanjar.weixin.channel.bean.home.window;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.Serializable;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 主页商品配置 返回结果 / 设置请求参数
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class WindowProductSetting implements Serializable {
+
+ private static final long serialVersionUID = -5931781905709862287L;
+
+ /** 商品id */
+ @JsonProperty("product_id")
+ private String productId;
+
+ /** 是否隐藏,设置为隐藏的商品只在首页不可见,并不代表下架。 */
+ @JsonProperty("is_set_hide")
+ private Integer setHide;
+
+ /** 是否置顶 */
+ @JsonProperty("is_set_top")
+ private Integer setTop;
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/window/WindowProductSettingResponse.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/window/WindowProductSettingResponse.java
new file mode 100644
index 0000000000..495910e37d
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/home/window/WindowProductSettingResponse.java
@@ -0,0 +1,33 @@
+package me.chanjar.weixin.channel.bean.home.window;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.List;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
+
+/**
+ * 主页商品配置列表
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+@EqualsAndHashCode(callSuper = true)
+public class WindowProductSettingResponse extends WxChannelBaseResponse {
+
+ private static final long serialVersionUID = 1L;
+
+ /** 商品信息 */
+ @JsonProperty("products")
+ private List products;
+
+ /** 本次翻页的上下文,用于请求下一页 */
+ @JsonProperty("next_key")
+ private String nextKey;
+
+ /** 商品总数 */
+ @JsonProperty("total_num")
+ private Integer totalNum;
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/message/store/CloseStoreMessage.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/message/store/CloseStoreMessage.java
new file mode 100644
index 0000000000..2a43483354
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/message/store/CloseStoreMessage.java
@@ -0,0 +1,38 @@
+package me.chanjar.weixin.channel.bean.message.store;
+
+/**
+ * @author Zeyes
+ */
+
+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;
+
+/**
+ * 小店注销消息
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+@EqualsAndHashCode(callSuper = true)
+@JacksonXmlRootElement(localName = "xml")
+public class CloseStoreMessage extends WxChannelMessage {
+
+ private static final long serialVersionUID = 7619787772418774020L;
+
+ /** appid */
+ @JsonProperty("appid")
+ @JacksonXmlProperty(localName = "appid")
+ private String appid;
+
+ /** Unix时间戳,即格林威治时间1970年01月01日00时00分00秒(北京时间1970年01月01日08时00分00秒)起至现在的总秒数 */
+ @JsonProperty("close_timestamp")
+ @JacksonXmlProperty(localName = "close_timestamp")
+ private Long closeTimestamp;
+
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/message/store/NicknameUpdateMessage.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/message/store/NicknameUpdateMessage.java
new file mode 100644
index 0000000000..e6665497e0
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/message/store/NicknameUpdateMessage.java
@@ -0,0 +1,43 @@
+package me.chanjar.weixin.channel.bean.message.store;
+
+/**
+ * @author Zeyes
+ */
+
+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;
+
+/**
+ * 小店修改名称消息
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+@EqualsAndHashCode(callSuper = true)
+@JacksonXmlRootElement(localName = "xml")
+public class NicknameUpdateMessage extends WxChannelMessage {
+
+ private static final long serialVersionUID = 7619787772418774020L;
+
+ /** appid */
+ @JsonProperty("appid")
+ @JacksonXmlProperty(localName = "appid")
+ private String appid;
+
+ /** 小店旧昵称 */
+ @JsonProperty("old_nickname")
+ @JacksonXmlProperty(localName = "old_nickname")
+ private String oldNickname;
+
+ /** 小店新昵称 */
+ @JsonProperty("new_nickname")
+ @JacksonXmlProperty(localName = "new_nickname")
+ private String newNickname;
+
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/order/DecodeAddressInfo.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/order/DecodeAddressInfo.java
new file mode 100644
index 0000000000..3aa6622eeb
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/order/DecodeAddressInfo.java
@@ -0,0 +1,22 @@
+package me.chanjar.weixin.channel.bean.order;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import me.chanjar.weixin.channel.bean.base.AddressInfo;
+
+/**
+ * 解码地址数据
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+@EqualsAndHashCode(callSuper = true)
+public class DecodeAddressInfo extends AddressInfo {
+
+ /** 虚拟发货订单联系方式,在发货方式为无需快递(deliver_method=1)时返回 */
+ @JsonProperty("virtual_order_tel_number")
+ private String virtualOrderTelNumber;
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/order/DecodeSensitiveInfoResponse.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/order/DecodeSensitiveInfoResponse.java
new file mode 100644
index 0000000000..c0431a8fd6
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/order/DecodeSensitiveInfoResponse.java
@@ -0,0 +1,28 @@
+package me.chanjar.weixin.channel.bean.order;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
+
+/**
+ * 解码订单包含的敏感数据响应
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+@EqualsAndHashCode(callSuper = true)
+public class DecodeSensitiveInfoResponse extends WxChannelBaseResponse {
+
+ private static final long serialVersionUID = 935829924760021624L;
+
+ /** 收货信息 */
+ @JsonProperty("address_info")
+ private DecodeAddressInfo addressInfo;
+
+ /** 虚拟号信息 */
+ @JsonProperty("virtual_number_info")
+ private VirtualNumberInfo virtualNumberInfo;
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/order/OrderDeliveryInfo.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/order/OrderDeliveryInfo.java
index 9f3d72feac..ebe6bb8dc2 100644
--- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/order/OrderDeliveryInfo.java
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/order/OrderDeliveryInfo.java
@@ -44,4 +44,16 @@ public class OrderDeliveryInfo implements Serializable {
@JsonProperty("ewaybill_order_code")
private String ewaybillOrderCode;
+ /** 订单质检类型 2生鲜类质检 1珠宝玉石类质检 0不需要;不传递本字段表示不需要 */
+ @JsonProperty("quality_inspect_type")
+ private String qualityInspectType;
+
+ /** 质检信息 */
+ @JsonProperty("quality_inspect_info")
+ private QualityInsepctInfo qualityInspectInfo;
+
+ /** 虚拟商品充值账户信息 */
+ @JsonProperty("recharge_info")
+ private RechargeInfo rechargeInfo;
+
}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/order/OrderSearchCondition.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/order/OrderSearchCondition.java
index 012b0fca49..a4c8373cec 100644
--- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/order/OrderSearchCondition.java
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/order/OrderSearchCondition.java
@@ -30,12 +30,33 @@ public class OrderSearchCondition implements Serializable {
@JsonProperty("user_name")
private String userName;
- /** 收件人电话 */
+ /**
+ * 收件人电话
+ * @deprecated 当前字段已经废弃,请勿使用,如果原本填手机后四位,可正常使用,否则接口报错
+ */
@JsonProperty("tel_number")
+ @Deprecated
private String telNumber;
+ /**
+ * 收件人电话后四位
+ */
+ @JsonProperty("tel_number_last4")
+ private String telNumberLast4;
+
/** 选填,只搜一个订单时使用 */
@JsonProperty("order_id")
private String orderId;
+ /** 商家备注 */
+ @JsonProperty("merchant_notes")
+ private String merchantNotes;
+
+ /** 买家备注 */
+ @JsonProperty("customer_notes")
+ private String customerNotes;
+
+ /** 申请修改地址审核中 */
+ @JsonProperty("address_under_review")
+ private Boolean addressUnderReview;
}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/order/QualityInsepctInfo.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/order/QualityInsepctInfo.java
new file mode 100644
index 0000000000..64c1102bb2
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/order/QualityInsepctInfo.java
@@ -0,0 +1,22 @@
+package me.chanjar.weixin.channel.bean.order;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 质检信息
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+public class QualityInsepctInfo implements Serializable {
+
+ private static final long serialVersionUID = 8109819414306253475L;
+
+ /** 质检状态 */
+ @JsonProperty("inspect_status")
+ private Integer inspectStatus;
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/order/RechargeInfo.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/order/RechargeInfo.java
new file mode 100644
index 0000000000..452dd0677c
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/order/RechargeInfo.java
@@ -0,0 +1,28 @@
+package me.chanjar.weixin.channel.bean.order;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 虚拟商品充值账户信息
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+public class RechargeInfo implements Serializable {
+
+ /** 虚拟商品充值账号,当account_type=qq或phone_number或mail的时候返回 */
+ @JsonProperty("account_no")
+ private String accountNo;
+
+ /** 账号充值类型,可选项: weixin(微信号),qq(qq),phone_number(电话号码),mail(邮箱) */
+ @JsonProperty("account_type")
+ private String accountType;
+
+ /** 当account_type="weixin"的时候返回 */
+ @JsonProperty("wx_openid")
+ private String wxOpenId;
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/order/VirtualNumberInfo.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/order/VirtualNumberInfo.java
new file mode 100644
index 0000000000..217908e27c
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/order/VirtualNumberInfo.java
@@ -0,0 +1,30 @@
+package me.chanjar.weixin.channel.bean.order;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 虚拟号信息
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+public class VirtualNumberInfo implements Serializable {
+
+ private static final long serialVersionUID = -372834823737476644L;
+
+ /** 虚拟号 */
+ @JsonProperty("virtual_number")
+ private String virtualNumber;
+
+ /** 分机号 */
+ @JsonProperty("extension")
+ private String extension;
+
+ /** 过期时间戳 */
+ @JsonProperty("expiration")
+ private Long expiration;
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/order/VirtualTelNumberResponse.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/order/VirtualTelNumberResponse.java
new file mode 100644
index 0000000000..92f09b59ab
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/order/VirtualTelNumberResponse.java
@@ -0,0 +1,30 @@
+package me.chanjar.weixin.channel.bean.order;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
+
+/**
+ * 兑换虚拟号 返回结果
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+@EqualsAndHashCode(callSuper = true)
+public class VirtualTelNumberResponse extends WxChannelBaseResponse {
+
+ /** 虚拟号码 */
+ @JsonProperty("virtual_tel_number")
+ private String virtualTelNumber;
+
+ /** 虚拟号码过期时间 */
+ @JsonProperty("virtual_tel_expire_time")
+ private Long virtualTelExpireTime;
+
+ /** 兑换虚拟号码次数 */
+ @JsonProperty("get_virtual_tel_cnt")
+ private Integer getVirtualTelCnt;
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/ExtraServiceInfo.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/ExtraServiceInfo.java
index aeaf1a8cd6..4e9559c565 100644
--- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/ExtraServiceInfo.java
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/ExtraServiceInfo.java
@@ -20,4 +20,20 @@ public class ExtraServiceInfo implements Serializable {
*/
@JsonProperty("seven_day_return")
private Integer sevenDayReturn;
+
+ /** 先用后付,0-不支持先用后付,1-支持先用后付。若店铺已开通先用后付,支持先用后付的类目商品将在上架后自动打开先用后付。 */
+ @JsonProperty("pay_after_use")
+ private Integer payAfterUse;
+
+ /** 是否支持运费险,0-不支持运费险,1-支持运费险。需要商户开通运费险服务,且当前类目支持运费险才会生效。 */
+ @JsonProperty("freight_insurance")
+ private Integer freightInsurance;
+
+ /** 是否支持假一赔三,0-不支持假一赔三,1-支持假一赔三。 */
+ @JsonProperty("fake_one_pay_three")
+ private Integer fakeOnePayThree;
+
+ /** 是否支持坏损包退,0-不支持坏损包退,1-支持坏损包退。 */
+ @JsonProperty("damage_guarantee")
+ private Integer damageGuarantee;
}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/ProductQuaInfo.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/ProductQuaInfo.java
new file mode 100644
index 0000000000..b411ebe80f
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/ProductQuaInfo.java
@@ -0,0 +1,29 @@
+package me.chanjar.weixin.channel.bean.product;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.Serializable;
+import java.util.List;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 商品资质信息
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class ProductQuaInfo implements Serializable {
+
+ private static final long serialVersionUID = -71766140204505768L;
+
+ /** 商品资质id,对应获取类目信息中的字段product_qua_list[].qua_id */
+ @JsonProperty("qua_id")
+ private String quaId;
+
+ /** 商品资质图片列表 */
+ @JsonProperty("qua_url")
+ private List quaUrl;
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/ProductSaleLimitInfo.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/ProductSaleLimitInfo.java
new file mode 100644
index 0000000000..9c067cc329
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/ProductSaleLimitInfo.java
@@ -0,0 +1,30 @@
+package me.chanjar.weixin.channel.bean.product;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.Serializable;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 商品销售库存限制
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class ProductSaleLimitInfo implements Serializable {
+
+ /** 是否受到管控,商品存在售卖限制时,固定返回1 */
+ @JsonProperty("is_limited")
+ private Integer limited;
+
+ /** 售卖限制标题 */
+ @JsonProperty("title")
+ private String title;
+
+ /** 售卖限制描述 */
+ @JsonProperty("sub_title")
+ private String subTitle;
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SkuFastInfo.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SkuFastInfo.java
new file mode 100644
index 0000000000..a461e6d952
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SkuFastInfo.java
@@ -0,0 +1,52 @@
+package me.chanjar.weixin.channel.bean.product;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 免审商品更新Sku数据
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class SkuFastInfo implements Serializable {
+
+ /** sku_id */
+ @JsonProperty("sku_id")
+ private String skuId;
+
+ /** 售卖价格,以分为单位,数字类型,最大不超过10000000(1000万元) */
+ @JsonProperty("sale_price")
+ private Integer salePrice;
+
+ @JsonProperty("stock_info")
+ private StockInfo stockInfo;
+
+ /** sku发货信息 */
+ @JsonProperty("sku_deliver_info")
+ private SkuDeliverInfo skuDeliverInfo;
+
+ /** 是否要删除当前sku */
+ @JsonProperty("is_delete")
+ private Boolean delete;
+
+
+ @Data
+ @NoArgsConstructor
+ public static class StockInfo implements Serializable {
+
+ /** 修改类型。1: 增加;2:减少;3:设置 */
+ @JsonProperty("diff_type")
+ protected Integer diffType;
+
+ /** 增加、减少或者设置的库存值 */
+ @JsonProperty("num")
+ protected Integer num;
+ }
+
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SkuInfo.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SkuInfo.java
index 3b46708039..22e75d7afc 100644
--- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SkuInfo.java
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SkuInfo.java
@@ -54,7 +54,7 @@ public class SkuInfo implements Serializable {
/** skuID */
@JsonProperty("sku_id")
- private Long skuId;
+ private String skuId;
public SkuInfo() {
}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SkuStockBatchList.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SkuStockBatchList.java
new file mode 100644
index 0000000000..71f995692f
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SkuStockBatchList.java
@@ -0,0 +1,23 @@
+package me.chanjar.weixin.channel.bean.product;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.Serializable;
+import java.util.List;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * spu库存列表
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+public class SkuStockBatchList implements Serializable {
+ private static final long serialVersionUID = -8082428962162052815L;
+
+ /** 库存信息 */
+ @JsonProperty("spu_stock_list")
+ private List spuStockList;
+
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SkuStockBatchParam.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SkuStockBatchParam.java
new file mode 100644
index 0000000000..93b5cca798
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SkuStockBatchParam.java
@@ -0,0 +1,24 @@
+package me.chanjar.weixin.channel.bean.product;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.Serializable;
+import java.util.List;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class SkuStockBatchParam implements Serializable {
+
+ private static final long serialVersionUID = 3706326762056220559L;
+
+ /** 商品ID列表 注意这里是 productId ,序列化参数没有写错 */
+ @JsonProperty("product_id")
+ private List productIds;
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SkuStockBatchResponse.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SkuStockBatchResponse.java
new file mode 100644
index 0000000000..eb188bdc79
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SkuStockBatchResponse.java
@@ -0,0 +1,24 @@
+package me.chanjar.weixin.channel.bean.product;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
+
+/**
+ * 批量查询sku库存响应
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+@EqualsAndHashCode(callSuper = true)
+public class SkuStockBatchResponse extends WxChannelBaseResponse {
+
+ private static final long serialVersionUID = 7745444061881828137L;
+
+ /** 库存信息 */
+ @JsonProperty("data")
+ private SkuStockBatchList data;
+ }
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SkuStockInfo.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SkuStockInfo.java
index a0dccb1329..a480d3249b 100644
--- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SkuStockInfo.java
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SkuStockInfo.java
@@ -29,7 +29,14 @@ public class SkuStockInfo implements Serializable {
@JsonProperty("warehouse_stocks")
private List warehouseStocks;
- /** 库存总量:通用库存数量 + 限时抢购库存数量 + 区域库存总量 */
+ /**
+ * 普通查询:库存总量:通用库存数量 + 限时抢购库存数量 + 区域库存总量
+ * 批量查询:库存总量:通用库存数量 + 限时抢购库存数量 + 区域库存数量 + 达人专属计划营销库存数量
+ */
@JsonProperty("total_stock_num")
private Integer totalStockNum;
+
+ /** 达人专属计划营销库存数量 */
+ @JsonProperty("finder_stock_num")
+ private Integer finderTotalNum;
}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SkuStockResponse.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SkuStockResponse.java
index 9cbd6f18c0..683aece146 100644
--- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SkuStockResponse.java
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SkuStockResponse.java
@@ -1,5 +1,6 @@
package me.chanjar.weixin.channel.bean.product;
+import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
@@ -18,5 +19,6 @@ public class SkuStockResponse extends WxChannelBaseResponse {
private static final long serialVersionUID = -2156342792354605826L;
/** 库存信息 */
+ @JsonProperty("data")
private SkuStockInfo data;
}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SpuFastInfo.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SpuFastInfo.java
new file mode 100644
index 0000000000..05e107779b
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SpuFastInfo.java
@@ -0,0 +1,28 @@
+package me.chanjar.weixin.channel.bean.product;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.Serializable;
+import java.util.List;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 商品免审更新参数
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class SpuFastInfo implements Serializable {
+
+ /** 商品ID */
+ @JsonProperty("product_id")
+ protected String productId;
+
+ /** SKU列表 */
+ @JsonProperty("skus")
+ protected List skus;
+
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SpuGetResponse.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SpuGetResponse.java
index b01682802f..ff15cbf0cb 100644
--- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SpuGetResponse.java
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SpuGetResponse.java
@@ -25,4 +25,8 @@ public class SpuGetResponse extends WxChannelBaseResponse {
/** 商品草稿数据,入参data_type==1时不返回该字段 */
@JsonProperty("edit_product")
private SpuInfo editProduct;
+
+ /** 当日售卖上限提醒,当店铺受到售卖管控时返回,没有返回本字段表示没有无额外限制 */
+ @JsonProperty("sale_limit_info")
+ private ProductSaleLimitInfo saleLimitInfo;
}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SpuInfo.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SpuInfo.java
index 9db4c50f70..7b29194731 100644
--- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SpuInfo.java
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SpuInfo.java
@@ -45,6 +45,10 @@ public class SpuInfo extends SpuSimpleInfo {
@JsonProperty("cats")
private List cats;
+ /** 新类目树,商家需要先申请可使用类目 */
+ @JsonProperty("cats_v2")
+ private List catsV2;
+
/** 商品参数 */
@JsonProperty("attrs")
private List attrs;
@@ -107,10 +111,24 @@ public class SpuInfo extends SpuSimpleInfo {
@JsonProperty("product_type")
private Integer productType;
-
/**
* 商品的售后信息
*/
@JsonProperty("after_sale_info")
private AfterSaleInfo afterSaleInfo;
+
+ /**
+ * 当商品类型位福袋抽奖商品(即product_type==2)且该抽奖商品由橱窗的自营商品导入生成时有值,
+ * 表示导入的来源商品id,其他场景下该字段无值或者值为0
+ */
+ @JsonProperty("src_product_id")
+ private String srcProductId;
+
+ /** 商品资质列表 */
+ @JsonProperty("product_qua_infos")
+ private List productQuaInfos;
+
+ /** 尺码表信息 */
+ @JsonProperty("size_chart")
+ private SpuSizeChart sizeChart;
}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SpuSimpleInfo.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SpuSimpleInfo.java
index b1ab3febe7..3e84bb1492 100644
--- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SpuSimpleInfo.java
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SpuSimpleInfo.java
@@ -15,7 +15,7 @@ public class SpuSimpleInfo implements Serializable {
private static final long serialVersionUID = 5583726432139404883L;
- /** 交易组件平台内部商品ID */
+ /** 商品ID */
@JsonProperty("product_id")
protected String productId;
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SpuSizeChart.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SpuSizeChart.java
new file mode 100644
index 0000000000..4e34ccfac8
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SpuSizeChart.java
@@ -0,0 +1,27 @@
+package me.chanjar.weixin.channel.bean.product;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.Serializable;
+import java.util.List;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 尺码表信息
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+public class SpuSizeChart implements Serializable {
+
+ private static final long serialVersionUID = -5019617420608575610L;
+
+ /** 是否支持尺码表 */
+ @JsonProperty("enable")
+ private Boolean enable;
+
+ /** 尺码表 */
+ @JsonProperty("specification_list")
+ private List specificationList;
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SpuSizeChartItem.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SpuSizeChartItem.java
new file mode 100644
index 0000000000..7ea4d0a66b
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SpuSizeChartItem.java
@@ -0,0 +1,55 @@
+package me.chanjar.weixin.channel.bean.product;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.Serializable;
+import java.util.List;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 尺码表
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+public class SpuSizeChartItem implements Serializable {
+
+ private static final long serialVersionUID = -3757716378584654974L;
+
+ /** 尺码属性名称 */
+ @JsonProperty("name")
+ private String name;
+
+ /** 尺码属性值的单位 */
+ @JsonProperty("unit")
+ private String unit;
+
+ /** 尺码属性值是否为区间 */
+ @JsonProperty("is_range")
+ private Boolean range;
+
+ /** 尺码值与尺码属性值的映射列表 */
+ @JsonProperty("value_list")
+ private List valueList;
+
+ @Data
+ @NoArgsConstructor
+ public static class ValueRange implements Serializable {
+ /** 尺码值 */
+ @JsonProperty("key")
+ private String key;
+
+ /** 尺码属性值;尺码属性值为非区间时返回 */
+ @JsonProperty("value")
+ private String value;
+
+ /** 尺码属性值的左边界;尺码属性值为区间时返回 */
+ @JsonProperty("left")
+ private String left;
+
+ /** 尺码属性值的右边界;尺码属性值为区间时返回 */
+ @JsonProperty("right")
+ private String right;
+ }
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SpuStockInfo.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SpuStockInfo.java
new file mode 100644
index 0000000000..4564f069b8
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SpuStockInfo.java
@@ -0,0 +1,25 @@
+package me.chanjar.weixin.channel.bean.product;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.io.Serializable;
+import java.util.List;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * SPU库存信息
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+public class SpuStockInfo implements Serializable {
+
+ /** 商品ID */
+ @JsonProperty("product_id")
+ protected String productId;
+
+ /** sku库存 */
+ @JsonProperty("sku_stock")
+ private List skuStock;
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SpuUpdateInfo.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SpuUpdateInfo.java
new file mode 100644
index 0000000000..f6214c5d78
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SpuUpdateInfo.java
@@ -0,0 +1,24 @@
+package me.chanjar.weixin.channel.bean.product;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+
+/**
+ * 商品更新数据
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+@EqualsAndHashCode(callSuper = true)
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class SpuUpdateInfo extends SpuInfo {
+
+ /** 添加完成后是否立即上架。1:是;0:否;默认0 */
+ @JsonProperty("listing")
+ private Integer listing;
+
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/WarehouseStockInfo.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/WarehouseStockInfo.java
index bb239c9492..b0235534bb 100644
--- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/WarehouseStockInfo.java
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/WarehouseStockInfo.java
@@ -6,6 +6,8 @@
import lombok.NoArgsConstructor;
/**
+ * 区域库存
+ *
* @author Zeyes
*/
@Data
@@ -21,4 +23,8 @@ public class WarehouseStockInfo implements Serializable {
/** 区域库存数量 */
@JsonProperty("num")
private Integer num;
+
+ /** 区域库存的锁定库存(已下单未支付的库存)数量 */
+ @JsonProperty("lock_stock")
+ private Integer lockStock;
}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/link/ProductH5UrlResponse.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/link/ProductH5UrlResponse.java
new file mode 100644
index 0000000000..0dee49f165
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/link/ProductH5UrlResponse.java
@@ -0,0 +1,22 @@
+package me.chanjar.weixin.channel.bean.product.link;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
+
+/**
+ * 商品H5短链 结果
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+@EqualsAndHashCode(callSuper = true)
+public class ProductH5UrlResponse extends WxChannelBaseResponse {
+
+ /** 商品H5短链 */
+ @JsonProperty("product_h5url")
+ private String productH5url;
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/link/ProductQrCodeResponse.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/link/ProductQrCodeResponse.java
new file mode 100644
index 0000000000..a6876b78f1
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/link/ProductQrCodeResponse.java
@@ -0,0 +1,22 @@
+package me.chanjar.weixin.channel.bean.product.link;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
+
+/**
+ * 商品二维码 结果
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+@EqualsAndHashCode(callSuper = true)
+public class ProductQrCodeResponse extends WxChannelBaseResponse {
+
+ /** 商品二维码 */
+ @JsonProperty("product_qrcode")
+ private String productQrcode;
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/link/ProductTagLinkResponse.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/link/ProductTagLinkResponse.java
new file mode 100644
index 0000000000..59712130d8
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/link/ProductTagLinkResponse.java
@@ -0,0 +1,22 @@
+package me.chanjar.weixin.channel.bean.product.link;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
+
+/**
+ * 商品口令 结果
+ *
+ * @author Zeyes
+ */
+@Data
+@NoArgsConstructor
+@EqualsAndHashCode(callSuper = true)
+public class ProductTagLinkResponse extends WxChannelBaseResponse {
+
+ /** 商品口令 */
+ @JsonProperty("product_taglink")
+ private String productTaglink;
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/token/StableToken.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/token/StableTokenParam.java
similarity index 93%
rename from weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/token/StableToken.java
rename to weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/token/StableTokenParam.java
index 72ce83d077..8bcacb649b 100644
--- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/token/StableToken.java
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/token/StableTokenParam.java
@@ -17,7 +17,7 @@
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
-public class StableToken implements Serializable {
+public class StableTokenParam implements Serializable {
private static final long serialVersionUID = 6849364823232834171L;
@JsonProperty("grant_type")
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/vip/VipParam.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/vip/VipOpenIdParam.java
similarity index 90%
rename from weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/vip/VipParam.java
rename to weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/vip/VipOpenIdParam.java
index e439641ed9..8f52ded878 100644
--- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/vip/VipParam.java
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/vip/VipOpenIdParam.java
@@ -17,7 +17,7 @@
@NoArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
@AllArgsConstructor
-public class VipParam implements Serializable {
+public class VipOpenIdParam implements Serializable {
private static final long serialVersionUID = -7924178026258012317L;
@JsonProperty("openid")
private String openId;
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/common/ChannelWxError.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/common/ChannelWxError.java
index eb8cda4996..705eacc898 100644
--- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/common/ChannelWxError.java
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/common/ChannelWxError.java
@@ -7,7 +7,9 @@
* 微信视频号错误码
*
* @author Zeyes
+ * @deprecated 请使用 {@link me.chanjar.weixin.common.error.WxError} 替代
*/
+@Deprecated
public class ChannelWxError extends WxError {
private static final long serialVersionUID = -2638512715814977441L;
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/config/WxChannelConfig.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/config/WxChannelConfig.java
index ad24234fb0..64344dae58 100644
--- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/config/WxChannelConfig.java
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/config/WxChannelConfig.java
@@ -19,6 +19,14 @@ public interface WxChannelConfig {
*/
String getAccessToken();
+ /**
+ * Is use stable access token api
+ *
+ * @link 获取稳定版AccessToken
+ * @return the boolean
+ */
+ boolean isStableAccessToken();
+
/**
* Gets access token lock.
*
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/config/impl/WxChannelDefaultConfigImpl.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/config/impl/WxChannelDefaultConfigImpl.java
index e32bcad83e..1c3930caf5 100644
--- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/config/impl/WxChannelDefaultConfigImpl.java
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/config/impl/WxChannelDefaultConfigImpl.java
@@ -33,6 +33,8 @@ public class WxChannelDefaultConfigImpl implements WxChannelConfig {
private volatile int httpProxyPort;
private volatile String httpProxyUsername;
private volatile String httpProxyPassword;
+ /** 是否使用稳定版获取accessToken接口 */
+ private volatile boolean stableAccessToken;
private volatile int retrySleepMillis = 1000;
private volatile int maxRetryTimes = 5;
@@ -63,6 +65,15 @@ public void setAccessToken(String accessToken) {
this.accessToken = accessToken;
}
+ @Override
+ public boolean isStableAccessToken() {
+ return stableAccessToken;
+ }
+
+ public void setStableAccessToken(boolean stableAccessToken) {
+ this.stableAccessToken = stableAccessToken;
+ }
+
@Override
public Lock getAccessTokenLock() {
return this.accessTokenLock;
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 48cf268b06..bee0263a25 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
@@ -83,4 +83,10 @@ public interface MessageEventConstants {
// 分享员相关
/** 分享员变更 **/
String SHARER_CHANGE = "channels_ec_sharer_change";
+
+ // 店铺相关
+ /** 小店注销 */
+ String CLOSE_STORE = "channels_ec_close_store";
+ /** 小店修改 */
+ String SET_SHOP_NICKNAME = "set_shop_nickname";
}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/constant/WxChannelApiUrlConstants.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/constant/WxChannelApiUrlConstants.java
index 1fddd1de84..35cb6d2140 100644
--- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/constant/WxChannelApiUrlConstants.java
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/constant/WxChannelApiUrlConstants.java
@@ -55,6 +55,48 @@ public interface Category {
String LIST_PASS_CATEGORY_URL = "https://api.weixin.qq.com/channels/ec/category/list/get";
}
+ /** 主页管理相关接口 */
+ public interface HomePage {
+
+ /** 添加分类关联的商品 */
+ String ADD_TREE_PRODUCT_URL = "https://api.weixin.qq.com/channels/ec/store/classification/tree/product/add";
+ /** 删除分类关联的商品 */
+ String DEL_TREE_PRODUCT_URL = "https://api.weixin.qq.com/channels/ec/store/classification/tree/product/del";
+ /** 获取分类关联的商品ID列表 */
+ String LIST_TREE_PRODUCT_URL = "https://api.weixin.qq.com/channels/ec/store/classification/tree/product/get";
+ /** 设置展示在店铺主页的商品分类 */
+ String SET_SHOW_TREE_URL = "https://api.weixin.qq.com/channels/ec/store/classification/tree/set";
+ /** 获取在店铺主页展示的商品分类 */
+ String GET_SHOW_TREE_URL = "https://api.weixin.qq.com/channels/ec/store/classification/tree/get";
+
+ /** 获取主页展示商品列表 */
+ String LIST_WINDOW_PRODUCT_URL = "https://api.weixin.qq.com/channels/ec/store/window/product/list/get";
+ /** 重新排序主页展示商品 */
+ String REORDER_WINDOW_PRODUCT_URL = "https://api.weixin.qq.com/channels/ec/store/window/product/reorder";
+ /** 隐藏小店主页商品 */
+ String HIDE_WINDOW_PRODUCT_URL = "https://api.weixin.qq.com/channels/ec/store/window/product/hide";
+ /** 置顶小店主页商品 */
+ String TOP_WINDOW_PRODUCT_URL = "https://api.weixin.qq.com/channels/ec/store/window/product/settop";
+
+ /** 提交主页背景图申请 */
+ String APPLY_BACKGROUND_URL = "https://api.weixin.qq.com/channels/ec/basics/homepage/background/apply/submit";
+ /** 查询主页背景图 */
+ String GET_BACKGROUND_URL = "https://api.weixin.qq.com/channels/ec/basics/homepage/background/get";
+ /** 撤销主页背景图申请 */
+ String CANCEL_BACKGROUND_URL = "https://api.weixin.qq.com/channels/ec/basics/homepage/background/apply/cancel";
+ /** 清空主页背景图并撤销流程中的申请 */
+ String REMOVE_BACKGROUND_URL = "https://api.weixin.qq.com/channels/ec/basics/homepage/background/remove";
+
+ /** 提交精选展示位申请 */
+ String APPLY_BANNER_URL = "https://api.weixin.qq.com/channels/ec/basics/homepage/banner/apply/submit";
+ /** 查询精选展示位 */
+ String GET_BANNER_URL = "https://api.weixin.qq.com/channels/ec/basics/homepage/banner/get";
+ /** 撤销精选展示位申请 */
+ String CANCEL_BANNER_URL = "https://api.weixin.qq.com/channels/ec/basics/homepage/banner/apply/cancel";
+ /** 清空精选展示位并撤销流程中的申请 */
+ String REMOVE_BANNER_URL = "https://api.weixin.qq.com/channels/ec/basics/homepage/banner/remove";
+ }
+
/** 品牌资质相关接口 */
public interface Brand {
@@ -89,14 +131,24 @@ public interface Spu {
String SPU_LIST_URL = "https://api.weixin.qq.com/channels/ec/product/list/get";
/** 更新商品 */
String SPU_UPDATE_URL = "https://api.weixin.qq.com/channels/ec/product/update";
+ /** 更新商品 */
+ String SPU_AUDIT_FREE_UPDATE_URL = "https://api.weixin.qq.com/channels/ec/product/auditfree";
/** 上架商品 */
String SPU_LISTING_URL = "https://api.weixin.qq.com/channels/ec/product/listing";
/** 下架商品 */
String SPU_DELISTING_URL = "https://api.weixin.qq.com/channels/ec/product/delisting";
/** 撤回商品审核 */
String CANCEL_AUDIT_URL = "https://api.weixin.qq.com/channels/ec/product/audit/cancel";
+ /** 获取商品H5短链 */
+ String SPU_H5URL_URL = "https://api.weixin.qq.com/channels/ec/product/h5url/get";
+ /** 获取商品二维码 */
+ String SPU_QRCODE_URL = "https://api.weixin.qq.com/channels/ec/product/qrcode/get";
+ /** 获取商品口令 */
+ String SPU_TAGLINK_URL = "https://api.weixin.qq.com/channels/ec/product/taglink/get";
/** 获取实时库存 */
String SPU_GET_STOCK_URL = "https://api.weixin.qq.com/channels/ec/product/stock/get";
+ /** 获取实时库存 */
+ String SPU_GET_STOCK_BATCH_URL = "https://api.weixin.qq.com/channels/ec/product/stock/batchget";
/** 更新商品库存 */
String SPU_UPDATE_STOCK_URL = "https://api.weixin.qq.com/channels/ec/product/stock/update";
/** 添加限时抢购任务 */
@@ -155,6 +207,12 @@ public interface Order {
String REJECT_ADDRESS_MODIFY_URL = "https://api.weixin.qq.com/channels/ec/order/addressmodify/reject";
/** 订单搜索 */
String ORDER_SEARCH_URL = "https://api.weixin.qq.com/channels/ec/order/search";
+ /** 上传生鲜质检信息 */
+ String UPLOAD_FRESH_INSPECT_URL = "https://api.weixin.qq.com/channels/ec/order/freshinspect/submit";
+ /** 兑换虚拟号 */
+ String VIRTUAL_TEL_NUMBER_URL = "https://api.weixin.qq.com/channels/ec/order/virtualtelnumber/get";
+ /** 解码订单包含的敏感数据 */
+ String DECODE_SENSITIVE_INFO_URL = "https://api.weixin.qq.com/channels/ec/order/sensitiveinfo/decode";
}
/** 售后相关接口 */
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/enums/BannerType.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/enums/BannerType.java
new file mode 100644
index 0000000000..7cf11eb9ce
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/enums/BannerType.java
@@ -0,0 +1,37 @@
+package me.chanjar.weixin.channel.enums;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+/**
+ * 展示位类型
+ *
+ * @author Zeyes
+ */
+@JsonFormat(shape = JsonFormat.Shape.OBJECT)
+public enum BannerType {
+
+ /** 1 商品 */
+ PRODUCT(1, "商品"),
+ /** 3 视频号 */
+ CHANNEL(3, "视频号"),
+ /** 4 公众号 */
+ MP(4, "公众号");
+
+ ;
+
+ private final int key;
+ private final String value;
+
+ BannerType(int key, String value) {
+ this.key = key;
+ this.value = value;
+ }
+
+ public int getKey() {
+ return key;
+ }
+
+ public String getValue() {
+ return value;
+ }
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/enums/PackageAuditItemType.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/enums/PackageAuditItemType.java
new file mode 100644
index 0000000000..2929b2d381
--- /dev/null
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/enums/PackageAuditItemType.java
@@ -0,0 +1,37 @@
+package me.chanjar.weixin.channel.enums;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+/**
+ * 商品打包审核项
+ *
+ * @author Zeyes
+ */
+@JsonFormat(shape = JsonFormat.Shape.OBJECT)
+public enum PackageAuditItemType {
+ /** 商品快递单图片url */
+ EXPRESS_PIC("product_express_pic_url", "商品快递单图片url"),
+ /** 商品包装箱图片url */
+ BOX_PIC("product_packaging_box_pic_url", "商品包装箱图片url"),
+ /** 商品开箱图片url */
+ UNBOXING_PIC("product_unboxing_pic_url", "商品开箱图片url"),
+ /** 商品单个细节图片url */
+ DETAIL_PIC("single_product_detail_pic_url", "商品单个细节图片url"),
+ ;
+
+ public final String key;
+ public final String value;
+
+ PackageAuditItemType(String key, String value) {
+ this.key = key;
+ this.value = value;
+ }
+
+ public String getKey() {
+ return key;
+ }
+
+ public String getValue() {
+ return value;
+ }
+}
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/enums/ShareScene.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/enums/ShareScene.java
index b4428dbb24..e2fb09d132 100644
--- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/enums/ShareScene.java
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/enums/ShareScene.java
@@ -19,7 +19,18 @@ public enum ShareScene {
CHANNEL_HOME(4, "视频号主页"),
/** 5 商品详情页 */
PRODUCT_DETAIL(5, "商品详情页"),
-
+ /** 6 带商品的公众号文章 */
+ MP_ARTICLE(6, "带商品的公众号文章"),
+ /** 7 商品链接 */
+ PRODUCT_LINK(7, "商品链接"),
+ /** 8 商品二维码 */
+ PRODUCT_QR_CODE(8, "商品二维码"),
+ /** 9 商品口令 */
+ PRODUCT_TAG_LINK(9, "商品口令"),
+ /** 12 视频号橱窗链接 */
+ WINDOW_LINK(12, "视频号橱窗链接"),
+ /** 13 视频号橱窗二维码 */
+ WINDOW_QR_CODE(13, "视频号橱窗二维码"),
;
diff --git a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/enums/WxChannelErrorMsgEnum.java b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/enums/WxChannelErrorMsgEnum.java
index 4a699c20d0..18e88c0b08 100644
--- a/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/enums/WxChannelErrorMsgEnum.java
+++ b/weixin-java-channel/src/main/java/me/chanjar/weixin/channel/enums/WxChannelErrorMsgEnum.java
@@ -8,7 +8,9 @@
* 微信视频号全局返回码
*
* @author Zeyes
+ * @deprecated 请使用 {@link me.chanjar.weixin.common.error.WxChannelErrorMsgEnum} 替代
*/
+@Deprecated
@Getter
public enum WxChannelErrorMsgEnum {
/**
diff --git a/weixin-java-channel/src/test/java/me/chanjar/weixin/channel/api/impl/WxChannelBasicServiceImplTest.java b/weixin-java-channel/src/test/java/me/chanjar/weixin/channel/api/impl/WxChannelBasicServiceImplTest.java
index 5673d85439..120e11245a 100644
--- a/weixin-java-channel/src/test/java/me/chanjar/weixin/channel/api/impl/WxChannelBasicServiceImplTest.java
+++ b/weixin-java-channel/src/test/java/me/chanjar/weixin/channel/api/impl/WxChannelBasicServiceImplTest.java
@@ -20,6 +20,8 @@
import me.chanjar.weixin.channel.util.JsonUtils;
import me.chanjar.weixin.common.error.WxErrorException;
import org.apache.commons.io.FileUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;
@@ -29,9 +31,19 @@
@Guice(modules = ApiTestModule.class)
public class WxChannelBasicServiceImplTest {
+ private static final Logger log = LoggerFactory.getLogger(WxChannelBasicServiceImplTest.class);
+
@Inject
private WxChannelService channelService;
+ @Test
+ public void testGetAccessToken() throws WxErrorException {
+ String accessToken = channelService.getAccessToken();
+ assertNotNull(accessToken);
+ log.info("accessToken: \n{}\n\n", accessToken);
+ System.out.println(accessToken);
+ }
+
@Test
public void testGetShopInfo() throws WxErrorException {
WxChannelBasicService basicService = channelService.getBasicService();
diff --git a/weixin-java-channel/src/test/java/me/chanjar/weixin/channel/api/impl/WxChannelCategoryServiceImplTest.java b/weixin-java-channel/src/test/java/me/chanjar/weixin/channel/api/impl/WxChannelCategoryServiceImplTest.java
index 9b1a62ada3..125e061cd8 100644
--- a/weixin-java-channel/src/test/java/me/chanjar/weixin/channel/api/impl/WxChannelCategoryServiceImplTest.java
+++ b/weixin-java-channel/src/test/java/me/chanjar/weixin/channel/api/impl/WxChannelCategoryServiceImplTest.java
@@ -4,18 +4,24 @@
import static org.testng.Assert.assertTrue;
import com.google.inject.Inject;
-import java.util.ArrayList;
import java.util.List;
+import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.channel.api.WxChannelCategoryService;
import me.chanjar.weixin.channel.api.WxChannelService;
import me.chanjar.weixin.channel.bean.audit.AuditApplyResponse;
import me.chanjar.weixin.channel.bean.audit.AuditResponse;
+import me.chanjar.weixin.channel.bean.audit.CategoryAuditInfo;
+import me.chanjar.weixin.channel.bean.audit.CategoryAuditRequest;
import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
+import me.chanjar.weixin.channel.bean.category.CategoryAndQualificationList;
import me.chanjar.weixin.channel.bean.category.CategoryDetailResult;
+import me.chanjar.weixin.channel.bean.category.CategoryQualification;
import me.chanjar.weixin.channel.bean.category.CategoryQualificationResponse;
import me.chanjar.weixin.channel.bean.category.PassCategoryResponse;
import me.chanjar.weixin.channel.bean.category.ShopCategory;
+import me.chanjar.weixin.channel.bean.category.ShopCategoryResponse;
import me.chanjar.weixin.channel.test.ApiTestModule;
+import me.chanjar.weixin.channel.util.JsonUtils;
import me.chanjar.weixin.common.error.WxErrorException;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;
@@ -24,6 +30,7 @@
/**
* @author Zeyes
*/
+@Slf4j
@Guice(modules = ApiTestModule.class)
public class WxChannelCategoryServiceImplTest {
@@ -36,21 +43,40 @@ public void testListAllCategory() throws WxErrorException {
CategoryQualificationResponse response = categoryService.listAllCategory();
assertNotNull(response);
assertTrue(response.isSuccess());
- System.out.println(response);
+ //System.out.println(response);
+ // 测试分类:7231 瑜伽服上衣
+ for (CategoryAndQualificationList cat : response.getCatsV2()) {
+ if (cat.getList() == null) {
+ continue;
+ }
+ for (CategoryQualification qua : cat.getList()) {
+ if (qua.getCategory() == null) {
+ log.error("category is null");
+ }
+ if ("7231".equals(qua.getCategory().getId())) {
+ log.info("qua: {}", JsonUtils.encode(qua));
+ }
+ }
+ }
}
@Test
- public void testListAvailableCategory() throws WxErrorException {
+ public void testListAvailableCategories() throws WxErrorException {
WxChannelCategoryService categoryService = channelService.getCategoryService();
- List shopCategories = categoryService.listAvailableCategory("0");
- assertTrue(CollectionUtils.hasElements(shopCategories));
- shopCategories.forEach(System.out::println);
+ ShopCategoryResponse response = categoryService.listAvailableCategories("0");
+ assertNotNull(response);
+ assertTrue(response.isSuccess());
+ List v1 = response.getCategories();
+ List v2 = response.getCatListV2();
+ assertTrue(CollectionUtils.hasElements(v1) || CollectionUtils.hasElements(v2));
+ v1.forEach(System.out::println);
+ v2.forEach(System.out::println);
}
@Test
public void testGetCategoryDetail() throws WxErrorException {
WxChannelCategoryService categoryService = channelService.getCategoryService();
- CategoryDetailResult categoryDetail = categoryService.getCategoryDetail("1602");
+ CategoryDetailResult categoryDetail = categoryService.getCategoryDetail("7231");
assertNotNull(categoryDetail);
assertTrue(categoryDetail.isSuccess());
System.out.println(categoryDetail);
@@ -58,11 +84,47 @@ public void testGetCategoryDetail() throws WxErrorException {
@Test
public void testAddCategory() throws WxErrorException {
+// WxChannelCategoryService categoryService = channelService.getCategoryService();
+// List certificates = new ArrayList<>();
+// certificates.add(
+// "hWNith8iZSrxfN7W2tXOoWSXYWi1qADRJxwImvQl2DC6wqqJrl4g8i/UEZfd59yiiEKAnqy0WETFrOcGZFcJDfpH2ccmNZddzesR1/OpAC7bbfmEiDFBK2QL7MBjhR2m");
+// AuditApplyResponse response = categoryService.addCategory("1001", "1002", "1005", certificates);
+// assertNotNull(response);
+// assertTrue(response.isSuccess());
+// System.out.println(response);
+ String json = "{\n"
+ + " \"category_info\": {\n"
+ + " \"cats_v2\":[\n"
+ + " {\n"
+ + " \"cat_id\": 6033\n"
+ + " },\n"
+ + " {\n"
+ + " \"cat_id\": 6057\n"
+ + " },\n"
+ + " {\n"
+ + " \"cat_id\": 6091\n"
+ + " },\n"
+ + " {\n"
+ + " \"cat_id\": 6093\n"
+ + " }\n"
+ + " ],\n"
+ + " \"certificate\": [\n"
+ + " \"THE_FILE_ID_1\",\n"
+ + " \"THE_FILE_ID_2\"\n"
+ + " ],\n"
+ + " \"brand_list\" : [\n"
+ + " { \"brand_id\": 1001 },\n"
+ + " { \"brand_id\": 1002 }\n"
+ + " ]\n"
+ + " }\n"
+ + "}";
+ CategoryAuditRequest param = JsonUtils.decode(json, CategoryAuditRequest.class);
+ CategoryAuditInfo info = null;
+ if (info != null) {
+ info = param.getCategoryInfo();
+ }
WxChannelCategoryService categoryService = channelService.getCategoryService();
- List certificates = new ArrayList<>();
- certificates.add(
- "hWNith8iZSrxfN7W2tXOoWSXYWi1qADRJxwImvQl2DC6wqqJrl4g8i/UEZfd59yiiEKAnqy0WETFrOcGZFcJDfpH2ccmNZddzesR1/OpAC7bbfmEiDFBK2QL7MBjhR2m");
- AuditApplyResponse response = categoryService.addCategory("1001", "1002", "1005", certificates);
+ AuditApplyResponse response = categoryService.addCategory(info);
assertNotNull(response);
assertTrue(response.isSuccess());
System.out.println(response);
diff --git a/weixin-java-channel/src/test/java/me/chanjar/weixin/channel/api/impl/WxChannelOrderServiceImplTest.java b/weixin-java-channel/src/test/java/me/chanjar/weixin/channel/api/impl/WxChannelOrderServiceImplTest.java
index 2eb14b062e..78bd13e7d6 100644
--- a/weixin-java-channel/src/test/java/me/chanjar/weixin/channel/api/impl/WxChannelOrderServiceImplTest.java
+++ b/weixin-java-channel/src/test/java/me/chanjar/weixin/channel/api/impl/WxChannelOrderServiceImplTest.java
@@ -12,13 +12,16 @@
import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
import me.chanjar.weixin.channel.bean.delivery.DeliveryCompanyResponse;
import me.chanjar.weixin.channel.bean.delivery.DeliveryInfo;
+import me.chanjar.weixin.channel.bean.delivery.PackageAuditInfo;
import me.chanjar.weixin.channel.bean.order.ChangeOrderInfo;
+import me.chanjar.weixin.channel.bean.order.DecodeSensitiveInfoResponse;
import me.chanjar.weixin.channel.bean.order.DeliveryUpdateParam;
import me.chanjar.weixin.channel.bean.order.OrderAddressInfo;
import me.chanjar.weixin.channel.bean.order.OrderInfoResponse;
import me.chanjar.weixin.channel.bean.order.OrderListParam;
import me.chanjar.weixin.channel.bean.order.OrderListResponse;
import me.chanjar.weixin.channel.bean.order.OrderSearchParam;
+import me.chanjar.weixin.channel.bean.order.VirtualTelNumberResponse;
import me.chanjar.weixin.channel.test.ApiTestModule;
import me.chanjar.weixin.common.error.WxErrorException;
import org.testng.annotations.Guice;
@@ -148,4 +151,36 @@ public void testDeliveryOrder() throws WxErrorException {
assertNotNull(response);
assertTrue(response.isSuccess());
}
+
+ @Test
+ public void testUploadFreshInspect() throws WxErrorException {
+ WxChannelOrderService orderService = channelService.getOrderService();
+ String orderId = "123";
+ List items = new ArrayList<>();
+ items.add(new PackageAuditInfo("product_express_pic_url", "https://store.mp.video.tencent-cloud.com/x"));
+ items.add(new PackageAuditInfo("product_packaging_box_panoramic_video_url", "https://store.mp.video.tencent-cloud.com/y"));
+ items.add(new PackageAuditInfo("product_unboxing_panoramic_video_url", "https://store.mp.video.tencent-cloud.com/z"));
+ items.add(new PackageAuditInfo("single_product_detail_panoramic_video_url", "https://store.mp.video.tencent-cloud.com/a"));
+ WxChannelBaseResponse response = orderService.uploadFreshInspect(orderId, items);
+ assertNotNull(response);
+ assertTrue(response.isSuccess());
+ }
+
+ @Test
+ public void testGetVirtualTelNumber() throws WxErrorException {
+ WxChannelOrderService orderService = channelService.getOrderService();
+ String orderId = "123";
+ VirtualTelNumberResponse response = orderService.getVirtualTelNumber(orderId);
+ assertNotNull(response);
+ assertTrue(response.isSuccess());
+ }
+
+ @Test
+ public void testDecodeSensitiveInfo() throws WxErrorException {
+ WxChannelOrderService orderService = channelService.getOrderService();
+ String orderId = "123";
+ DecodeSensitiveInfoResponse response = orderService.decodeSensitiveInfo(orderId);
+ assertNotNull(response);
+ assertTrue(response.isSuccess());
+ }
}
diff --git a/weixin-java-channel/src/test/java/me/chanjar/weixin/channel/api/impl/WxChannelProductServiceImplTest.java b/weixin-java-channel/src/test/java/me/chanjar/weixin/channel/api/impl/WxChannelProductServiceImplTest.java
index b14bc9b3fc..ed83434ee0 100644
--- a/weixin-java-channel/src/test/java/me/chanjar/weixin/channel/api/impl/WxChannelProductServiceImplTest.java
+++ b/weixin-java-channel/src/test/java/me/chanjar/weixin/channel/api/impl/WxChannelProductServiceImplTest.java
@@ -4,17 +4,23 @@
import static org.testng.Assert.assertTrue;
import com.google.inject.Inject;
+import java.util.ArrayList;
+import java.util.List;
import me.chanjar.weixin.channel.api.WxChannelProductService;
import me.chanjar.weixin.channel.api.WxChannelService;
import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
import me.chanjar.weixin.channel.bean.limit.LimitTaskAddResponse;
import me.chanjar.weixin.channel.bean.limit.LimitTaskListResponse;
import me.chanjar.weixin.channel.bean.limit.LimitTaskParam;
+import me.chanjar.weixin.channel.bean.product.SkuStockBatchResponse;
import me.chanjar.weixin.channel.bean.product.SkuStockResponse;
import me.chanjar.weixin.channel.bean.product.SpuGetResponse;
-import me.chanjar.weixin.channel.bean.product.SpuInfo;
import me.chanjar.weixin.channel.bean.product.SpuListResponse;
+import me.chanjar.weixin.channel.bean.product.SpuUpdateInfo;
import me.chanjar.weixin.channel.bean.product.SpuUpdateResponse;
+import me.chanjar.weixin.channel.bean.product.link.ProductH5UrlResponse;
+import me.chanjar.weixin.channel.bean.product.link.ProductQrCodeResponse;
+import me.chanjar.weixin.channel.bean.product.link.ProductTagLinkResponse;
import me.chanjar.weixin.channel.test.ApiTestModule;
import me.chanjar.weixin.common.error.WxErrorException;
import org.testng.annotations.Guice;
@@ -32,7 +38,7 @@ public class WxChannelProductServiceImplTest {
@Test
public void testAddProduct() throws WxErrorException {
WxChannelProductService productService = channelService.getProductService();
- SpuInfo spuInfo = new SpuInfo();
+ SpuUpdateInfo spuInfo = new SpuUpdateInfo();
// ...
SpuUpdateResponse response = productService.addProduct(spuInfo);
assertNotNull(response);
@@ -42,7 +48,7 @@ public void testAddProduct() throws WxErrorException {
@Test
public void testUpdateProduct() throws WxErrorException {
WxChannelProductService productService = channelService.getProductService();
- SpuInfo spuInfo = new SpuInfo();
+ SpuUpdateInfo spuInfo = new SpuUpdateInfo();
// ...
SpuUpdateResponse response = productService.updateProduct(spuInfo);
assertNotNull(response);
@@ -121,13 +127,53 @@ public void testDownProduct() throws WxErrorException {
@Test
public void testGetSkuStock() throws WxErrorException {
WxChannelProductService productService = channelService.getProductService();
- String productId = "";
- String skuId = "";
+ String productId = "10000076089602";
+ String skuId = "1918289111";
SkuStockResponse response = productService.getSkuStock(productId, skuId);
assertNotNull(response);
assertTrue(response.isSuccess());
}
+ @Test
+ public void testGetSkuStockBatch() throws WxErrorException {
+ WxChannelProductService productService = channelService.getProductService();
+ List productIds = new ArrayList<>();
+ productIds.add("123");
+ SkuStockBatchResponse response = productService.getSkuStockBatch(productIds);
+ assertNotNull(response);
+ assertTrue(response.isSuccess());
+ }
+
+ @Test
+ public void testGetProductH5Url() throws WxErrorException {
+ WxChannelProductService productService = channelService.getProductService();
+ String productId = "";
+ ProductH5UrlResponse response = productService.getProductH5Url(productId);
+ assertNotNull(response);
+ assertTrue(response.isSuccess());
+ System.out.println(response.getProductH5url());
+ }
+
+ @Test
+ public void testGetProductQrCode() throws WxErrorException {
+ WxChannelProductService productService = channelService.getProductService();
+ String productId = "";
+ ProductQrCodeResponse response = productService.getProductQrCode(productId);
+ assertNotNull(response);
+ assertTrue(response.isSuccess());
+ System.out.println(response.getProductQrcode());
+ }
+
+ @Test
+ public void testGetProductTagLink() throws WxErrorException {
+ WxChannelProductService productService = channelService.getProductService();
+ String productId = "";
+ ProductTagLinkResponse response = productService.getProductTagLink(productId);
+ assertNotNull(response);
+ assertTrue(response.isSuccess());
+ System.out.println(response.getProductTaglink());
+ }
+
@Test
public void testAddLimitTask() throws WxErrorException {
WxChannelProductService productService = channelService.getProductService();
diff --git a/weixin-java-channel/src/test/java/me/chanjar/weixin/channel/api/impl/WxChannelVipServiceImplTest.java b/weixin-java-channel/src/test/java/me/chanjar/weixin/channel/api/impl/WxChannelVipServiceImplTest.java
new file mode 100644
index 0000000000..fdcf599e90
--- /dev/null
+++ b/weixin-java-channel/src/test/java/me/chanjar/weixin/channel/api/impl/WxChannelVipServiceImplTest.java
@@ -0,0 +1,32 @@
+package me.chanjar.weixin.channel.api.impl;
+
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
+import com.google.inject.Inject;
+import me.chanjar.weixin.channel.api.WxChannelService;
+import me.chanjar.weixin.channel.bean.vip.VipInfoResponse;
+import me.chanjar.weixin.channel.test.ApiTestModule;
+import me.chanjar.weixin.channel.util.JsonUtils;
+import me.chanjar.weixin.common.error.WxErrorException;
+import org.testng.annotations.Guice;
+import org.testng.annotations.Test;
+
+/**
+ * @author Zeyes
+ */
+@Guice(modules = ApiTestModule.class)
+public class WxChannelVipServiceImplTest {
+ @Inject
+ private WxChannelService channelService;
+
+ @Test
+ public void getVipInfo() throws WxErrorException {
+ String openId = "";
+ Boolean needPhoneNumber = false;
+ VipInfoResponse response = channelService.getVipService().getVipInfo(openId, needPhoneNumber);
+ System.out.println(JsonUtils.encode(response));
+ assertNotNull(response);
+ assertTrue(response.isSuccess());
+ }
+}
diff --git a/weixin-java-channel/src/test/java/me/chanjar/weixin/channel/api/impl/WxStoreHomePageServiceImplTest.java b/weixin-java-channel/src/test/java/me/chanjar/weixin/channel/api/impl/WxStoreHomePageServiceImplTest.java
new file mode 100644
index 0000000000..0d6bb8c479
--- /dev/null
+++ b/weixin-java-channel/src/test/java/me/chanjar/weixin/channel/api/impl/WxStoreHomePageServiceImplTest.java
@@ -0,0 +1,339 @@
+package me.chanjar.weixin.channel.api.impl;
+
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
+import com.google.inject.Inject;
+import me.chanjar.weixin.channel.api.WxStoreHomePageService;
+import me.chanjar.weixin.channel.api.WxChannelService;
+import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
+import me.chanjar.weixin.channel.bean.home.background.BackgroundApplyResponse;
+import me.chanjar.weixin.channel.bean.home.background.BackgroundGetResponse;
+import me.chanjar.weixin.channel.bean.home.banner.BannerApplyParam;
+import me.chanjar.weixin.channel.bean.home.banner.BannerApplyResponse;
+import me.chanjar.weixin.channel.bean.home.banner.BannerGetResponse;
+import me.chanjar.weixin.channel.bean.home.banner.BannerInfo;
+import me.chanjar.weixin.channel.bean.home.tree.TreeProductEditInfo;
+import me.chanjar.weixin.channel.bean.home.tree.TreeProductEditParam;
+import me.chanjar.weixin.channel.bean.home.tree.TreeProductListInfo;
+import me.chanjar.weixin.channel.bean.home.tree.TreeProductListResponse;
+import me.chanjar.weixin.channel.bean.home.tree.TreeShowGetResponse;
+import me.chanjar.weixin.channel.bean.home.tree.TreeShowInfo;
+import me.chanjar.weixin.channel.bean.home.tree.TreeShowParam;
+import me.chanjar.weixin.channel.bean.home.tree.TreeShowSetResponse;
+import me.chanjar.weixin.channel.bean.home.window.WindowProductSettingResponse;
+import me.chanjar.weixin.channel.test.ApiTestModule;
+import me.chanjar.weixin.channel.util.JsonUtils;
+import me.chanjar.weixin.common.error.WxErrorException;
+import org.testng.annotations.Guice;
+import org.testng.annotations.Test;
+
+/**
+ * @author Zeyes
+ */
+@Guice(modules = ApiTestModule.class)
+public class WxStoreHomePageServiceImplTest {
+
+ @Inject
+ private WxChannelService channelService;
+
+ @Test
+ public void testAddTreeProduct() throws WxErrorException {
+ WxStoreHomePageService service = channelService.getHomePageService();
+ // https://developers.weixin.qq.com/doc/store/API/homepage/classification/addclassificationproduct.html
+ String json = "{\n"
+ + " \"req\": {\n"
+ + " \"level_1_id\": 10000046,\n"
+ + " \"level_2_id\": 10000048,\n"
+ + " \"product_ids\": [\n"
+ + " 10000076089602\n"
+ + " ]\n"
+ + " }\n"
+ + "}";
+ TreeProductEditParam param = JsonUtils.decode(json, TreeProductEditParam.class);
+ TreeProductEditInfo info = null;
+ if (param != null) {
+ info = param.getReq();
+ }
+ WxChannelBaseResponse response = service.addTreeProduct(info);
+ assertNotNull(response);
+ assertTrue(response.isSuccess());
+ assertNotNull(info);
+ System.out.println(JsonUtils.encode(response));
+ }
+
+ @Test
+ public void testDelTreeProduct() throws WxErrorException {
+ WxStoreHomePageService service = channelService.getHomePageService();
+ String json = "{\n"
+ + " \"req\": {\n"
+ + " \"level_1_id\": 1,\n"
+ + " \"level_2_id\": 0,\n"
+ + " \"product_ids\": [\n"
+ + " 123\n"
+ + " ]\n"
+ + " }\n"
+ + "}";
+ TreeProductEditParam param = JsonUtils.decode(json, TreeProductEditParam.class);
+ TreeProductEditInfo info = null;
+ if (param != null) {
+ info = param.getReq();
+ }
+ WxChannelBaseResponse response = service.delTreeProduct(info);
+ assertNotNull(response);
+ assertTrue(response.isSuccess());
+ assertNotNull(info);
+ System.out.println(JsonUtils.encode(response));
+ }
+
+ @Test
+ public void testGetTreeProductList() throws WxErrorException {
+ WxStoreHomePageService service = channelService.getHomePageService();
+ String pageContext = "";
+ TreeProductListInfo info = new TreeProductListInfo();
+ info.setLevel1Id(1);
+ info.setLevel2Id(2);
+ info.setPageSize(10);
+ info.setPageContext(pageContext);
+ TreeProductListResponse response = service.getTreeProductList(info);
+ assertNotNull(response);
+ assertTrue(response.isSuccess());
+ assertNotNull(info);
+ System.out.println(JsonUtils.encode(response));
+ }
+
+ @Test
+ public void testSetShowTree() throws WxErrorException {
+ WxStoreHomePageService service = channelService.getHomePageService();
+ // https://developers.weixin.qq.com/doc/store/API/homepage/classification/setclassificationtree.html
+ String json = "{\n"
+ + " \"req\": {\n"
+ + " \"version\": 121,\n"
+ + " \"classification_id_deleted\": [\n"
+ + " \"1.2\"\n"
+ + " ],\n"
+ + " \"tree\": {\n"
+ + " \"level_1\": [\n"
+ + " {\n"
+ + " \"id\": 4,\n"
+ + " \"name\": \"测试7\",\n"
+ + " \"level_2\": [\n"
+ + " {\n"
+ + " \"id\": 5,\n"
+ + " \"name\": \"1\",\n"
+ + " \"is_displayed\": 1\n"
+ + " }\n"
+ + " ],\n"
+ + " \"is_displayed\": 1\n"
+ + " },\n"
+ + " {\n"
+ + " \"id\": 6,\n"
+ + " \"name\": \"测试8\",\n"
+ + " \"level_2\": [\n"
+ + " {\n"
+ + " \"id\": 7,\n"
+ + " \"name\": \"1\",\n"
+ + " \"is_displayed\": 1\n"
+ + " },\n"
+ + " {\n"
+ + " \"id\": 8,\n"
+ + " \"name\": \"2\",\n"
+ + " \"is_displayed\": 1\n"
+ + " }\n"
+ + " ],\n"
+ + " \"is_displayed\": 1\n"
+ + " }\n"
+ + " ]\n"
+ + " }\n"
+ + " }\n"
+ + "}";
+ TreeShowParam param = JsonUtils.decode(json, TreeShowParam.class);
+ TreeShowInfo info = null;
+ if (param != null) {
+ info = param.getReq();
+ }
+ TreeShowSetResponse response = service.setShowTree(info);
+ assertNotNull(response);
+ assertTrue(response.isSuccess());
+ assertNotNull(info);
+ System.out.println(JsonUtils.encode(response));
+ }
+
+ @Test
+ public void testGetShowTree() throws WxErrorException {
+ WxStoreHomePageService service = channelService.getHomePageService();
+ TreeShowGetResponse response = service.getShowTree();
+ assertNotNull(response);
+ assertTrue(response.isSuccess());
+ System.out.println(JsonUtils.encode(response));
+ }
+
+ @Test
+ public void testListWindowProduct() throws WxErrorException {
+ WxStoreHomePageService service = channelService.getHomePageService();
+ Integer pageSize = 1;
+ String nextKey = "";
+ WindowProductSettingResponse response = service.listWindowProduct(pageSize, nextKey);
+ assertNotNull(response);
+ assertTrue(response.isSuccess());
+ System.out.println(JsonUtils.encode(response));
+ }
+
+ @Test
+ public void testReorderWindowProduct() throws WxErrorException {
+ WxStoreHomePageService service = channelService.getHomePageService();
+ String productId = "";
+ Integer indexNum = 100;
+ WxChannelBaseResponse response = service.reorderWindowProduct(productId, indexNum);
+ assertNotNull(response);
+ assertTrue(response.isSuccess());
+ System.out.println(JsonUtils.encode(response));
+ }
+
+ @Test
+ public void testHideWindowProduct() throws WxErrorException {
+ WxStoreHomePageService service = channelService.getHomePageService();
+ String productId = "";
+ // 0:显示 1:隐藏
+ Integer setHide = 0;
+ WxChannelBaseResponse response = service.hideWindowProduct(productId, setHide);
+ assertNotNull(response);
+ assertTrue(response.isSuccess());
+ System.out.println(JsonUtils.encode(response));
+ }
+
+ @Test
+ public void testTopWindowProduct() throws WxErrorException {
+ WxStoreHomePageService service = channelService.getHomePageService();
+ String productId = "";
+ // 0:取消置顶 1:置顶
+ Integer setTop = 0;
+ WxChannelBaseResponse response = service.topWindowProduct(productId, setTop);
+ assertNotNull(response);
+ assertTrue(response.isSuccess());
+ System.out.println(JsonUtils.encode(response));
+ }
+
+ @Test
+ public void testApplyBackground() throws WxErrorException {
+ WxStoreHomePageService service = channelService.getHomePageService();
+ String imgUrl = "https://github.githubassets.com/images/icons/emoji/octocat.png";
+ BackgroundApplyResponse response = service.applyBackground(imgUrl);
+ assertNotNull(response);
+ assertTrue(response.isSuccess());
+ System.out.println(JsonUtils.encode(response));
+ }
+
+ @Test
+ public void testGetBackground() throws WxErrorException {
+ WxStoreHomePageService service = channelService.getHomePageService();
+ BackgroundGetResponse response = service.getBackground();
+ assertNotNull(response);
+ assertTrue(response.isSuccess());
+ System.out.println(JsonUtils.encode(response));
+ }
+
+ @Test
+ public void testCancelBackground() throws WxErrorException {
+ Integer applyId = 1;
+ WxStoreHomePageService service = channelService.getHomePageService();
+ WxChannelBaseResponse response = service.cancelBackground(applyId);
+ assertNotNull(response);
+ assertTrue(response.isSuccess());
+ System.out.println(JsonUtils.encode(response));
+ }
+
+ @Test
+ public void testRemoveBackground() throws WxErrorException {
+ WxStoreHomePageService service = channelService.getHomePageService();
+ WxChannelBaseResponse response = service.removeBackground();
+ assertNotNull(response);
+ assertTrue(response.isSuccess());
+ System.out.println(JsonUtils.encode(response));
+ }
+
+ @Test
+ public void testApplyBanner() throws WxErrorException {
+ WxStoreHomePageService service = channelService.getHomePageService();
+ // https://developers.weixin.qq.com/doc/store/API/homepage/banner/submit_banner_apply.html
+ String json = "{\n"
+ + " \"banner\": {\n"
+ + " \"scale\": 2,\n"
+ + " \"banner\": [\n"
+ + " {\n"
+ + " \"type\": 1,\n"
+ + " \"product\": {\n"
+ + " \"product_id\": 123\n"
+ + " },\n"
+ + " \"banner\": {\n"
+ + " \"description\": \"测试商品精品展示位描述\",\n"
+ + " \"img_url\": \"https://store.mp.video.tencent-cloud.com/abc\",\n"
+ + " \"title\": \"测试商品精品展示位标题\"\n"
+ + " }\n"
+ + " },\n"
+ + " {\n"
+ + " \"type\": 3,\n"
+ + " \"finder\": {\n"
+ + " \"feed_id\": \"export/abc\",\n"
+ + " \"finder_user_name\": \"sphabc\"\n"
+ + " },\n"
+ + " \"banner\": {\n"
+ + " \"description\": \"测试视频号视频精品展示位描述\",\n"
+ + " \"img_url\": \"https://store.mp.video.tencent-cloud.com/abc\",\n"
+ + " \"title\": \"测试视频号视频精品展示位标题\"\n"
+ + " }\n"
+ + " },\n"
+ + " {\n"
+ + " \"type\": 4,\n"
+ + " \"official_account\": {\n"
+ + " \"url\": \"https://mp.weixin.qq.com/abc\"\n"
+ + " },\n"
+ + " \"banner\": {\n"
+ + " \"description\": \"测试公众号文章精品展示位描述\",\n"
+ + " \"img_url\": \"https://store.mp.video.tencent-cloud.com/abc\",\n"
+ + " \"title\": \"测试公众号文章精品展示位标题\"\n"
+ + " }\n"
+ + " }\n"
+ + " ]\n"
+ + " }\n"
+ + "}";
+ BannerApplyParam param = JsonUtils.decode(json, BannerApplyParam.class);
+ BannerInfo info = null;
+ if (param != null) {
+ info = param.getBanner();
+ }
+ BannerApplyResponse response = service.applyBanner(info);
+ assertNotNull(response);
+ assertTrue(response.isSuccess());
+ assertNotNull(info);
+ System.out.println(JsonUtils.encode(response));
+ }
+
+ @Test
+ public void testGetBanner() throws WxErrorException {
+ WxStoreHomePageService service = channelService.getHomePageService();
+ BannerGetResponse response = service.getBanner();
+ assertNotNull(response);
+ assertTrue(response.isSuccess());
+ System.out.println(JsonUtils.encode(response));
+ }
+
+ @Test
+ public void testCancelBanner() throws WxErrorException {
+ Integer applyId = 1;
+ WxStoreHomePageService service = channelService.getHomePageService();
+ WxChannelBaseResponse response = service.cancelBanner(applyId);
+ assertNotNull(response);
+ assertTrue(response.isSuccess());
+ System.out.println(JsonUtils.encode(response));
+ }
+
+ @Test
+ public void testRemoveBanner() throws WxErrorException {
+ WxStoreHomePageService service = channelService.getHomePageService();
+ WxChannelBaseResponse response = service.removeBanner();
+ assertNotNull(response);
+ assertTrue(response.isSuccess());
+ System.out.println(JsonUtils.encode(response));
+ }
+}
diff --git a/weixin-java-channel/src/test/java/me/chanjar/weixin/channel/message/WxChannelMessageRouterTest.java b/weixin-java-channel/src/test/java/me/chanjar/weixin/channel/message/WxChannelMessageRouterTest.java
index 755886fa4b..4c39d45382 100644
--- a/weixin-java-channel/src/test/java/me/chanjar/weixin/channel/message/WxChannelMessageRouterTest.java
+++ b/weixin-java-channel/src/test/java/me/chanjar/weixin/channel/message/WxChannelMessageRouterTest.java
@@ -1,7 +1,9 @@
package me.chanjar.weixin.channel.message;
import static me.chanjar.weixin.channel.constant.MessageEventConstants.BRAND;
+import static me.chanjar.weixin.channel.constant.MessageEventConstants.CLOSE_STORE;
import static me.chanjar.weixin.channel.constant.MessageEventConstants.PRODUCT_SPU_AUDIT;
+import static me.chanjar.weixin.channel.constant.MessageEventConstants.SET_SHOP_NICKNAME;
import static org.testng.Assert.*;
import com.google.inject.Inject;
@@ -10,6 +12,8 @@
import me.chanjar.weixin.channel.api.WxChannelService;
import me.chanjar.weixin.channel.bean.message.product.BrandMessage;
import me.chanjar.weixin.channel.bean.message.product.SpuAuditMessage;
+import me.chanjar.weixin.channel.bean.message.store.CloseStoreMessage;
+import me.chanjar.weixin.channel.bean.message.store.NicknameUpdateMessage;
import me.chanjar.weixin.channel.message.rule.HandlerConsumer;
import me.chanjar.weixin.channel.test.ApiTestModule;
import me.chanjar.weixin.channel.util.JsonUtils;
@@ -56,6 +60,48 @@ public void test1() {
}
}
+ @Test
+ public void closeStore() {
+ WxChannelMessageRouter router = new WxChannelMessageRouter();
+ /* 小店注销 */
+ this.addRule(router, CloseStoreMessage.class, CLOSE_STORE, this::closeStore);
+ /* 小店修改名称 */
+ this.addRule(router, NicknameUpdateMessage.class, SET_SHOP_NICKNAME, this::updateNickname);
+ String closeStoreJson = "{\n"
+ + " \"ToUserName\": \"gh_*\",\n"
+ + " \"FromUserName\": \"OPENID\",\n"
+ + " \"CreateTime\": 1662480000,\n"
+ + " \"MsgType\": \"event\",\n"
+ + " \"Event\": \"channels_ec_close_store\",\n"
+ + " \"appid\": \"APPID\",\n"
+ + " \"close_timestamp\": \"1662480000\"\n"
+ + "}";
+ String updateNicknameJson = "{\n"
+ + " \"ToUserName\": \"gh_*\", \n"
+ + " \"FromUserName\": \"OPENID\", \n"
+ + " \"CreateTime\": 1662480000, \n"
+ + " \"MsgType\": \"event\", \n"
+ + " \"Event\": \"set_shop_nickname\", \n"
+ + " \"appid\": \"APPID\",\n"
+ + " \"old_nickname\": \"旧昵称\",\n"
+ + " \"new_nickname\": \"新昵称\"\n"
+ + "}";
+ WxChannelMessage message1 = JsonUtils.decode(closeStoreJson, WxChannelMessage.class);
+ WxChannelMessage message2 = JsonUtils.decode(updateNicknameJson, WxChannelMessage.class);
+ Object result1 = router.route(message1, closeStoreJson, "123456", channelService);
+ if (result1 != null) {
+ log.info("result1:{}", result1);
+ } else {
+ log.info("result1 return null");
+ }
+ Object result2 = router.route(message2, updateNicknameJson, "123456", channelService);
+ if (result2 != null) {
+ log.info("result2:{}", result2);
+ } else {
+ log.info("result2 return null");
+ }
+ }
+
public void brandUpdate(BrandMessage message, String content, String appId,
Map context, WxSessionManager sessionManager) {
log.info("品牌更新:{}", JsonUtils.encode(message));
@@ -67,6 +113,16 @@ public void spuAudit(SpuAuditMessage message, String content, String appId,
log.info("商品审核:{}", JsonUtils.encode(message));
}
+ public void closeStore(CloseStoreMessage message, String content, String appId,
+ Map context, WxSessionManager sessionManager) {
+ log.info("小店注销:{}", JsonUtils.encode(message));
+ }
+
+ public void updateNickname(NicknameUpdateMessage message, String content, String appId,
+ Map context, WxSessionManager sessionManager) {
+ log.info("昵称更新:{}", JsonUtils.encode(message));
+ }
+
/**
* 添加一条规则进入路由器
*
diff --git a/weixin-java-channel/src/test/java/me/chanjar/weixin/channel/test/ApiTestModule.java b/weixin-java-channel/src/test/java/me/chanjar/weixin/channel/test/ApiTestModule.java
index 8eba81a07e..ddfb3a4b8a 100644
--- a/weixin-java-channel/src/test/java/me/chanjar/weixin/channel/test/ApiTestModule.java
+++ b/weixin-java-channel/src/test/java/me/chanjar/weixin/channel/test/ApiTestModule.java
@@ -29,6 +29,7 @@ public void configure(Binder binder) {
"测试配置文件【" + TEST_CONFIG_XML + "】未找到,请参照test-config-sample.xml文件生成");
}
+ // 提示xml相关依赖不存在时,引入一下就好
TestConfig config = this.fromXml(TestConfig.class, inputStream);
WxChannelService service = new WxChannelServiceImpl();
diff --git a/weixin-java-channel/src/test/resources/test-config.sample.xml b/weixin-java-channel/src/test/resources/test-config.sample.xml
index b04a50e5a7..b84d8d9109 100644
--- a/weixin-java-channel/src/test/resources/test-config.sample.xml
+++ b/weixin-java-channel/src/test/resources/test-config.sample.xml
@@ -4,6 +4,7 @@
secret
Token
EncodingAESKey
+ false
可以不填写
可以不填写
diff --git a/weixin-java-common/src/main/java/me/chanjar/weixin/common/error/WxChannelErrorMsgEnum.java b/weixin-java-common/src/main/java/me/chanjar/weixin/common/error/WxChannelErrorMsgEnum.java
new file mode 100644
index 0000000000..3491e74dc8
--- /dev/null
+++ b/weixin-java-common/src/main/java/me/chanjar/weixin/common/error/WxChannelErrorMsgEnum.java
@@ -0,0 +1,172 @@
+package me.chanjar.weixin.common.error;
+
+import com.google.common.collect.Maps;
+import java.util.Map;
+
+/**
+ *
+ *
+ * 微信小店公共错误码.
+ * 参考文档:微信小店公共错误码
+ *
+ *
+ * @author Zeyes
+ */
+public enum WxChannelErrorMsgEnum {
+ /**
+ * 系统繁忙,此时请开发者稍候再试 system error
+ */
+ CODE_1(-1, "系统繁忙,此时请开发者稍候再试"),
+ /**
+ * 请求成功 ok
+ */
+ CODE_0(0, "请求成功"),
+ /**
+ * 获取 access_token 时 AppSecret 错误,或者 access_token 无效。请开发者认真检查 AppSecret 的正确性
+ * invalid credential, access_token is invalid or not latest, could get access_token by getStableAccessToken, more details at https://mmbizurl.cn/s/JtxxFh33r
+ */
+ CODE_40001(40001, "获取 access_token 时 AppSecret 错误,或者 access_token 无效。请开发者认真检查 AppSecret 的正确性"),
+ /**
+ * 请检查 openid 的正确性
+ * invalid openid
+ */
+ CODE_40003(40003, "请检查 openid 的正确性"),
+ /**
+ * 请检查 appid 的正确性,避免异常字符,注意大小写
+ * invalid appid
+ */
+ CODE_40013(40013, "请检查 appid 的正确性,避免异常字符,注意大小写"),
+ /**
+ * 请检查API的URL是否与文档一致
+ * invalid url
+ */
+ CODE_40066(40066, "请检查API的URL是否与文档一致"),
+ /**
+ * 缺少 access_token 参数
+ * access_token missing
+ */
+ CODE_41001(41001, "缺少 access_token 参数"),
+ /**
+ * 请检查URL参数中是否有 ?appid=
+ * appid missing
+ */
+ CODE_41002(41002, "请检查URL参数中是否有 ?appid="),
+ /**
+ * 请检查POST json中是否包含component_ appid宇段
+ * missing component_appid
+ */
+ CODE_41018(41018, "请检查POST json中是否包含component_ appid宇段"),
+ /**
+ * access_token失效,需要重新获取新的access_token
+ * access_token expired
+ */
+ CODE_42001(42001, "access_token失效,需要重新获取新的access_token"),
+ /**
+ * 请检查发起API请求的Method是否为POST
+ * require POST method
+ */
+ CODE_43002(43002, "请检查发起API请求的Method是否为POST"),
+ /**
+ * 请使用HTTPS方式清求,不要使用HTTP方式
+ * require https
+ */
+ CODE_43003(43003, "请使用HTTPS方式清求,不要使用HTTP方式"),
+ /**
+ * POST 的数据包为空
+ * empty post data
+ */
+ CODE_44002(44002, "POST 的数据包为空"),
+ /**
+ * 请对数据进行压缩
+ * content size out of limit
+ */
+ CODE_45002(45002, "请对数据进行压缩"),
+ /**
+ * 查看调用次数是否符合预期,可通过get_api_quota接口获取每天的调用quota;用完后可通过clear_quota进行清空
+ * reach max api daily quota limit
+ */
+ CODE_45009(45009, "查看调用次数是否符合预期,可通过get_api_quota接口获取每天的调用quota;用完后可通过clear_quota进行清空"),
+ /**
+ * 命中每分钟的频率限制
+ * api minute-quota reach limit must slower retry next minute
+ */
+ CODE_45011(45011, "命中每分钟的频率限制"),
+ /**
+ * 需要登录 channels.weixin.qq.com/shop 配置IP白名单
+ * access clientip is not registered, not in ip-white-list
+ */
+ CODE_45035(45035, "需要登录 channels.weixin.qq.com/shop 配置IP白名单"),
+ /**
+ * 解析 JSON/XML 内容错误
+ * data format error
+ */
+ CODE_47001(47001, "解析 JSON/XML 内容错误"),
+ /**
+ * 没有该接口权限
+ * api unauthorized
+ */
+ CODE_48001(48001, "没有该接口权限"),
+ /**
+ * 接口被禁用
+ * api forbidden for irregularities
+ */
+ CODE_48004(48004, "接口被禁用"),
+ /**
+ * 请找用户获取该api授权
+ * user unauthorized
+ */
+ CODE_50001(50001, "请找用户获取该api授权"),
+ /**
+ * 请检查封禁原因
+ * user limited
+ */
+ CODE_50002(50002, "请检查封禁原因"),
+ /**
+ * 需要登录 channels.weixin.qq.com/shop 配置IP白名单
+ * access clientip is not registered, not in ip-white-list
+ */
+ CODE_61004(61004, "需要登录 channels.weixin.qq.com/shop 配置IP白名单"),
+ /**
+ * 请检查第三方平台服务商检查已获取的授权集
+ * api is unauthorized to component
+ */
+ CODE_61007(61007, "请检查第三方平台服务商检查已获取的授权集"),
+ /**
+ * 需要登录 channels.weixin.qq.com/shop 继续完成注销
+ * 账号发起注销,进入注销公示期
+ */
+ CODE_10080000(10080000, "需要登录 channels.weixin.qq.com/shop 继续完成注销"),
+ /**
+ * 账号已注销
+ */
+ CODE_10080001(10080001, "账号已注销"),
+ /**
+ * 小店的视频号带货身份为达人号,不允许使用该功能,如需使用,请将带货身份修改为商家
+ */
+ CODE_10080002(10080002, "小店的视频号带货身份为达人号,不允许使用该功能,如需使用,请将带货身份修改为商家"),
+
+ ;
+
+ private final int code;
+ private final String msg;
+
+ WxChannelErrorMsgEnum(int code, String msg) {
+ this.code = code;
+ this.msg = msg;
+ }
+
+ static final Map valueMap = Maps.newHashMap();
+
+ static {
+ for (WxChannelErrorMsgEnum value : WxChannelErrorMsgEnum.values()) {
+ valueMap.put(value.code, value.msg);
+ }
+ }
+
+ /**
+ * 通过错误代码查找其中文含义.
+ */
+ public static String findMsgByCode(int code) {
+ return valueMap.getOrDefault(code, null);
+ }
+}
diff --git a/weixin-java-common/src/main/java/me/chanjar/weixin/common/error/WxError.java b/weixin-java-common/src/main/java/me/chanjar/weixin/common/error/WxError.java
index 1156636ea3..b45fba3411 100644
--- a/weixin-java-common/src/main/java/me/chanjar/weixin/common/error/WxError.java
+++ b/weixin-java-common/src/main/java/me/chanjar/weixin/common/error/WxError.java
@@ -91,6 +91,13 @@ public static WxError fromJson(String json, WxType type) {
}
break;
}
+ case Channel: {
+ final String msg = WxChannelErrorMsgEnum.findMsgByCode(wxError.getErrorCode());
+ if (msg != null) {
+ wxError.setErrorMsg(msg);
+ }
+ break;
+ }
default:
return wxError;
}