wp-go/middleware/searchlimit.go

16 lines
250 B
Go
Raw Normal View History

2022-10-14 09:15:43 +00:00
package middleware
import "github.com/gin-gonic/gin"
func SearchLimit(num int64) func(ctx *gin.Context) {
fn := IpLimit(num)
return func(c *gin.Context) {
if "/" == c.FullPath() && c.Query("s") != "" {
fn(c)
} else {
c.Next()
}
}
}