dev --- 3.8.0.A版本, openProject引用 ; formao-live --- 3.7.0.B 版本, formallProject引用
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

137 lines
5.2 KiB

  1. package chanjarster.weixin.bean;
  2. import java.util.HashMap;
  3. import java.util.Map;
  4. import chanjarster.weixin.util.WxGsonBuilder;
  5. /**
  6. * 微信错误码说明
  7. * http://mp.weixin.qq.com/wiki/index.php?title=全局返回码说明
  8. * @author chanjarster
  9. *
  10. */
  11. public class WxError {
  12. protected static final Map<Integer, String> errMap = new HashMap<Integer, String>();
  13. static {
  14. errMap.put(-1, "系统繁忙");
  15. errMap.put(0, "请求成功");
  16. errMap.put(40001, "获取access_token时AppSecret错误,或者access_token无效");
  17. errMap.put(40002, "不合法的凭证类型");
  18. errMap.put(40003, "不合法的OpenID");
  19. errMap.put(40004, "不合法的媒体文件类型");
  20. errMap.put(40005, "不合法的文件类型");
  21. errMap.put(40006, "不合法的文件大小");
  22. errMap.put(40007, "不合法的媒体文件id");
  23. errMap.put(40008, "不合法的消息类型");
  24. errMap.put(40009, "不合法的图片文件大小");
  25. errMap.put(40010, "不合法的语音文件大小");
  26. errMap.put(40011, "不合法的视频文件大小");
  27. errMap.put(40012, "不合法的缩略图文件大小");
  28. errMap.put(40013, "不合法的APPID");
  29. errMap.put(40014, "不合法的access_token");
  30. errMap.put(40015, "不合法的菜单类型");
  31. errMap.put(40016, "不合法的按钮个数");
  32. errMap.put(40017, "不合法的按钮个数");
  33. errMap.put(40018, "不合法的按钮名字长度");
  34. errMap.put(40019, "不合法的按钮KEY长度");
  35. errMap.put(40020, "不合法的按钮URL长度");
  36. errMap.put(40021, "不合法的菜单版本号");
  37. errMap.put(40022, "不合法的子菜单级数");
  38. errMap.put(40023, "不合法的子菜单按钮个数");
  39. errMap.put(40024, "不合法的子菜单按钮类型");
  40. errMap.put(40025, "不合法的子菜单按钮名字长度");
  41. errMap.put(40026, "不合法的子菜单按钮KEY长度");
  42. errMap.put(40027, "不合法的子菜单按钮URL长度");
  43. errMap.put(40028, "不合法的自定义菜单使用用户");
  44. errMap.put(40029, "不合法的oauth_code");
  45. errMap.put(40030, "不合法的refresh_token");
  46. errMap.put(40031, "不合法的openid列表");
  47. errMap.put(40032, "不合法的openid列表长度");
  48. errMap.put(40033, "不合法的请求字符,不能包含\\uxxxx格式的字符");
  49. errMap.put(40035, "不合法的参数");
  50. errMap.put(40038, "不合法的请求格式");
  51. errMap.put(40039, "不合法的URL长度");
  52. errMap.put(40050, "不合法的分组id");
  53. errMap.put(40051, "分组名字不合法");
  54. errMap.put(41001, "缺少access_token参数");
  55. errMap.put(41002, "缺少appid参数");
  56. errMap.put(41003, "缺少refresh_token参数");
  57. errMap.put(41004, "缺少secret参数");
  58. errMap.put(41005, "缺少多媒体文件数据");
  59. errMap.put(41006, "缺少media_id参数");
  60. errMap.put(41007, "缺少子菜单数据");
  61. errMap.put(41008, "缺少oauth code");
  62. errMap.put(41009, "缺少openid");
  63. errMap.put(42001, "access_token超时");
  64. errMap.put(42002, "refresh_token超时");
  65. errMap.put(42003, "oauth_code超时");
  66. errMap.put(43001, "需要GET请求");
  67. errMap.put(43002, "需要POST请求");
  68. errMap.put(43003, "需要HTTPS请求");
  69. errMap.put(43004, "需要接收者关注");
  70. errMap.put(43005, "需要好友关系");
  71. errMap.put(44001, "多媒体文件为空");
  72. errMap.put(44002, "POST的数据包为空");
  73. errMap.put(44003, "图文消息内容为空");
  74. errMap.put(44004, "文本消息内容为空");
  75. errMap.put(45001, "多媒体文件大小超过限制");
  76. errMap.put(45002, "消息内容超过限制");
  77. errMap.put(45003, "标题字段超过限制");
  78. errMap.put(45004, "描述字段超过限制");
  79. errMap.put(45005, "链接字段超过限制");
  80. errMap.put(45006, "图片链接字段超过限制");
  81. errMap.put(45007, "语音播放时间超过限制");
  82. errMap.put(45008, "图文消息超过限制");
  83. errMap.put(45009, "接口调用超过限制");
  84. errMap.put(45010, "创建菜单个数超过限制");
  85. errMap.put(45015, "回复时间超过限制");
  86. errMap.put(45016, "系统分组,不允许修改");
  87. errMap.put(45017, "分组名字过长");
  88. errMap.put(45018, "分组数量超过上限");
  89. errMap.put(46001, "不存在媒体数据");
  90. errMap.put(46002, "不存在的菜单版本");
  91. errMap.put(46003, "不存在的菜单数据");
  92. errMap.put(46004, "不存在的用户");
  93. errMap.put(47001, "解析JSON/XML内容错误");
  94. errMap.put(48001, "api功能未授权");
  95. errMap.put(50001, "用户未授权该api");
  96. }
  97. protected int errcode;
  98. protected String errmsg;
  99. public int getErrcode() {
  100. return errcode;
  101. }
  102. public void setErrcode(int errcode) {
  103. this.errcode = errcode;
  104. }
  105. public String getErrmsg() {
  106. return errmsg;
  107. }
  108. public void setErrmsg(String errmsg) {
  109. this.errmsg = errmsg;
  110. }
  111. public String getDescription() {
  112. return errMap.get(errcode);
  113. }
  114. public static WxError fromJson(String json) {
  115. return WxGsonBuilder.create().fromJson(json, WxError.class);
  116. }
  117. @Override
  118. public String toString() {
  119. return "微信错误 errcode=" + errcode + ", errmsg=" + errmsg + ", description=" + getDescription();
  120. }
  121. }