Skip to content

Commit d776792

Browse files
authored
🎨 #3575 【视频号】微信小店api官方将要废除finder_id,以promoter_id代替
1 parent 1a74e3e commit d776792

File tree

3 files changed

+91
-14
lines changed

3 files changed

+91
-14
lines changed

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

Lines changed: 54 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,43 +15,84 @@ public interface WxLeaguePromoterService {
1515
/**
1616
* 新增达人
1717
*
18-
* @param finderId 视频号finder_id
18+
* @param finderId 视频号finder_id,待废除
1919
* @return 结果
20+
* @deprecated 使用 {@link #addPromoterV2(String)}
2021
*/
22+
@Deprecated
2123
WxChannelBaseResponse addPromoter(String finderId) throws WxErrorException;
2224

2325
/**
2426
* 编辑达人
2527
*
26-
* @param finderId 视频号finder_id
28+
* @param finderId 视频号finder_id,待废除
2729
* @param type 操作 1取消邀请 2结束合作
2830
* @return 结果
31+
* @deprecated 使用 {@link #updatePromoterV2(String, int)}
2932
*/
33+
@Deprecated
3034
WxChannelBaseResponse updatePromoter(String finderId, int type) throws WxErrorException;
3135

3236
/**
3337
* 删除达人
3438
*
35-
* @param finderId 视频号finder_id
39+
* @param finderId 视频号finder_id,待废除
3640
* @return 结果
41+
* @deprecated 使用 {@link #deletePromoterV2(String)}
3742
*/
43+
@Deprecated
3844
WxChannelBaseResponse deletePromoter(String finderId) throws WxErrorException;
3945

4046
/**
4147
* 获取达人详情信息
4248
*
43-
* @param finderId 视频号finder_id
49+
* @param finderId 视频号finder_id,待废除
4450
* @return 结果
51+
* @deprecated 使用 {@link #getPromoterInfoV2(String)}
4552
*/
53+
@Deprecated
4654
PromoterInfoResponse getPromoterInfo(String finderId) throws WxErrorException;
4755

48-
/**
49-
* 获取达人列表
50-
*
51-
* @param pageIndex 页面下标,下标从1开始,默认为1
52-
* @param pageSize 单页达人数(不超过200)
53-
* @param status 拉取该状态下的达人列表
54-
* @return 结果
55-
*/
56-
PromoterListResponse listPromoter(Integer pageIndex, Integer pageSize, Integer status) throws WxErrorException;
56+
/**
57+
* 新增达人
58+
*
59+
* @param promoterId 达人带货id
60+
* @return 结果
61+
*/
62+
WxChannelBaseResponse addPromoterV2(String promoterId) throws WxErrorException;
63+
64+
/**
65+
* 编辑达人
66+
*
67+
* @param promoterId 达人带货id
68+
* @param type 操作 1取消邀请 2结束合作
69+
* @return 结果
70+
*/
71+
WxChannelBaseResponse updatePromoterV2(String promoterId, int type) throws WxErrorException;
72+
73+
/**
74+
* 删除达人
75+
*
76+
* @param promoterId 达人带货id
77+
* @return 结果
78+
*/
79+
WxChannelBaseResponse deletePromoterV2(String promoterId) throws WxErrorException;
80+
81+
/**
82+
* 获取达人详情信息
83+
*
84+
* @param promoterId 达人带货id
85+
* @return 结果
86+
*/
87+
PromoterInfoResponse getPromoterInfoV2(String promoterId) throws WxErrorException;
88+
89+
/**
90+
* 获取达人列表
91+
*
92+
* @param pageIndex 页面下标,下标从1开始,默认为1
93+
* @param pageSize 单页达人数(不超过200)
94+
* @param status 拉取该状态下的达人列表
95+
* @return 结果
96+
*/
97+
PromoterListResponse listPromoter(Integer pageIndex, Integer pageSize, Integer status) throws WxErrorException;
5798
}

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,34 @@ public PromoterInfoResponse getPromoterInfo(String finderId) throws WxErrorExcep
5858
return ResponseUtils.decode(resJson, PromoterInfoResponse.class);
5959
}
6060

61+
@Override
62+
public WxChannelBaseResponse addPromoterV2(String promoterId) throws WxErrorException {
63+
String reqJson = "{\"promoter_id\":\"" + promoterId + "\"}";
64+
String resJson = shopService.post(ADD_PROMOTER_URL, reqJson);
65+
return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
66+
}
67+
68+
@Override
69+
public WxChannelBaseResponse updatePromoterV2(String promoterId, int type) throws WxErrorException {
70+
String reqJson = "{\"promoter_id\":\"" + promoterId + "\",\"type\":" + type + "}";
71+
String resJson = shopService.post(EDIT_PROMOTER_URL, reqJson);
72+
return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
73+
}
74+
75+
@Override
76+
public WxChannelBaseResponse deletePromoterV2(String promoterId) throws WxErrorException {
77+
String reqJson = "{\"promoter_id\":\"" + promoterId + "\"}";
78+
String resJson = shopService.post(DELETE_PROMOTER_URL, reqJson);
79+
return ResponseUtils.decode(resJson, WxChannelBaseResponse.class);
80+
}
81+
82+
@Override
83+
public PromoterInfoResponse getPromoterInfoV2(String promoterId) throws WxErrorException {
84+
String reqJson = "{\"promoter_id\":\"" + promoterId + "\"}";
85+
String resJson = shopService.post(GET_PROMOTER_URL, reqJson);
86+
return ResponseUtils.decode(resJson, PromoterInfoResponse.class);
87+
}
88+
6189
@Override
6290
public PromoterListResponse listPromoter(Integer pageIndex, Integer pageSize, Integer status)
6391
throws WxErrorException {

weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/league/promoter/PromoterListResponse.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,19 @@
1818
public class PromoterListResponse extends WxChannelBaseResponse {
1919

2020
private static final long serialVersionUID = 1411870432999885996L;
21-
/** 达人finder_id列表 */
21+
/** 达人finder_id列表,待废除后续以promoter_ids为准 */
2222
@JsonProperty("finder_ids")
2323
private List<String> finderIds;
2424

2525
/** 达人总数 */
2626
@JsonProperty("total_num")
2727
private Integer totalNum;
28+
29+
/** 后面是否还有(true: 还有内容; false: 已结束)*/
30+
@JsonProperty("continue_flag")
31+
private Boolean continueFlag;
32+
33+
/** 达人带货id列表 */
34+
@JsonProperty("promoter_ids")
35+
private List<String> promoterIds;
2836
}

0 commit comments

Comments
 (0)