Skip to content

Commit faa79ab

Browse files
Copilotbinarywang
andauthored
[WIP] Add interfaces for video shop features (#3851)
* Initial plan * 改进 listRelationCategory 方法实现和文档 Co-authored-by: binarywang <1343140+binarywang@users.noreply.github.com> * 修复 RelationCategoryRequest 的 serialVersionUID Co-authored-by: binarywang <1343140+binarywang@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: binarywang <1343140+binarywang@users.noreply.github.com>
1 parent aeb80b1 commit faa79ab

File tree

4 files changed

+45
-2
lines changed

4 files changed

+45
-2
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ AuditApplyResponse addCategory(String level1, String level2, String level3, List
121121
/**
122122
* 获取店铺的类目权限列表
123123
*
124+
* @param isFilterStatus 是否按状态筛选
125+
* @param status 类目状态(当 isFilterStatus 为 true 时有效)
124126
* @return 类目权限列表
125127
*
126128
* @throws WxErrorException 异常

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,11 @@ public PassCategoryResponse listPassCategory() throws WxErrorException {
127127

128128
@Override
129129
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) + "}";
130+
RelationCategoryRequest request = new RelationCategoryRequest(
131+
isFilterStatus != null ? isFilterStatus : false,
132+
status != null ? status : 0
133+
);
134+
String reqJson = JsonUtils.encode(request);
132135
String resJson = shopService.post(LIST_RELATION_CATEGORY_URL, reqJson);
133136
return ResponseUtils.decode(resJson, RelationCategoryResponse.class);
134137
}
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+
}

weixin-java-channel/src/test/java/me/chanjar/weixin/channel/api/impl/WxChannelCategoryServiceImplTest.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,4 +158,14 @@ public void testListPassCategory() throws WxErrorException {
158158
assertTrue(response.isSuccess());
159159
System.out.println(response);
160160
}
161+
162+
@Test
163+
public void testListRelationCategory() throws WxErrorException {
164+
WxChannelCategoryService categoryService = channelService.getCategoryService();
165+
me.chanjar.weixin.channel.bean.category.RelationCategoryResponse response =
166+
categoryService.listRelationCategory(true, 1);
167+
assertNotNull(response);
168+
assertTrue(response.isSuccess());
169+
System.out.println(response);
170+
}
161171
}

0 commit comments

Comments
 (0)