add page and total field for pagination vo

This commit is contained in:
RockYang
2024-09-03 18:32:15 +08:00
parent 65dde9e69d
commit 1350f388f0
21 changed files with 54 additions and 39 deletions

View File

@@ -135,11 +135,16 @@ func (h *VideoHandler) List(c *gin.Context) {
t := c.Query("type")
page := h.GetInt(c, "page", 1)
pageSize := h.GetInt(c, "page_size", 20)
all := h.GetBool(c, "all")
session := h.DB.Session(&gorm.Session{}).Where("user_id", userId)
if t != "" {
session = session.Where("type", t)
}
if all {
session = session.Where("publish", 0).Where("progress", 100)
} else {
session = session.Where("user_id", h.GetLoginUserId(c))
}
// 统计总数
var total int64
session.Model(&model.VideoJob{}).Count(&total)