package com.nova.sankuai.domain.api.huizhixin; import lombok.Data; import org.apache.http.util.TextUtils; /** * 汇智信Response */ @Data public class HzxResponse { /** * 状态码 */ private String code; /** * 描述 */ private String msg; /** * 数据 */ private T data; /** * 请求成功 * * @return */ public boolean isSuccess() { return !TextUtils.isEmpty(code) && code.equals("0000"); } /** * 成功 * * @return */ public static HzxResponse success() { HzxResponse response = new HzxResponse<>(); response.setCode("0000"); response.setMsg("成功"); return response; } /** * 成功 * * @return */ public static HzxResponse success(T t) { HzxResponse response = new HzxResponse<>(); response.setCode("0000"); response.setMsg("成功"); response.setData(t); return response; } /** * 失败 * * @return */ public static HzxResponse error(String code, String msg) { HzxResponse response = new HzxResponse<>(); response.setCode(code); response.setMsg(msg); return response; } }