refactor: 提取分页魔法数字为 pagination 常量

- handler 层: device/log/webhook/user handler 使用 pagination.DefaultPageSize/MaxPageSize
- service 层: device/login_log/operation_log service 使用 pagination.DefaultPageSize
- repository 层: user repository 使用 pagination.DefaultPageSize/MaxPageSize
- 消除 8 处硬编码的 20/100 分页魔法数字
This commit is contained in:
2026-05-08 12:40:36 +08:00
parent 202b3963f8
commit 1f7a223768
8 changed files with 30 additions and 26 deletions

View File

@@ -362,10 +362,10 @@ func (r *UserRepository) AdvancedSearch(ctx context.Context, filter *AdvancedFil
// 分页
limit := filter.Limit
if limit <= 0 {
limit = 20
limit = pagination.DefaultPageSize
}
if limit > 200 {
limit = 200
if limit > pagination.MaxPageSize {
limit = pagination.MaxPageSize
}
query = query.Offset(filter.Offset).Limit(limit)