page.go 473 B

12345678910111213141516171819
  1. package services
  2. import "github.com/gin-gonic/gin"
  3. // GetCurrPageByClaims 从Claims中获取当前页码
  4. func GetCurrPageByClaims(c *gin.Context) (currPage int) {
  5. //获取jwt数据失败
  6. claims, _ := c.Get("curr_page")
  7. currPage = claims.(int)
  8. return
  9. }
  10. // GetPageSizeByClaims 从Claims中获取当前每页数据量
  11. func GetPageSizeByClaims(c *gin.Context) (pageSize int) {
  12. //获取jwt数据失败
  13. claims, _ := c.Get("page_size")
  14. pageSize = claims.(int)
  15. return
  16. }