From ece409d1806b4edb34e63b272707abb7fe74ba5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=B6=E5=A3=AB=E6=B6=B5?= <630892807@qq.com> Date: Thu, 10 Sep 2020 23:06:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9EIP=E9=BB=91=E5=90=8D=E5=8D=95?= =?UTF-8?q?=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controller/ip.go | 3 +++ router/api.go | 2 +- static/html/setting_bottom.html | 6 ++++++ static/html/setting_ipblack.html | 35 ++++++++++++++++++++++++++++++++ 4 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 static/html/setting_ipblack.html diff --git a/controller/ip.go b/controller/ip.go index 7173c6b..d275fc7 100644 --- a/controller/ip.go +++ b/controller/ip.go @@ -25,6 +25,9 @@ func PostIpblack(c *gin.Context) { } func GetIpblacks(c *gin.Context) { page,_:=strconv.Atoi(c.Query("page")) + if page==0{ + page=1 + } count:=models.CountIps(nil,nil) list:=models.FindIps(nil,nil,uint(page),config.VisitorPageSize) c.JSON(200, gin.H{ diff --git a/router/api.go b/router/api.go index d7294a7..14fb6d1 100644 --- a/router/api.go +++ b/router/api.go @@ -50,5 +50,5 @@ func InitApiRouter(engine *gin.Engine){ engine.DELETE("/notice",middleware.JwtApiMiddleware, controller.DelNotice) engine.GET("/notices",middleware.JwtApiMiddleware, controller.GetNotices) engine.POST("/ipblack",middleware.JwtApiMiddleware,controller.PostIpblack) - engine.POST("/ipblacks_all",middleware.JwtApiMiddleware,controller.GetIpblacks) + engine.GET("/ipblacks_all",middleware.JwtApiMiddleware,controller.GetIpblacks) } \ No newline at end of file diff --git a/static/html/setting_bottom.html b/static/html/setting_bottom.html index efb8748..8374b0d 100644 --- a/static/html/setting_bottom.html +++ b/static/html/setting_bottom.html @@ -70,6 +70,7 @@ roleDialog:false, noticeList:[], welcomeDialog:false, + ipblackList:[], welcomeForm: { content: "", }, @@ -194,6 +195,11 @@ _this.noticeList=result; }); } + if(ACTION=="setting_ipblack"){ + this.sendAjax("/ipblacks_all","get",{},function(result){ + _this.ipblackList=result.list; + }); + } }, sendAjax(url,method,params,callback){ let _this=this; diff --git a/static/html/setting_ipblack.html b/static/html/setting_ipblack.html new file mode 100644 index 0000000..63bcd0f --- /dev/null +++ b/static/html/setting_ipblack.html @@ -0,0 +1,35 @@ +{{template "header" }} +
+ + +
+ +{{template "setting_bottom" .}}