mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-05-06 21:57:48 +08:00
规范获取应用列表接口方法的相关字段命名
This commit is contained in:
parent
6f9371dfb7
commit
b327724433
@ -23,13 +23,11 @@ public class WxCpAgentServiceImpl implements WxCpAgentService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public WxCpAgent get(Integer agentId) throws WxErrorException {
|
public WxCpAgent get(Integer agentId) throws WxErrorException {
|
||||||
|
if (agentId == null) {
|
||||||
String url = "https://qyapi.weixin.qq.com/cgi-bin/agent/get";
|
|
||||||
if (agentId != null) {
|
|
||||||
url += "?agentid=" + agentId;
|
|
||||||
} else {
|
|
||||||
throw new IllegalArgumentException("缺少agentid参数");
|
throw new IllegalArgumentException("缺少agentid参数");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String url = "https://qyapi.weixin.qq.com/cgi-bin/agent/get?agentid=" + agentId;
|
||||||
String responseContent = this.mainService.get(url, null);
|
String responseContent = this.mainService.get(url, null);
|
||||||
return WxCpAgent.fromJson(responseContent);
|
return WxCpAgent.fromJson(responseContent);
|
||||||
}
|
}
|
||||||
|
@ -17,15 +17,16 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class WxCpAgent implements Serializable {
|
public class WxCpAgent implements Serializable {
|
||||||
|
private static final long serialVersionUID = 5002894979081127234L;
|
||||||
|
|
||||||
@SerializedName("errcode")
|
@SerializedName("errcode")
|
||||||
private Integer errcode;
|
private Integer errCode;
|
||||||
|
|
||||||
@SerializedName("errmsg")
|
@SerializedName("errmsg")
|
||||||
private String errmsg;
|
private String errMsg;
|
||||||
|
|
||||||
@SerializedName("agentid")
|
@SerializedName("agentid")
|
||||||
private Integer agentid;
|
private Integer agentId;
|
||||||
|
|
||||||
@SerializedName("name")
|
@SerializedName("name")
|
||||||
private String name;
|
private String name;
|
||||||
@ -37,10 +38,10 @@ public class WxCpAgent implements Serializable {
|
|||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
@SerializedName("allow_userinfos")
|
@SerializedName("allow_userinfos")
|
||||||
private Users allowUserinfos;
|
private Users allowUserInfos;
|
||||||
|
|
||||||
@SerializedName("allow_partys")
|
@SerializedName("allow_partys")
|
||||||
private Partys allowPartys;
|
private Partys allowParties;
|
||||||
|
|
||||||
@SerializedName("allow_tags")
|
@SerializedName("allow_tags")
|
||||||
private Tags allowTags;
|
private Tags allowTags;
|
||||||
@ -55,7 +56,7 @@ public class WxCpAgent implements Serializable {
|
|||||||
private Integer reportLocationFlag;
|
private Integer reportLocationFlag;
|
||||||
|
|
||||||
@SerializedName("isreportenter")
|
@SerializedName("isreportenter")
|
||||||
private Integer isreportenter;
|
private Integer isReportEnter;
|
||||||
|
|
||||||
@SerializedName("home_url")
|
@SerializedName("home_url")
|
||||||
private String homeUrl;
|
private String homeUrl;
|
||||||
@ -71,26 +72,25 @@ public class WxCpAgent implements Serializable {
|
|||||||
@Data
|
@Data
|
||||||
public static class Users implements Serializable {
|
public static class Users implements Serializable {
|
||||||
@SerializedName("user")
|
@SerializedName("user")
|
||||||
private List<User> user;
|
private List<User> users;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class User implements Serializable {
|
public class User implements Serializable {
|
||||||
@SerializedName("userid")
|
@SerializedName("userid")
|
||||||
private String userid;
|
private String userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class Partys {
|
public class Partys {
|
||||||
@SerializedName("partyid")
|
@SerializedName("partyid")
|
||||||
private List<Integer> partyids = null;
|
private List<Integer> partyIds = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class Tags {
|
public class Tags {
|
||||||
@SerializedName("tagid")
|
@SerializedName("tagid")
|
||||||
private List<Integer> tagids = null;
|
private List<Integer> tagIds = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,23 +1,13 @@
|
|||||||
package me.chanjar.weixin.cp.api.impl;
|
package me.chanjar.weixin.cp.api.impl;
|
||||||
|
|
||||||
import com.google.inject.Inject;
|
|
||||||
import me.chanjar.weixin.common.api.WxConsts;
|
|
||||||
import me.chanjar.weixin.common.bean.menu.WxMenu;
|
|
||||||
import me.chanjar.weixin.common.bean.menu.WxMenuButton;
|
|
||||||
import me.chanjar.weixin.cp.api.ApiTestModule;
|
|
||||||
import me.chanjar.weixin.cp.api.WxCpAgentService;
|
import me.chanjar.weixin.cp.api.WxCpAgentService;
|
||||||
import me.chanjar.weixin.cp.api.WxCpService;
|
import me.chanjar.weixin.cp.api.WxCpService;
|
||||||
import me.chanjar.weixin.cp.bean.WxCpAgent;
|
import me.chanjar.weixin.cp.bean.WxCpAgent;
|
||||||
import me.chanjar.weixin.cp.config.WxCpInMemoryConfigStorage;
|
|
||||||
import org.mockito.Mock;
|
|
||||||
import org.testng.Assert;
|
import org.testng.Assert;
|
||||||
import org.testng.annotations.DataProvider;
|
|
||||||
import org.testng.annotations.Guice;
|
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.testng.Assert.assertNotNull;
|
import static org.mockito.Mockito.when;
|
||||||
import static org.mockito.Mockito.*;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -41,11 +31,11 @@ public class WxCpAgentServiceImplTest {
|
|||||||
WxCpAgentService wxAgentService = this.wxService.getAgentService();
|
WxCpAgentService wxAgentService = this.wxService.getAgentService();
|
||||||
WxCpAgent wxCpAgent = wxAgentService.get(9);
|
WxCpAgent wxCpAgent = wxAgentService.get(9);
|
||||||
|
|
||||||
Assert.assertEquals(9, wxCpAgent.getAgentid().intValue());
|
Assert.assertEquals(9, wxCpAgent.getAgentId().intValue());
|
||||||
|
|
||||||
Assert.assertEquals(new Integer[]{42762742}, wxCpAgent.getAllowPartys().getPartyids().toArray());
|
Assert.assertEquals(new Integer[]{42762742}, wxCpAgent.getAllowParties().getPartyIds().toArray());
|
||||||
|
|
||||||
Assert.assertEquals(new Integer[]{23, 22, 35, 19, 32, 125, 133, 46, 150, 38, 183, 9, 7}, wxCpAgent.getAllowTags().getTagids().toArray());
|
Assert.assertEquals(new Integer[]{23, 22, 35, 19, 32, 125, 133, 46, 150, 38, 183, 9, 7}, wxCpAgent.getAllowTags().getTagIds().toArray());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,11 +14,11 @@ public class WxCpAgentTest {
|
|||||||
|
|
||||||
WxCpAgent wxCpAgent = WxCpAgent.fromJson(json);
|
WxCpAgent wxCpAgent = WxCpAgent.fromJson(json);
|
||||||
|
|
||||||
Assert.assertEquals(9, wxCpAgent.getAgentid().intValue());
|
Assert.assertEquals(9, wxCpAgent.getAgentId().intValue());
|
||||||
|
|
||||||
Assert.assertEquals(new Integer[]{42762742}, wxCpAgent.getAllowPartys().getPartyids().toArray());
|
Assert.assertEquals(new Integer[]{42762742}, wxCpAgent.getAllowParties().getPartyIds().toArray());
|
||||||
|
|
||||||
Assert.assertEquals(new Integer[]{23, 22, 35, 19, 32, 125, 133, 46, 150, 38, 183, 9, 7}, wxCpAgent.getAllowTags().getTagids().toArray());
|
Assert.assertEquals(new Integer[]{23, 22, 35, 19, 32, 125, 133, 46, 150, 38, 183, 9, 7}, wxCpAgent.getAllowTags().getTagIds().toArray());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user