Browse Source

update

tmp
dengbiao 5 days ago
parent
commit
a4b41b04cf
2 changed files with 4 additions and 4 deletions
  1. +3
    -3
      app/mw/mw_limiter.go
  2. +1
    -1
      app/router/router.go

+ 3
- 3
app/mw/mw_limiter.go View File

@@ -16,7 +16,7 @@ func Limiter(c *gin.Context) {
limit := 500 // 限流次数 limit := 500 // 限流次数
ttl := 2 // 限流过期时间 ttl := 2 // 限流过期时间
ip := utils.GetIP(c.Request) ip := utils.GetIP(c.Request)
if ip != "221.4.210.167" {
if ip != "221.4.210.167" && c.Request.Host != "127.0.0.1:4000" {
e.OutErr(c, e.ERR, "系统维护中~") e.OutErr(c, e.ERR, "系统维护中~")
return return
} }
@@ -34,8 +34,8 @@ func Limiter(c *gin.Context) {
// Write body back // Write body back
c.Request.Body = ioutil.NopCloser(bytes.NewBuffer(body)) c.Request.Body = ioutil.NopCloser(bytes.NewBuffer(body))
utils.FilePutContents("Limiter", utils.SerializeStr(map[string]interface{}{ utils.FilePutContents("Limiter", utils.SerializeStr(map[string]interface{}{
"uri": c.Request.URL,
"body": c.Request.Body,
"uri": c.Request.URL.Path,
"body": string(bytes.NewBuffer(body).Bytes()),
})) }))
//queryValue := utils.SerializeStr(c.Request.URL.Query()) //不建议开启,失去限流的意义 //queryValue := utils.SerializeStr(c.Request.URL.Query()) //不建议开启,失去限流的意义




+ 1
- 1
app/router/router.go View File

@@ -63,8 +63,8 @@ func route(r *gin.RouterGroup) {
rCallback.Any("/alipay/face", hdl.CallbackAlipayFace) //支付宝实名回调 rCallback.Any("/alipay/face", hdl.CallbackAlipayFace) //支付宝实名回调
} }


r.Use(mw.Limiter) //进行限流
r.Use(mw.CheckSign) r.Use(mw.CheckSign)
r.Use(mw.Limiter) //进行限流
r.Any("/testCreateSign", hdl.TestCreateSign) r.Any("/testCreateSign", hdl.TestCreateSign)
r.GET("/openApp/start", hdl.Start) //打开app调用 r.GET("/openApp/start", hdl.Start) //打开app调用
r.GET("/config", hdl.Config) //基本配置 r.GET("/config", hdl.Config) //基本配置


Loading…
Cancel
Save