Skip to content

Commit cd02627

Browse files
committed
修改方法返回类型,保证标签Id与其他地方一致
1 parent e8d368f commit cd02627

File tree

3 files changed

+17
-13
lines changed

3 files changed

+17
-13
lines changed

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpUserTagService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ WxTagListUser tagListUser(Long tagId, String nextOpenid)
9494
* 详情请见:<a href="http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140837&token=&lang=zh_CN">用户标签管理</a>
9595
* 接口url格式: https://api.weixin.qq.com/cgi-bin/tags/getidlist?access_token=ACCESS_TOKEN
9696
* </pre>
97-
*
97+
* @return 标签Id的列表
9898
*/
99-
List<Integer> userTagList(String openid) throws WxErrorException;
99+
List<Long> userTagList(String openid) throws WxErrorException;
100100

101101
}

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpUserTagServiceImpl.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
package me.chanjar.weixin.mp.api.impl;
22

3+
import java.util.List;
4+
5+
import org.apache.commons.lang3.StringUtils;
6+
37
import com.google.gson.JsonArray;
48
import com.google.gson.JsonObject;
59
import com.google.gson.JsonParser;
610
import com.google.gson.reflect.TypeToken;
11+
712
import me.chanjar.weixin.common.bean.result.WxError;
813
import me.chanjar.weixin.common.exception.WxErrorException;
914
import me.chanjar.weixin.mp.api.WxMpService;
1015
import me.chanjar.weixin.mp.api.WxMpUserTagService;
1116
import me.chanjar.weixin.mp.bean.tag.WxTagListUser;
1217
import me.chanjar.weixin.mp.bean.tag.WxUserTag;
1318
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
14-
import org.apache.commons.lang3.StringUtils;
15-
16-
import java.util.List;
1719

1820
/**
1921
*
@@ -144,7 +146,7 @@ public boolean batchUntagging(Long tagId, String[] openids)
144146
}
145147

146148
@Override
147-
public List<Integer> userTagList(String openid) throws WxErrorException {
149+
public List<Long> userTagList(String openid) throws WxErrorException {
148150
String url = API_URL_PREFIX + "/getidlist";
149151

150152
JsonObject json = new JsonObject();
@@ -154,7 +156,7 @@ public List<Integer> userTagList(String openid) throws WxErrorException {
154156

155157
return WxMpGsonBuilder.create().fromJson(
156158
new JsonParser().parse(responseContent).getAsJsonObject().get("tagid_list"),
157-
new TypeToken<List<Integer>>() {
159+
new TypeToken<List<Long>>() {
158160
}.getType());
159161
}
160162
}

weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpUserTagServiceImplTest.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
package me.chanjar.weixin.mp.api.impl;
22

3+
import java.util.List;
4+
5+
import org.testng.Assert;
6+
import org.testng.annotations.Guice;
7+
import org.testng.annotations.Test;
8+
39
import com.google.inject.Inject;
10+
411
import me.chanjar.weixin.mp.api.ApiTestModule;
512
import me.chanjar.weixin.mp.api.WxXmlMpInMemoryConfigStorage;
613
import me.chanjar.weixin.mp.bean.tag.WxTagListUser;
714
import me.chanjar.weixin.mp.bean.tag.WxUserTag;
8-
import org.testng.Assert;
9-
import org.testng.annotations.Guice;
10-
import org.testng.annotations.Test;
11-
12-
import java.util.List;
1315

1416
/**
1517
*
@@ -80,7 +82,7 @@ public void testBatchUntagging() throws Exception {
8082

8183
@Test
8284
public void testUserTagList() throws Exception {
83-
List<Integer> res = this.wxService.getUserTagService().userTagList(
85+
List<Long> res = this.wxService.getUserTagService().userTagList(
8486
((WxXmlMpInMemoryConfigStorage) this.wxService.getWxMpConfigStorage()).getOpenid());
8587
System.out.println(res);
8688
Assert.assertNotNull(res);

0 commit comments

Comments
 (0)