refactor: 清理死代码 + 修复ISP接口注释
- 移除未使用的DTO类型(ChangePasswordRequest/DeleteAccountRequest) - 移除service层未引用的错误重导出(auth_service/audit_service) - 删除未使用的SiteSettingRepo(数据访问由config.SiteSettings直接处理) - 删除未使用的FindByStatus方法(user_repo) - 删除未使用的AutoMigrate方法(audit_repo/notification_repo) - 删除未使用的PaginatedResult/NewPaginatedResult(pagination.go) - 修复接口注释:notifProvider(5→4)、auditUseCase(4→3)、siteSettingUseCase(3→4) - 移除auditStatusProvider未使用的FindByUsername方法 - 统一使用common.ErrXxx直接引用,消除跨service错误重导出耦合
This commit is contained in:
@ -8,15 +8,6 @@ type Pagination struct {
|
||||
PageSize int `form:"page_size" json:"page_size" binding:"min=1,max=100"`
|
||||
}
|
||||
|
||||
// PaginatedResult 分页响应
|
||||
type PaginatedResult struct {
|
||||
Items interface{} `json:"items"`
|
||||
Total int64 `json:"total"`
|
||||
Page int `json:"page"`
|
||||
PageSize int `json:"page_size"`
|
||||
TotalPages int `json:"total_pages"`
|
||||
}
|
||||
|
||||
// DefaultPagination 默认分页(未传参时使用)
|
||||
func (p *Pagination) DefaultPagination() {
|
||||
if p.Page < 1 {
|
||||
@ -32,20 +23,5 @@ func (p *Pagination) Offset() int {
|
||||
return (p.Page - 1) * p.PageSize
|
||||
}
|
||||
|
||||
// NewPaginatedResult 构建分页响应
|
||||
func NewPaginatedResult(items interface{}, total int64, page, pageSize int) *PaginatedResult {
|
||||
totalPages := int(total) / pageSize
|
||||
if int(total)%pageSize > 0 {
|
||||
totalPages++
|
||||
}
|
||||
return &PaginatedResult{
|
||||
Items: items,
|
||||
Total: total,
|
||||
Page: page,
|
||||
PageSize: pageSize,
|
||||
TotalPages: totalPages,
|
||||
}
|
||||
}
|
||||
|
||||
// 固定时间格式,前后端统一
|
||||
const TimeFormat = time.RFC3339
|
||||
|
||||
Reference in New Issue
Block a user