Commit 28480576 authored by 张永's avatar 张永

status 改为code

parent 563cfd5c
...@@ -107,28 +107,28 @@ public class Rjx extends LinkedHashMap<String, Object> { ...@@ -107,28 +107,28 @@ public class Rjx extends LinkedHashMap<String, Object> {
} }
public static Rjx jsonOk() { public static Rjx jsonOk() {
return Rjx.json().setStatus(200).setMessage("OK"); return Rjx.json().setCode(200).setMessage("OK");
} }
public static Rjx jsonErr() { public static Rjx jsonErr() {
return Rjx.json().setStatus(500).setMessage("ERROR"); return Rjx.json().setCode(500).setMessage("ERROR");
} }
public static Rjx jsonTimeout() { public static Rjx jsonTimeout() {
return Rjx.json().setStatus(300).setMessage("TIMEOUT"); return Rjx.json().setCode(300).setMessage("TIMEOUT");
} }
public static Rjx jsonNotFound() { public static Rjx jsonNotFound() {
return Rjx.json().setStatus(400).setMessage("NOTFOUND"); return Rjx.json().setCode(400).setMessage("NOTFOUND");
} }
public Rjx setStatus(int status) { public Rjx setCode(int status) {
put("status", status); put("code", status);
return this; return this;
} }
public int getStatus() { public int getCode() {
return (Integer)this.get("status"); return (Integer)this.get("code");
} }
public Rjx appendNtag(int ntag) { public Rjx appendNtag(int ntag) {
......
...@@ -41,19 +41,19 @@ public class M { ...@@ -41,19 +41,19 @@ public class M {
} }
public static void responseJson(Writer writer, int statusCode) { public static void responseJson(Writer writer, int statusCode) {
Rjx.json().setStatus(statusCode).write(writer); Rjx.json().setCode(statusCode).write(writer);
} }
public static void responseJson(Writer writer, int statusCode, Object body) { public static void responseJson(Writer writer, int statusCode, Object body) {
Rjx.json().setStatus(statusCode).setData(body).write(writer); Rjx.json().setCode(statusCode).setData(body).write(writer);
} }
public static void responseJson(Writer writer, int statusCode, String message) { public static void responseJson(Writer writer, int statusCode, String message) {
Rjx.json().setStatus(statusCode).setMessage(message).write(writer); Rjx.json().setCode(statusCode).setMessage(message).write(writer);
} }
public static void responseJson(Writer writer, int statusCode, String message, Object body) { public static void responseJson(Writer writer, int statusCode, String message, Object body) {
Rjx.json().setStatus(statusCode).setMessage(message).setData(body).write(writer); Rjx.json().setCode(statusCode).setMessage(message).setData(body).write(writer);
} }
public static void responseOk(Writer writer) { public static void responseOk(Writer writer) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment