This commit is contained in:
aozhiwei 2020-11-03 17:24:39 +08:00
parent 2e2562c7cd
commit 84bf1a5669
2 changed files with 5 additions and 3 deletions

View File

@ -217,7 +217,7 @@ func (this* RiskMgr) GetBlockObj() *q5.XObject {
return blockObj.AsXObject() return blockObj.AsXObject()
} }
func (this* RiskMgr) IsSafeZone(gameId int32, channel int32, ip string) bool { func (this* RiskMgr) IsSafeZone(gameId int32, channel int32, ip string, response_str* string) bool {
accessKeyId := "" accessKeyId := ""
accessSecret := "" accessSecret := ""
this.GetSdkInfo(&accessKeyId, &accessSecret) this.GetSdkInfo(&accessKeyId, &accessSecret)
@ -236,10 +236,12 @@ func (this* RiskMgr) IsSafeZone(gameId int32, channel int32, ip string) bool {
f5.SysLog().Warning("Ipv4Location error %s", err.Error()) f5.SysLog().Warning("Ipv4Location error %s", err.Error())
return false return false
} }
*response_str = q5.EncodeJson(response)
return !this.IsBlockZone(gameId, channel, response.Country, response.Province, response.City) return !this.IsBlockZone(gameId, channel, response.Country, response.Province, response.City)
} }
func (this *RiskMgr) __analyseIsOpen(w* http.ResponseWriter, r *http.Request) { func (this *RiskMgr) __analyseIsOpen(w* http.ResponseWriter, r *http.Request) {
response_str := ""
isPass := func () bool { isPass := func () bool {
if r.Method != "POST" { if r.Method != "POST" {
atomic.AddInt64(&this.totalHttpMethodBlockTimes, 1) atomic.AddInt64(&this.totalHttpMethodBlockTimes, 1)
@ -281,7 +283,7 @@ func (this *RiskMgr) __analyseIsOpen(w* http.ResponseWriter, r *http.Request) {
atomic.AddInt64(&this.launchBlackListBlockTimes, 1) atomic.AddInt64(&this.launchBlackListBlockTimes, 1)
return false return false
} }
if G.RiskMgr.IsSafeZone(gameId, channel, remoteAddr) { if G.RiskMgr.IsSafeZone(gameId, channel, remoteAddr, &response_str) {
atomic.AddInt64(&this.totalSafeZonePassTimes, 1) atomic.AddInt64(&this.totalSafeZonePassTimes, 1)
atomic.AddInt64(&this.safeZonePassTimes, 1) atomic.AddInt64(&this.safeZonePassTimes, 1)
return true return true

2
third_party/q5 vendored

@ -1 +1 @@
Subproject commit 80edf5bfe52f6e19594d4390a5ab83af8bc0302a Subproject commit 1e70d9f8938d42dfff11538792c4aa5bf9045ba1