wp-go/internal/middleware/searchlimit.go
2023-01-12 18:17:34 +08:00

16 lines
254 B
Go

package middleware
import "github.com/gin-gonic/gin"
func SearchLimit(num int64) (func(ctx *gin.Context), func(int64)) {
fn, reFn := IpLimit(num)
return func(c *gin.Context) {
if c.Query("s") != "" {
fn(c)
} else {
c.Next()
}
}, reFn
}