wp-go/middleware/searchlimit.go
2022-10-17 20:04:29 +08:00

16 lines
227 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.Query("s") != "" {
fn(c)
} else {
c.Next()
}
}
}