| | |
| | | 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;
|
| | | }
|
| | | }
|