Skip to content

增加实现管理标签的get(获取标签成员)接口 #541

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 16, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
定义《企业号应用》的bean
  • Loading branch information
huansinho committed Apr 13, 2018
commit 2a353849e840fc0d8abe7cf5f9186f384f744928
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
package me.chanjar.weixin.cp.bean;

import com.google.gson.annotations.SerializedName;
import lombok.Data;
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;

import java.io.Serializable;
import java.util.List;

/**
* <pre>
* 企业号应用信息.
* Created by huansinho on 2018/4/13.
* </pre>
*
* @author <a href="https://github.com/huansinho">huansinho</a>
*/
@Data
public class WxCpAgent implements Serializable {

@SerializedName("errcode")
private Integer errcode;

@SerializedName("errmsg")
private String errmsg;

@SerializedName("agentid")
private Integer agentid;

@SerializedName("name")
private String name;

@SerializedName("square_logo_url")
private String squareLogoUrl;

@SerializedName("description")
private String description;

@SerializedName("allow_userinfos")
private Users allowUserinfos;

@SerializedName("allow_partys")
private Partys allowPartys;

@SerializedName("allow_tags")
private Tags allowTags;

@SerializedName("close")
private Integer close;

@SerializedName("redirect_domain")
private String redirectDomain;

@SerializedName("report_location_flag")
private Integer reportLocationFlag;

@SerializedName("isreportenter")
private Integer isreportenter;

@SerializedName("home_url")
private String homeUrl;

public static WxCpAgent fromJson(String json) {
return WxCpGsonBuilder.create().fromJson(json, WxCpAgent.class);
}

public String toJson() {
return WxCpGsonBuilder.create().toJson(this);
}

@Data
public static class Users implements Serializable {
@SerializedName("user")
private List<User> user;
}


@Data
public class User implements Serializable {
@SerializedName("userid")
private String userid;
}

@Data
public class Partys {
@SerializedName("partyid")
private List<Integer> partyids = null;
}

@Data
public class Tags {
@SerializedName("tagid")
private List<Integer> tagids = null;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package me.chanjar.weixin.cp.bean;

import org.testng.Assert;
import org.testng.annotations.Test;

/**
* Created by huansinho on 2018/4/13.
*/
@Test
public class WxCpAgentTest {

public void testDeserialize() {
String json = "{\"errcode\": 0,\"errmsg\": \"ok\",\"agentid\": 9,\"name\": \"测试应用\",\"square_logo_url\": \"http://wx.qlogo.cn/mmhead/alksjf;lasdjf;lasjfuodiuj3rj2o34j/0\",\"description\": \"这是一个企业号应用\",\"allow_userinfos\": {\"user\": [{\"userid\": \"0009854\"}, {\"userid\": \"1723\"}, {\"userid\": \"5625\"}]},\"allow_partys\": {\"partyid\": [42762742]},\"allow_tags\": {\"tagid\": [23, 22, 35, 19, 32, 125, 133, 46, 150, 38, 183, 9, 7]},\"close\": 0,\"redirect_domain\": \"weixin.com.cn\",\"report_location_flag\": 0,\"isreportenter\": 0,\"home_url\": \"\"}";

WxCpAgent wxCpAgent = WxCpAgent.fromJson(json);

Assert.assertEquals(9, wxCpAgent.getAgentid().intValue());

Assert.assertEquals(new Integer[]{42762742}, wxCpAgent.getAllowPartys().getPartyids().toArray());

Assert.assertEquals(new Integer[]{23, 22, 35, 19, 32, 125, 133, 46, 150, 38, 183, 9, 7}, wxCpAgent.getAllowTags().getTagids().toArray());

}

}