fixed #55
This commit is contained in:
parent
1498e428fb
commit
047ee5f5e1
@ -2,6 +2,9 @@ package com.foxinmy.weixin4j.mp.model;
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.annotation.JSONCreator;
|
||||||
|
import com.alibaba.fastjson.annotation.JSONField;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分组
|
* 分组
|
||||||
*
|
*
|
||||||
@ -26,26 +29,6 @@ public class Group implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private int count;
|
private int count;
|
||||||
|
|
||||||
public int getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(int id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getCount() {
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Group(int id, String name) {
|
public Group(int id, String name) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
@ -55,8 +38,25 @@ public class Group implements Serializable {
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Group() {
|
@JSONCreator
|
||||||
|
public Group(@JSONField(name = "id") int id,
|
||||||
|
@JSONField(name = "name") String name,
|
||||||
|
@JSONField(name = "count") int count) {
|
||||||
|
this.id = id;
|
||||||
|
this.name = name;
|
||||||
|
this.count = count;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCount() {
|
||||||
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -50,6 +50,7 @@ public class WeixinTokenCreator extends AbstractTokenCreator {
|
|||||||
WeixinResponse response = weixinExecutor.get(tokenUrl);
|
WeixinResponse response = weixinExecutor.get(tokenUrl);
|
||||||
Token token = response.getAsObject(new TypeReference<Token>() {
|
Token token = response.getAsObject(new TypeReference<Token>() {
|
||||||
});
|
});
|
||||||
|
token.setCreateTime(System.currentTimeMillis());
|
||||||
token.setOriginalResult(response.getAsString());
|
token.setOriginalResult(response.getAsString());
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,10 +36,8 @@ public class GroupTest extends TokenTest {
|
|||||||
@Test
|
@Test
|
||||||
public void get() throws WeixinException {
|
public void get() throws WeixinException {
|
||||||
List<Group> groups = groupApi.getGroups();
|
List<Group> groups = groupApi.getGroups();
|
||||||
for (Group group : groups) {
|
System.err.println(groups);
|
||||||
System.out.println(group.toModifyJson());
|
Assert.assertTrue(groups.size() > 0);
|
||||||
}
|
|
||||||
Assert.assertEquals(1, groups.size());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@ -50,6 +50,7 @@ public class WeixinTokenCreator extends AbstractTokenCreator {
|
|||||||
WeixinResponse response = weixinExecutor.get(tokenUrl);
|
WeixinResponse response = weixinExecutor.get(tokenUrl);
|
||||||
Token token = response.getAsObject(new TypeReference<Token>() {
|
Token token = response.getAsObject(new TypeReference<Token>() {
|
||||||
});
|
});
|
||||||
|
token.setCreateTime(System.currentTimeMillis());
|
||||||
token.setOriginalResult(response.getAsString());
|
token.setOriginalResult(response.getAsString());
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user