View Javadoc
1   package com.foxinmy.weixin4j.http.weixin;
2   
3   import java.io.Serializable;
4   
5   import javax.xml.bind.annotation.XmlAccessType;
6   import javax.xml.bind.annotation.XmlAccessorType;
7   import javax.xml.bind.annotation.XmlElement;
8   import javax.xml.bind.annotation.XmlRootElement;
9   
10  import com.alibaba.fastjson.annotation.JSONField;
11  
12  /**
13   * 调用接口的返回
14   * 
15   * @className ApiResult
16   * @author jinyu(foxinmy@gmail.com)
17   * @date 2014年9月24日
18   * @since JDK 1.6
19   * @see <a href=
20   *      "https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1433747234&token=&lang=zh_CN">公众平台全局返回码说明</a>
21   * @see <a href=
22   *      "http://qydev.weixin.qq.com/wiki/index.php?title=%E5%85%A8%E5%B1%80%E8%BF%94%E5%9B%9E%E7%A0%81%E8%AF%B4%E6%98%8E">企业号全局返回码说明</a>
23   */
24  @XmlRootElement
25  @XmlAccessorType(XmlAccessType.FIELD)
26  public class ApiResult implements Serializable {
27  
28  	private static final long serialVersionUID = -6185313616955051150L;
29  
30  	/**
31  	 * 调用接口返回码,通信标识
32  	 */
33  	@XmlElement(name = "return_code")
34  	@JSONField(name = "errcode")
35  	private String returnCode;
36  
37  	/**
38  	 * 调用接口返回消息,如非 空,为错误原因 可能为空
39  	 */
40  	@XmlElement(name = "return_msg")
41  	@JSONField(name = "errmsg")
42  	private String returnMsg;
43  
44  	public ApiResult() {
45  		this.returnCode = "0";
46  		this.returnMsg = "OK";
47  	}
48  
49  	public ApiResult(String returnCode, String returnMsg) {
50  		this.returnCode = returnCode;
51  		this.returnMsg = returnMsg;
52  	}
53  
54  	public String getReturnCode() {
55  		return returnCode;
56  	}
57  
58  	public String getReturnMsg() {
59  		return returnMsg;
60  	}
61  
62  	public void setReturnCode(String returnCode) {
63  		this.returnCode = returnCode;
64  	}
65  
66  	public void setReturnMsg(String returnMsg) {
67  		this.returnMsg = returnMsg;
68  	}
69  
70  	@Override
71  	public String toString() {
72  		return "returnCode=" + returnCode + ", returnMsg=" + returnMsg;
73  	}
74  }