From 6cdfe1d568d06bc63bb513ce0ef1df6aac3c7c3d Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Sat, 20 Feb 2021 15:32:12 +0800
Subject: [PATCH] fix
---
src/main/java/com/xcong/excoin/common/response/Result.java | 142 ++++++++++++++++++++++++++--------------------
1 files changed, 80 insertions(+), 62 deletions(-)
diff --git a/src/main/java/com/xcong/excoin/common/response/Result.java b/src/main/java/com/xcong/excoin/common/response/Result.java
index d75ad2b..00064a5 100644
--- a/src/main/java/com/xcong/excoin/common/response/Result.java
+++ b/src/main/java/com/xcong/excoin/common/response/Result.java
@@ -1,62 +1,80 @@
-package com.xcong.excoin.common.response;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import java.io.Serializable;
-
-/**
- * @author wzy
- * @date 2020-04-29 11:27
- **/
-@Data
-@ApiModel(value = "返回基类", description = "基础返回类")
-public class Result implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- private static final int SUCCESS = 0;
-
- private static final int FAIL = -1;
-
- private static final int LOGIN_FAIL = -2;
-
- @ApiModelProperty(value = "状态码", example = "0")
- private int code;
-
- @ApiModelProperty(value = "提示消息")
- private String msg;
-
- @ApiModelProperty(value = "数据对象")
- private Object data;
-
- public static Result ok(String msg) {
- Result result = new Result();
- result.code = SUCCESS;
- result.msg = msg;
- return result;
- }
-
- public static Result ok(String msg, Object data) {
- Result result = new Result();
- result.code = SUCCESS;
- result.msg = msg;
- result.data = data;
- return result;
- }
-
- public static Result fail(String msg) {
- Result result = new Result();
- result.code = FAIL;
- result.msg = msg;
- return result;
- }
-
- public static Result loginFail(String msg) {
- Result result = new Result();
- result.code = LOGIN_FAIL;
- result.msg = msg;
- return result;
- }
-}
+package com.xcong.excoin.common.response;
+
+import com.xcong.excoin.utils.MessageSourceUtils;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author wzy
+ * @date 2020-04-29 11:27
+ **/
+@Data
+@ApiModel(value = "返回基类", description = "基础返回类")
+public class Result implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final int SUCCESS = 0;
+
+ private static final String SUCCESS_MSG = MessageSourceUtils.getString("result_success_msg");
+
+ private static final int FAIL = -1;
+
+ private static final int LOGIN_FAIL = -2;
+
+ @ApiModelProperty(value = "状态码", example = "0")
+ private int code;
+
+ @ApiModelProperty(value = "提示消息")
+ private String msg;
+
+ @ApiModelProperty(value = "数据对象")
+ private Object data;
+
+ public static Result ok(String msg) {
+ Result result = new Result();
+ result.code = SUCCESS;
+ result.msg = msg;
+ return result;
+ }
+
+ public static Result ok(String msg, Object data) {
+ Result result = new Result();
+ result.code = SUCCESS;
+ result.msg = msg;
+ result.data = data;
+ return result;
+ }
+
+ public static Result ok(Object data) {
+ Result result = new Result();
+ result.code = SUCCESS;
+ result.msg = SUCCESS_MSG;
+ result.data = data;
+ return result;
+ }
+
+ public static Result fail(String msg) {
+ Result result = new Result();
+ result.code = FAIL;
+ result.msg = msg;
+ return result;
+ }
+
+ public static Result loginFail(String msg) {
+ Result result = new Result();
+ result.code = LOGIN_FAIL;
+ result.msg = msg;
+ return result;
+ }
+
+ public static Result timeOut(String msg) {
+ Result result = new Result();
+ result.code = -3;
+ result.msg = msg;
+ return result;
+ }
+}
--
Gitblit v1.9.1