Skip to content

Commit 99621ae

Browse files
authored
🆕 #3850 【视频号】小店 SDK 添加类目权限管理接口和商品 SPU 信息扩展
1 parent 5947f24 commit 99621ae

File tree

13 files changed

+212
-18
lines changed

13 files changed

+212
-18
lines changed

weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxChannelCategoryService.java

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,7 @@
66
import me.chanjar.weixin.channel.bean.audit.AuditResponse;
77
import me.chanjar.weixin.channel.bean.audit.CategoryAuditInfo;
88
import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
9-
import me.chanjar.weixin.channel.bean.category.CategoryDetailResult;
10-
import me.chanjar.weixin.channel.bean.category.CategoryQualificationResponse;
11-
import me.chanjar.weixin.channel.bean.category.PassCategoryResponse;
12-
import me.chanjar.weixin.channel.bean.category.ShopCategory;
13-
import me.chanjar.weixin.channel.bean.category.ShopCategoryResponse;
9+
import me.chanjar.weixin.channel.bean.category.*;
1410
import me.chanjar.weixin.common.error.WxErrorException;
1511

1612
/**
@@ -121,4 +117,16 @@ AuditApplyResponse addCategory(String level1, String level2, String level3, List
121117
* @throws WxErrorException 异常
122118
*/
123119
PassCategoryResponse listPassCategory() throws WxErrorException;
120+
121+
/**
122+
* 获取店铺的类目权限列表
123+
*
124+
* @param isFilterStatus 是否按状态筛选
125+
* @param status 类目状态(当 isFilterStatus 为 true 时有效)
126+
* @return 类目权限列表
127+
*
128+
* @throws WxErrorException 异常
129+
*/
130+
RelationCategoryResponse listRelationCategory(Boolean isFilterStatus, Integer status) throws WxErrorException;
131+
124132
}

weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/WxChannelCategoryServiceImpl.java

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
package me.chanjar.weixin.channel.api.impl;
22

3-
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Category.ADD_CATEGORY_URL;
4-
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Category.AVAILABLE_CATEGORY_URL;
5-
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Category.CANCEL_CATEGORY_AUDIT_URL;
6-
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Category.GET_CATEGORY_AUDIT_URL;
7-
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Category.GET_CATEGORY_DETAIL_URL;
8-
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Category.LIST_ALL_CATEGORY_URL;
9-
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Category.LIST_PASS_CATEGORY_URL;
10-
113
import java.util.Collections;
124
import java.util.List;
135
import lombok.extern.slf4j.Slf4j;
@@ -17,17 +9,15 @@
179
import me.chanjar.weixin.channel.bean.audit.CategoryAuditInfo;
1810
import me.chanjar.weixin.channel.bean.audit.CategoryAuditRequest;
1911
import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
20-
import me.chanjar.weixin.channel.bean.category.CategoryDetailResult;
21-
import me.chanjar.weixin.channel.bean.category.CategoryQualificationResponse;
22-
import me.chanjar.weixin.channel.bean.category.PassCategoryResponse;
23-
import me.chanjar.weixin.channel.bean.category.ShopCategory;
24-
import me.chanjar.weixin.channel.bean.category.ShopCategoryResponse;
12+
import me.chanjar.weixin.channel.bean.category.*;
2513
import me.chanjar.weixin.channel.util.JsonUtils;
2614
import me.chanjar.weixin.channel.util.ResponseUtils;
2715
import me.chanjar.weixin.common.error.WxErrorException;
2816
import me.chanjar.weixin.common.util.http.SimpleGetRequestExecutor;
2917
import me.chanjar.weixin.common.util.http.SimplePostRequestExecutor;
3018

