| | |
| | | package com.hz.util.http.dto; |
| | | |
| | | import com.hx.exception.TipsException; |
| | | |
| | | /** |
| | | * 请求返回统一dto |
| | | */ |
| | |
| | | /**返回信息*/ |
| | | private String data; |
| | | |
| | | /**请求返回状态-成功*/ |
| | | public static final String CODE_200 = "200"; |
| | | /**请求返回状态-成功*/ |
| | | public static final String CODE_201 = "201"; |
| | | /**请求状态-超时*/ |
| | | public static final String CODE_TIME_OUT = "time_out"; |
| | | |
| | | /**封装校验请求码方法,没有进行错误提示*/ |
| | | public boolean checkRequesCode(){ |
| | | if(CODE_200.equals(code) || CODE_201.equals(code)){ |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /**封装校验请求码方法,进行错误提示*/ |
| | | public void checkRequesThrow(){ |
| | | if(!CODE_200.equals(code) && !CODE_201.equals(code)){ |
| | | throw new TipsException("请求URL失败:"+this.msg); |
| | | } |
| | | |
| | | } |
| | | |
| | | public String getCode() { |
| | | return code; |
| | | } |