package top.octopusyan.http.response;

import java.io.Serializable;

/**
 * @author : octopus yan
 * @email : octopus_yan@foxmail.com
 * @description :
 * @create : 2022-4-1 15:24
 */
public class BaseRest implements Serializable {
    private String msg;
    private int code;

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    @Override
    public String toString() {
        return "BaseRest{" +
                "msg='" + msg + '\'' +
                ", code=" + code +
                '}';
    }

    public boolean isRequestSucceed() {
        return code == 0 || code == 200;
    }

    public boolean isTokenFailure() {
        return code == 401;
    }
}