1
sunshine
2024-11-05 92a9e53e82c74d36a72eb92f93777bbb16e2db73
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package com.nova.sankuai.domain.api.huizhixin;
 
import lombok.Data;
import org.apache.http.util.TextUtils;
 
/**
 * 汇智信Response
 */
@Data
public class HzxResponse<T> {
    /**
     * 状态码
     */
    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 <T> HzxResponse<T> success(T t) {
        HzxResponse<T> response = new HzxResponse<>();
        response.setCode("0000");
        response.setMsg("成功");
        response.setData(t);
        return response;
    }
 
    /**
     * 失败
     *
     * @return
     */
    public static <T> HzxResponse<T> error(String code, String msg) {
        HzxResponse<T> response = new HzxResponse<>();
        response.setCode(code);
        response.setMsg(msg);
        return response;
    }
}