﻿{"id":790,"date":"2022-07-14T14:18:42","date_gmt":"2022-07-14T06:18:42","guid":{"rendered":"http:\/\/blog.sway.com.cn\/?p=790"},"modified":"2022-07-14T14:22:25","modified_gmt":"2022-07-14T06:22:25","slug":"restful-%e8%bf%94%e5%9b%9e%e6%95%b0%e6%8d%ae%e6%a0%bc%e5%bc%8f","status":"publish","type":"post","link":"http:\/\/blog.sway.com.cn\/?p=790","title":{"rendered":"Restful \u8fd4\u56de\u6570\u636e\u683c\u5f0f"},"content":{"rendered":"<div>\n<h2>\u8fd4\u56de\u6570\u636e\u7684\u4e00\u822c\u683c\u5f0f\uff1a<\/h2>\n<p>{<br \/>\n&#8220;code&#8221;: 1,<br \/>\n&#8220;mssage&#8221;: &#8220;\u8fd4\u56de\u7684\u4fe1\u606f&#8221;,<br \/>\n&#8220;data&#8221;: {<br \/>\n&#8220;list&#8221;:[<br \/>\n{<br \/>\n&#8220;title&#8221;:&#8221;xxx&#8221;,<br \/>\n&#8220;contents&#8221;:&#8221;xxx&#8221;,<br \/>\n},{<br \/>\n&#8220;title&#8221;:&#8221;xxx&#8221;,<br \/>\n&#8220;contents&#8221;:&#8221;xxx&#8221;,<br \/>\n}<br \/>\n]<br \/>\n&#8220;total&#8221;:21,<br \/>\n},<br \/>\n<del>&#8220;extra&#8221;: {},<\/del><br \/>\n<del>&#8220;pageNum&#8221;: 3,<\/del><br \/>\n<del> &#8220;pageSize&#8221;: 20,<\/del><br \/>\n<del> &#8220;totalSize&#8221;: 235<\/del><br \/>\n}<\/p>\n<\/div>\n<h2>code\u7684\u4e00\u822c\u542b\u4e49<\/h2>\n<pre class=\"lang:default decode:true \">public enum ResultCode {\r\n\r\n  \/* \u6210\u529f\u72b6\u6001\u7801 *\/\r\n  SUCCESS(0, \"\u6210\u529f\"),\r\n\r\n  \/* \u4ee4\u724c\u5931\u6548 *\/\r\n  TOKEN_INVALID(401,\"\u4ee4\u724c\u5931\u6548\"),\r\n\r\n  SERVER_ERROR(400, \"\u670d\u52a1\u5668\u9519\u8bef\"),\r\n\r\n  \/*\u53c2\u6570\u9519\u8bef 10001-19999 *\/\r\n\r\n  PARAM_IS_INVALID(10001, \"\u53c2\u6570\u65e0\u6548\"),\r\n  PARAM_IS_BLANK(10002, \"\u53c2\u6570\u4e3a\u7a7a\"),\r\n  PARAM_TYPE_BIND_ERROR(10003, \"\u53c2\u6570\u7c7b\u578b\u9519\u8bef\"),\r\n  PARAM_NOT_COMPLETE(10004, \"\u53c2\u6570\u7f3a\u5931\"),\r\n\r\n  \/* \u7528\u6237\u9519\u8bef\uff1a20001-29999*\/\r\n  USER_NOT_LOGGED_IN(20001, \"\u7528\u6237\u672a\u767b\u5f55\"),\r\n  USER_LOGIN_ERROR(20002, \"\u8d26\u53f7\u4e0d\u5b58\u5728\u6216\u5bc6\u7801\u9519\u8bef\"),\r\n  USER_ACCOUNT_FORBIDDEN(20003, \"\u8d26\u53f7\u5df2\u88ab\u7981\u7528\"),\r\n  USER_NOT_EXIST(20004, \"\u7528\u6237\u4e0d\u5b58\u5728\"),\r\n  USER_HAS_EXISTED(20005, \"\u7528\u6237\u5df2\u5b58\u5728\"),\r\n  Cert_HAS_EXISTED(20006, \"\u8ba4\u8bc1\u5df2\u5b58\u5728\"),\r\n\r\n\r\n  \/* \u4e1a\u52a1\u9519\u8bef\uff1a30001-39999 *\/\r\n  CREATE_FAIL(30001, \"\u521b\u5efa\u5931\u8d25\"),\r\n\r\n  \/* \u7cfb\u7edf\u9519\u8bef\uff1a40001-49999 *\/\r\n  SYSTEM_INNER_ERROR(40001, \"\u7cfb\u7edf\u7e41\u5fd9\uff0c\u8bf7\u7a0d\u540e\u91cd\u8bd5\"),\r\n\r\n  \/* \u6570\u636e\u9519\u8bef\uff1a50001-599999 *\/\r\n  RESULE_DATA_NONE(50001, \"\u6570\u636e\u672a\u627e\u5230\"),\r\n  DATA_IS_WRONG(50002, \"\u6570\u636e\u6709\u8bef\"),\r\n  DATA_ALREADY_EXISTED(50003, \"\u6570\u636e\u5df2\u5b58\u5728\"),\r\n\r\n  \/* \u63a5\u53e3\u9519\u8bef\uff1a60001-69999 *\/\r\n  INTERFACE_INNER_INVOKE_ERROR(60001, \"\u5185\u90e8\u7cfb\u7edf\u63a5\u53e3\u8c03\u7528\u5f02\u5e38\"),\r\n  INTERFACE_OUTTER_INVOKE_ERROR(60002, \"\u5916\u90e8\u7cfb\u7edf\u63a5\u53e3\u8c03\u7528\u5f02\u5e38\"),\r\n  INTERFACE_FORBID_VISIT(60003, \"\u8be5\u63a5\u53e3\u7981\u6b62\u8bbf\u95ee\"),\r\n  INTERFACE_ADDRESS_INVALID(60004, \"\u63a5\u53e3\u5730\u5740\u65e0\u6548\"),\r\n  INTERFACE_REQUEST_TIMEOUT(60005, \"\u63a5\u53e3\u8bf7\u6c42\u8d85\u65f6\"),\r\n  INTERFACE_EXCEED_LOAD(60006, \"\u63a5\u53e3\u8d1f\u8f7d\u8fc7\u9ad8\"),\r\n\r\n  \/* \u6743\u9650\u9519\u8bef\uff1a70001-79999 *\/\r\n  PERMISSION_NO_ACCESS(70001, \"\u53ea\u6709\u6807\u7b7e Owner ,\u624d\u5177\u5907\u5220\u9664\u6743\u9650\"),\r\n  PERMISSION_NO_PHONE_ACCESS(70002,\"\u6b64\u8ba4\u8bc1\u6807\u7b7e\u5df2\u6709\u5458\u5de5\u8ba4\u8bc1\uff0c\u4e0d\u53ef\u4ee5\u8fdb\u884c\u5220\u9664\");\r\n  \r\n}<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8fd4\u56de\u6570\u636e\u7684\u4e00\u822c\u683c\u5f0f\uff1a { &#8220;code&#8221;: 1, &#8220;mssage&#038;#8221 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-790","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/790","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=790"}],"version-history":[{"count":1,"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/790\/revisions"}],"predecessor-version":[{"id":791,"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/790\/revisions\/791"}],"wp:attachment":[{"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=790"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=790"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.sway.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=790"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}