19+
import static me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.Category.*;
20+
3121
/**
3222
* 视频号小店 商品类目相关接口
3323
*
@@ -135,4 +125,15 @@ public PassCategoryResponse listPassCategory() throws WxErrorException {
135125
return ResponseUtils.decode(resJson, PassCategoryResponse.class);
136126
}
137127

128+
@Override
129+
public RelationCategoryResponse listRelationCategory(Boolean isFilterStatus, Integer status) throws WxErrorException {
130+
RelationCategoryRequest request = new RelationCategoryRequest(
131+
isFilterStatus != null ? isFilterStatus : false,
132+
status != null ? status : 0
133+
);
134+
String reqJson = JsonUtils.encode(request);
135+
String resJson = shopService.post(LIST_RELATION_CATEGORY_URL, reqJson);
136+
return ResponseUtils.decode(resJson, RelationCategoryResponse.class);
137+
}
138+
138139
}

weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/category/CategoryDetailResult.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ public class CategoryDetailResult extends WxChannelBaseResponse {
2222
@JsonProperty("attr")
2323
private Attr attr;
2424

25+
@JsonProperty("product_qua_list")
26+
private List<QualificationInfo> productQuaList;
27+
2528

2629
@Data
2730
@NoArgsConstructor
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package me.chanjar.weixin.channel.bean.category;
2+
3+
import com.fasterxml.jackson.annotation.JsonProperty;
4+
import lombok.Data;
5+
import lombok.NoArgsConstructor;
6+
7+
import java.io.Serializable;
8+
9+
/**
10+
* 店铺类目权限列表项
11+
*
12+
* @author <a href="https://gitee.com/cchengg">chucheng</a>
13+
*/
14+
@Data
15+
@NoArgsConstructor
16+
public class RelationCategoryItem implements Serializable {
17+
18+
/** 类目id */
19+
@JsonProperty("id")
20+
private Long id;
21+
22+
/** 类目状态, 1生效中,2已失效 */
23+
@JsonProperty("status")
24+
private Integer status;
25+
26+
/** 失效原因 */
27+
@JsonProperty("uneffective_reason")
28+
private String uneffectiveReason;
29+
30+
/** 生效时间 */
31+
@JsonProperty("effective_time")
32+
private Long effectiveTime;
33+
34+
/** 失效时间 */
35+
@JsonProperty("uneffective_time")
36+
private Long uneffectiveTime;
37+
38+
/** 类目资质id */
39+
@JsonProperty("qua_id")
40+
private Long quaId;
41+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package me.chanjar.weixin.channel.bean.category;
2+
3+
import com.fasterxml.jackson.annotation.JsonProperty;
4+
import java.io.Serializable;
5+
import lombok.AllArgsConstructor;
6+
import lombok.Data;
7+
import lombok.NoArgsConstructor;
8+
9+
/**
10+
* 类目权限列表请求参数
11+
*
12+
* @author <a href="https://github.com/lixize">Zeyes</a>
13+
*/
14+
@Data
15+
@NoArgsConstructor
16+
@AllArgsConstructor
17+
public class RelationCategoryRequest implements Serializable {
18+
19+
private static final long serialVersionUID = -8765432109876543210L;
20+
21+
/** 是否按状态筛选 */
22+
@JsonProperty("is_filter_status")
23+
private Boolean isFilterStatus;
24+
25+
/** 类目状态(当 isFilterStatus 为 true 时有效) */
26+
@JsonProperty("status")
27+
private Integer status;
28+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package me.chanjar.weixin.channel.bean.category;
2+
3+
import com.fasterxml.jackson.annotation.JsonProperty;
4+
import java.util.List;
5+
import lombok.Data;
6+
import lombok.EqualsAndHashCode;
7+
import lombok.NoArgsConstructor;
8+
import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
9+
10+
/**
11+
* 店铺的类目权限列表响应
12+
*
13+
* @author <a href="https://gitee.com/cchengg">chucheng</a>
14+
*/
15+
@Data
16+
@NoArgsConstructor
17+
@EqualsAndHashCode(callSuper = true)
18+
public class RelationCategoryResponse extends WxChannelBaseResponse {
19+
20+
private static final long serialVersionUID = -8473920857463918245L;
21+
22+
@JsonProperty("list")
23+
private List<RelationCategoryItem> list;
24+
25+
}

weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SkuFastInfo.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@ public class SkuFastInfo implements Serializable {
3535
@JsonProperty("is_delete")
3636
private Boolean delete;
3737

38+
/** 商品sku编码 */
39+
@JsonProperty("sku_code")
40+
private String skuCode;
41+
42+
/** 更新sku状态 0-默认值;5-上架;11-下架 */
43+
@JsonProperty("status")
44+
private Integer status;
45+
3846

3947
@Data
4048
@NoArgsConstructor

weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SkuInfo.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ public class SkuInfo implements Serializable {
5656
@JsonProperty("sku_id")
5757
private String skuId;
5858

59+
/** sku条形码 */
60+
@JsonProperty("bar_code")
61+
private String barCode;
62+
5963
public SkuInfo() {
6064
}
6165

weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SpuFastInfo.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,28 @@ public class SpuFastInfo implements Serializable {
2525
@JsonProperty("skus")
2626
protected List<SkuFastInfo> skus;
2727

28+
/** 商品编码 */
29+
@JsonProperty("spu_code")
30+
protected String spuCode;
31+
32+
/** 限购信息 */
33+
@JsonProperty("limit_info")
34+
protected LimitInfo limitInfo;
35+
36+
/** 运费信息 */
37+
@JsonProperty("express_info")
38+
protected ExpressInfo expressInfo;
39+
40+
/** 额外服务 */
41+
@JsonProperty("extra_service")
42+
protected ExtraServiceInfo extraService;
43+
44+
/** 发货方式:0-快递发货;1-无需快递,手机号发货;3-无需快递,可选发货账号类型,默认为0,若为无需快递,则无需填写运费模版id */
45+
@JsonProperty("deliver_method")
46+
private Integer deliverMethod;
47+
48+
/** 商品待开售信息 */
49+
@JsonProperty("timing_onsale_info")
50+
private TimingOnSaleInfo timingOnSaleInfo;
51+
2852
}

weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/product/SpuInfo.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,4 +151,8 @@ public class SpuInfo extends SpuSimpleInfo {
151151
/** 发布模式,0: 普通模式;1: 极简模式 */
152152
@JsonProperty("release_mode")
153153
private Integer releaseMode;
154+
155+
/** 商品待开售信息 */
156+
@JsonProperty("timing_onsale_info")
157+
private TimingOnSaleInfo timingOnSaleInfo;
154158
}

0 commit comments

Comments
 (0)