feat: 新增渠道页面选择每页显示数量

This commit is contained in:
CaIon
2023-09-23 03:51:04 +08:00
parent 3811575d0c
commit 3595e352d0
2 changed files with 41 additions and 22 deletions

View File

@@ -11,10 +11,14 @@ import (
func GetAllChannels(c *gin.Context) {
p, _ := strconv.Atoi(c.Query("p"))
pageSize, _ := strconv.Atoi(c.Query("page_size"))
if p < 0 {
p = 0
}
channels, err := model.GetAllChannels(p*common.ItemsPerPage, common.ItemsPerPage, false)
if pageSize < 0 {
pageSize = common.ItemsPerPage
}
channels, err := model.GetAllChannels(p*pageSize, pageSize, false)
if err != nil {
c.JSON(http.StatusOK, gin.H{
"success": false,