This commit is contained in:
aozhiwei 2020-11-03 19:23:21 +08:00
parent 84bf1a5669
commit a1345b6af1

View File

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