Browse Source

添加 ok(String msg) 与 fail(String msg) 方法,提升用户体验

James 4 years ago
parent
commit
7ec5dd3381
1 changed files with 8 additions and 0 deletions
  1. 8 0
      src/main/java/com/jfinal/kit/Ret.java

+ 8 - 0
src/main/java/com/jfinal/kit/Ret.java

@@ -89,6 +89,10 @@ public class Ret extends HashMap {
 		return ok().set(key, value);
 	}
 	
+	public static Ret ok(String msg) {
+		return ok().set("msg", msg);
+	}
+	
 	public static Ret fail() {
 		return new Ret().setFail();
 	}
@@ -97,6 +101,10 @@ public class Ret extends HashMap {
 		return fail().set(key, value);
 	}
 	
+	public static Ret fail(String msg) {
+		return fail().set("msg", msg);
+	}
+	
 	public Ret setOk() {
 		super.put(STATE, STATE_OK);
 		return this;