From a1345b6af117f383a9b882ae520f2242a54000b1 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 3 Nov 2020 19:23:21 +0800 Subject: [PATCH] 1 --- server/analyseapi/riskmgr.go | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/server/analyseapi/riskmgr.go b/server/analyseapi/riskmgr.go index ea3a2eb..f35023a 100644 --- a/server/analyseapi/riskmgr.go +++ b/server/analyseapi/riskmgr.go @@ -2,6 +2,7 @@ package main import ( "net/http" + "fmt" "sync" "sync/atomic" "github.com/aliyun/alibaba-cloud-sdk-go/services/geoip" @@ -296,11 +297,25 @@ func (this *RiskMgr) __analyseIsOpen(w* http.ResponseWriter, r *http.Request) { if isPass() { atomic.AddInt64(&this.totalPassTimes, 1) atomic.AddInt64(&this.passTimes, 1) - q5.ResponseInt32Ok(w, "is_open", 1) + if this.clusterConf.GetTesting() == 1 { + data := fmt.Sprintf(`{"errcode":0, "errmsg":"", "is_open":%d, "data":%s}`, + 1, + response_str) + q5.Response(w, data) + } else { + q5.ResponseInt32Ok(w, "is_open", 1) + } } else { atomic.AddInt64(&this.totalBlockTimes, 1) atomic.AddInt64(&this.blockTimes, 1) - q5.ResponseInt32Ok(w, "is_open", 0) + if this.clusterConf.GetTesting() == 1 { + data := fmt.Sprintf(`{"errcode":0, "errmsg":"", "is_open":%d, "data":%s}`, + 0, + response_str) + q5.Response(w, data) + } else { + q5.ResponseInt32Ok(w, "is_open", 0) + } } }