From 98ee045ccc0396c8d114b7c6da32940eb08d126f Mon Sep 17 00:00:00 2001 From: fwq <582742538@qq.com> Date: 星期六, 10 十二月 2022 11:55:09 +0800 Subject: [PATCH] http请求增加超时状态 --- src/main/java/com/hz/util/http/dto/HttpHzResponse.java | 25 +++++++++++++++++++++++++ 1 files changed, 25 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/hz/util/http/dto/HttpHzResponse.java b/src/main/java/com/hz/util/http/dto/HttpHzResponse.java index 0d492ce..036ba99 100644 --- a/src/main/java/com/hz/util/http/dto/HttpHzResponse.java +++ b/src/main/java/com/hz/util/http/dto/HttpHzResponse.java @@ -1,5 +1,7 @@ package com.hz.util.http.dto; +import com.hx.exception.TipsException; + /** * 璇锋眰杩斿洖缁熶竴dto */ @@ -12,6 +14,29 @@ /**杩斿洖淇℃伅*/ 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; } -- Gitblit v1.8.0