Skip to content

Commit 851676b

Browse files
committed
feat(channel): 添加店铺类目权限列表的接口
1 parent eb4692e commit 851676b

File tree

5 files changed

+91
-18
lines changed

5 files changed

+91
-18
lines changed

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

Lines changed: 11 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,14 @@ AuditApplyResponse addCategory(String level1, String level2, String level3, List
121117
* @throws WxErrorException 异常
122118
*/
123119
PassCategoryResponse listPassCategory() throws WxErrorException;
120+
121+
/**
122+
* 获取店铺的类目权限列表
123+
*
124+
* @return 类目权限列表
125+
*
126+
* @throws WxErrorException 异常
127+
*/
128+
RelationCategoryResponse listRelationCategory(Boolean isFilterStatus, Integer status) throws WxErrorException;
129+
124130
}

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

Lines changed: 11 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,12 @@ 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+
String reqJson = "{\"is_filter_status\": " + (isFilterStatus != null ? isFilterStatus : false) +
131+
", \"status\": " + (status != null ? status : 0) + "}";
132+
String resJson = shopService.post(LIST_RELATION_CATEGORY_URL, reqJson);
133+
return ResponseUtils.decode(resJson, RelationCategoryResponse.class);
134+
}
135+
138136
}
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: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
package me.chanjar.weixin.channel.bean.category;
3+
4+
import com.fasterxml.jackson.annotation.JsonProperty;
5+
import java.util.List;
6+
import lombok.Data;
7+
import lombok.EqualsAndHashCode;
8+
import lombok.NoArgsConstructor;
9+
import me.chanjar.weixin.channel.bean.base.WxChannelBaseResponse;
10+
11+
/**
12+
* 店铺的类目权限列表响应
13+
*
14+
* @author <a href="https://gitee.com/cchengg">chucheng</a>
15+
*/
16+
@Data
17+
@NoArgsConstructor
18+
@EqualsAndHashCode(callSuper = true)
19+
public class RelationCategoryResponse extends WxChannelBaseResponse {
20+
21+
private static final long serialVersionUID = -8473920857463918245L;
22+
23+
@JsonProperty("list")
24+
private List<RelationCategoryItem> list;
25+
26+
}

weixin-java-channel/src/main/java/me/chanjar/weixin/channel/constant/WxChannelApiUrlConstants.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ public interface Category {
5353
String CANCEL_CATEGORY_AUDIT_URL = "https://api.weixin.qq.com/channels/ec/category/audit/cancel";
5454
/** 获取账号申请通过的类目和资质信息 */
5555
String LIST_PASS_CATEGORY_URL = "https://api.weixin.qq.com/channels/ec/category/list/get";
56+
/** 获取店铺的类目权限列表 */
57+
String LIST_RELATION_CATEGORY_URL = "https://api.weixin.qq.com/shop/ec/category/get_category_relation_list";
5658
}
5759

5860
/** 主页管理相关接口 */

0 commit comments

Comments
 (0)