Selaa lähdekoodia

修改ip黑名单

longyu 2 vuotta sitten
vanhempi
commit
37b61c1561
1 muutettua tiedostoa jossa 9 lisäystä ja 0 poistoa
  1. 9 0
      controllers/base_auth.go

+ 9 - 0
controllers/base_auth.go

@@ -8,6 +8,7 @@ import (
 	"net/http"
 	"net/url"
 	"github.com/beego/beego/v2/server/web"
+	"strings"
 
 	"github.com/rdlucklib/rdluck_tools/log"
 )
@@ -32,6 +33,14 @@ func (this *BaseAuthController) Prepare() {
 	method := this.Ctx.Input.Method()
 	uri := this.Ctx.Input.URI()
 	fmt.Println("Url:", uri)
+
+	ip:=this.Ctx.Input.IP()
+	if strings.Contains(ip,"61.140.25.94") {
+		this.JSON(models.BaseResponse{Ret: 6000, Msg: "该图表已被删除", ErrMsg: "该图表已被删除"}, false, false)
+		this.StopRun()
+		return
+	}
+
 	if method != "HEAD" {
 		if method == "POST" || method == "GET" {
 			//authorization := this.Ctx.Input.Header("authorization")