提交 | 用户 | age
|
b8f5f5
|
1 |
package com.hz.util.http.dto; |
C |
2 |
|
cd1bb5
|
3 |
import com.hx.exception.TipsException; |
C |
4 |
|
b8f5f5
|
5 |
/** |
C |
6 |
* 请求返回统一dto |
|
7 |
*/ |
|
8 |
public class HttpHzResponse { |
|
9 |
|
|
10 |
/**请求状态*/ |
|
11 |
private String code; |
|
12 |
/**错误信息*/ |
|
13 |
private String msg; |
|
14 |
/**返回信息*/ |
|
15 |
private String data; |
|
16 |
|
fa1ffd
|
17 |
/**请求返回状态-成功*/ |
b5bfe5
|
18 |
public static final String CODE_200 = "200"; |
fa1ffd
|
19 |
/**请求返回状态-成功*/ |
C |
20 |
public static final String CODE_201 = "201"; |
98ee04
|
21 |
/**请求状态-超时*/ |
F |
22 |
public static final String CODE_TIME_OUT = "time_out"; |
b5bfe5
|
23 |
|
cd1bb5
|
24 |
/**封装校验请求码方法,没有进行错误提示*/ |
c5817f
|
25 |
public boolean checkRequesCode(){ |
C |
26 |
if(CODE_200.equals(code) || CODE_201.equals(code)){ |
|
27 |
return true; |
|
28 |
} |
|
29 |
return false; |
|
30 |
} |
|
31 |
|
cd1bb5
|
32 |
/**封装校验请求码方法,进行错误提示*/ |
C |
33 |
public void checkRequesThrow(){ |
|
34 |
if(!CODE_200.equals(code) && !CODE_201.equals(code)){ |
|
35 |
throw new TipsException("请求URL失败:"+this.msg); |
|
36 |
} |
|
37 |
|
|
38 |
} |
|
39 |
|
b8f5f5
|
40 |
public String getCode() { |
C |
41 |
return code; |
|
42 |
} |
|
43 |
|
|
44 |
public void setCode(String code) { |
|
45 |
this.code = code; |
|
46 |
} |
|
47 |
|
|
48 |
public String getMsg() { |
|
49 |
return msg; |
|
50 |
} |
|
51 |
|
|
52 |
public void setMsg(String msg) { |
|
53 |
this.msg = msg; |
|
54 |
} |
|
55 |
|
|
56 |
public String getData() { |
|
57 |
return data; |
|
58 |
} |
|
59 |
|
|
60 |
public void setData(String data) { |
|
61 |
this.data = data; |
|
62 |
} |
|
63 |
} |