pagination.go 304 B

123456789101112131415161718
  1. package util
  2. import (
  3. "github.com/gin-gonic/gin"
  4. "github.com/unknwon/com"
  5. "github.com/kptyun/KPTCOMM/pkg/setting"
  6. )
  7. func GetPage(c *gin.Context) int {
  8. result := 0
  9. page := com.StrTo(c.Query("page")).MustInt()
  10. if page > 0 {
  11. result = (page - 1) * setting.AppSetting.PageSize
  12. }
  13. return result
  14. }