pagination.go 284 B

123456789101112131415161718
  1. package util
  2. import (
  3. "github.com/Unknwon/com"
  4. "github.com/gin-gonic/gin"
  5. "../../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. }