46 lines
868 B
Java
46 lines
868 B
Java
package com.dota.nexus.entity;
|
|
|
|
import lombok.Data;
|
|
|
|
@Data
|
|
public class R {
|
|
private Integer code;
|
|
private String msg;
|
|
private Object data;
|
|
|
|
public R(Integer code, String msg){
|
|
this.code = code;
|
|
this.msg = msg;
|
|
}
|
|
|
|
public R (Integer code, String msg, Object data) {
|
|
this.code = code;
|
|
this.msg = msg;
|
|
this.data = data;
|
|
}
|
|
|
|
public static R ok() {
|
|
return ok(null);
|
|
}
|
|
|
|
public static R ok(Object data) {
|
|
return new R(200, "ok", data);
|
|
}
|
|
|
|
public static R error(String msg){
|
|
return new R(500, msg);
|
|
}
|
|
|
|
public static R error(){
|
|
return error("服务端发生未知错误");
|
|
}
|
|
|
|
public static R unauthorized() {
|
|
return new R(401, "未授权,客户端没有提供认证信息");
|
|
}
|
|
|
|
public static R forbidden(){
|
|
return new R(403, "没有权限");
|
|
}
|
|
}
|