diff --git a/UPDATE.md b/UPDATE.md index e92436b..9919182 100644 --- a/UPDATE.md +++ b/UPDATE.md @@ -1,6 +1,12 @@ yexuejc-base 更新记录 ------------------ +#### version :1.2.1 +**time:2018-11-9 15:05:06**
+**branch:** master
+**update:**
+>1. 优化resps +# #### version :1.2.0 **time:2018-10-19 11:38:20**
**branch:** master
diff --git a/pom.xml b/pom.xml index 7cf1c16..4364178 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.yexuejc.base yexuejc-base - 1.2.0 + 1.2.1 ${project.artifactId} diff --git a/src/main/java/com/yexuejc/base/http/Resps.java b/src/main/java/com/yexuejc/base/http/Resps.java index ae2bf12..4a1c784 100644 --- a/src/main/java/com/yexuejc/base/http/Resps.java +++ b/src/main/java/com/yexuejc/base/http/Resps.java @@ -59,18 +59,18 @@ public class Resps implements Serializable { } public Resps setSucc(T t) { - setSucc(t, RespsConsts.MSG_SUCCESS_OPERATE); + this.data = t; return this; } public Resps setSucc(T t, String msg) { - setSucc(t, new String[]{msg}); + this.setMsg(new String[]{msg}); + this.setData(t); return this; } public Resps setSucc(T t, String[] msg) { this.setData(t); - this.setCode(RespsConsts.CODE_SUCCESS); this.setMsg(msg); return this; } @@ -81,6 +81,14 @@ public class Resps implements Serializable { return this; } + public static Resps success(String code, String msg) { + return new Resps(code, msg); + } + + public static Resps success(String code, String[] msg) { + return new Resps(code, msg); + } + public static Resps success(String[] msg) { return new Resps(RespsConsts.CODE_SUCCESS, msg); } @@ -93,6 +101,10 @@ public class Resps implements Serializable { return new Resps(RespsConsts.CODE_SUCCESS, RespsConsts.MSG_SUCCESS_OPERATE); } + public static Resps error() { + return new Resps(RespsConsts.CODE_ERROR, RespsConsts.MSG_ERROT_OPERATE); + } + public static Resps error(String msg) { return new Resps(RespsConsts.CODE_ERROR, msg); } @@ -109,6 +121,10 @@ public class Resps implements Serializable { return new Resps(code, msg); } + public static Resps fail() { + return new Resps(RespsConsts.CODE_FAIL, RespsConsts.MSG_FAIL_OPERATE); + } + public static Resps fail(String msg) { return new Resps(RespsConsts.CODE_FAIL, msg); }