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) + } } }