fix: 文件列表补充分页参数
This commit is contained in:
@@ -130,9 +130,23 @@ func (s *NeActionController) Files(c *gin.Context) {
|
||||
c.JSON(200, result.ErrMsg(err.Error()))
|
||||
return
|
||||
}
|
||||
|
||||
// 对数组进行切片分页
|
||||
lenNum := int64(len(rows))
|
||||
start := (querys.PageNum - 1) * querys.PageSize
|
||||
end := start + querys.PageSize
|
||||
var splitRows []ssh.FileListRow
|
||||
if start >= lenNum {
|
||||
splitRows = []ssh.FileListRow{}
|
||||
} else if end >= lenNum {
|
||||
splitRows = rows[start:]
|
||||
} else {
|
||||
splitRows = rows[start:end]
|
||||
}
|
||||
|
||||
c.JSON(200, result.OkData(map[string]any{
|
||||
"path": querys.Path,
|
||||
"total": total,
|
||||
"rows": rows,
|
||||
"rows": splitRows,
|
||||
}))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user