mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-05-05 21:27:47 +08:00
修改方法返回类型,保证标签Id与其他地方一致
This commit is contained in:
parent
e8d368f212
commit
cd026278c2
@ -94,8 +94,8 @@ public interface WxMpUserTagService {
|
||||
* 详情请见:<a href="http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140837&token=&lang=zh_CN">用户标签管理</a>
|
||||
* 接口url格式: https://api.weixin.qq.com/cgi-bin/tags/getidlist?access_token=ACCESS_TOKEN
|
||||
* </pre>
|
||||
*
|
||||
* @return 标签Id的列表
|
||||
*/
|
||||
List<Integer> userTagList(String openid) throws WxErrorException;
|
||||
List<Long> userTagList(String openid) throws WxErrorException;
|
||||
|
||||
}
|
||||
|
@ -1,9 +1,14 @@
|
||||
package me.chanjar.weixin.mp.api.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import me.chanjar.weixin.common.bean.result.WxError;
|
||||
import me.chanjar.weixin.common.exception.WxErrorException;
|
||||
import me.chanjar.weixin.mp.api.WxMpService;
|
||||
@ -11,9 +16,6 @@ import me.chanjar.weixin.mp.api.WxMpUserTagService;
|
||||
import me.chanjar.weixin.mp.bean.tag.WxTagListUser;
|
||||
import me.chanjar.weixin.mp.bean.tag.WxUserTag;
|
||||
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -144,7 +146,7 @@ public class WxMpUserTagServiceImpl implements WxMpUserTagService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Integer> userTagList(String openid) throws WxErrorException {
|
||||
public List<Long> userTagList(String openid) throws WxErrorException {
|
||||
String url = API_URL_PREFIX + "/getidlist";
|
||||
|
||||
JsonObject json = new JsonObject();
|
||||
@ -154,7 +156,7 @@ public class WxMpUserTagServiceImpl implements WxMpUserTagService {
|
||||
|
||||
return WxMpGsonBuilder.create().fromJson(
|
||||
new JsonParser().parse(responseContent).getAsJsonObject().get("tagid_list"),
|
||||
new TypeToken<List<Integer>>() {
|
||||
new TypeToken<List<Long>>() {
|
||||
}.getType());
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,17 @@
|
||||
package me.chanjar.weixin.mp.api.impl;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import me.chanjar.weixin.mp.api.ApiTestModule;
|
||||
import me.chanjar.weixin.mp.api.WxXmlMpInMemoryConfigStorage;
|
||||
import me.chanjar.weixin.mp.bean.tag.WxTagListUser;
|
||||
import me.chanjar.weixin.mp.bean.tag.WxUserTag;
|
||||
import java.util.List;
|
||||
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Guice;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.util.List;
|
||||
import com.google.inject.Inject;
|
||||
|
||||
import me.chanjar.weixin.mp.api.ApiTestModule;
|
||||
import me.chanjar.weixin.mp.api.WxXmlMpInMemoryConfigStorage;
|
||||
import me.chanjar.weixin.mp.bean.tag.WxTagListUser;
|
||||
import me.chanjar.weixin.mp.bean.tag.WxUserTag;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -80,7 +82,7 @@ public class WxMpUserTagServiceImplTest {
|
||||
|
||||
@Test
|
||||
public void testUserTagList() throws Exception {
|
||||
List<Integer> res = this.wxService.getUserTagService().userTagList(
|
||||
List<Long> res = this.wxService.getUserTagService().userTagList(
|
||||
((WxXmlMpInMemoryConfigStorage) this.wxService.getWxMpConfigStorage()).getOpenid());
|
||||
System.out.println(res);
|
||||
Assert.assertNotNull(res);
|
||||
|
Loading…
Reference in New Issue
Block a user