初步完成举报功能

This commit is contained in:
2026-01-21 21:34:11 +08:00
parent 432b875ba4
commit 68d7318285
9 changed files with 1276 additions and 0 deletions

View File

@@ -137,6 +137,30 @@ type SecurityService interface {
ClearVerifyAttempts(ctx context.Context, email, codeType string) error
}
// ReportService 举报服务接口
type ReportService interface {
// 创建举报
CreateReport(ctx context.Context, reporterID int64, targetType model.ReportType, targetID int64, reason string) (*model.Report, error)
// 查询举报
GetByID(ctx context.Context, id int64) (*model.Report, error)
GetByReporterID(ctx context.Context, reporterID, userID int64, page, pageSize int) ([]*model.Report, int64, error)
GetByTarget(ctx context.Context, targetType model.ReportType, targetID, userID int64, page, pageSize int) ([]*model.Report, int64, error)
GetByStatus(ctx context.Context, status model.ReportStatus, page, pageSize int) ([]*model.Report, int64, error)
Search(ctx context.Context, keyword, userID int64, page, pageSize int) ([]*model.Report, int64, error)
// 处理举报
Review(ctx context.Context, reportID, reviewerID int64, status model.ReportStatus, reviewNote string) (*model.Report, error)
BatchReview(ctx context.Context, ids []int64, reviewerID int64, status model.ReportStatus, reviewNote string) (int64, error)
// 删除举报
Delete(ctx context.Context, reportID, userID int64) error
BatchDelete(ctx context.Context, ids []int64, userID int64) (int64, error)
// 统计
GetStats(ctx context.Context) (map[string]int64, error)
}
// Services 服务集合
type Services struct {
User UserService
@@ -147,6 +171,7 @@ type Services struct {
Captcha CaptchaService
Yggdrasil YggdrasilService
Security SecurityService
Report ReportService
}
// ServiceDeps 服务依赖