Browse Source

Result 添加一个 timestamp 字段

reghao 3 years ago
parent
commit
fb2c47782d
1 changed files with 9 additions and 0 deletions
  1. 9 0
      jdk/src/main/java/cn/reghao/jutil/jdk/result/Result.java

+ 9 - 0
jdk/src/main/java/cn/reghao/jutil/jdk/result/Result.java

@@ -16,6 +16,11 @@ public class Result implements Serializable {
 
     private int code;
     private String msg;
+    private final long timestamp;
+
+    public Result() {
+        this.timestamp = System.currentTimeMillis();
+    }
 
     public int getCode() {
         return code;
@@ -33,6 +38,10 @@ public class Result implements Serializable {
         this.msg = msg;
     }
 
+    public long getTimestamp() {
+        return timestamp;
+    }
+
     public static Result result(ResultStatus resultStatus) {
         Result result = new Result();
         result.setCode(resultStatus.getCode());