wp-go/middleware/searchlimit.go
2022-10-14 17:15:43 +08:00

16 lines
250 B
Go

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()
}
}
}