重构代码结构与认证体系,集成异步任务消费者

This commit is contained in:
2025-11-17 18:38:10 +08:00
parent a97c970166
commit a245229bc2
70 changed files with 2000 additions and 2334 deletions

33
web/events/log.go Normal file
View File

@@ -0,0 +1,33 @@
package events
import (
"encoding/json"
"github.com/hibiken/asynq"
"log/slog"
"time"
)
type RequestLog struct {
Type string
User int32
IP string
UA string
Method string
Path string
Status int
Error string
Latency time.Duration
Time time.Time
}
func NewRequestLog(data RequestLog) *asynq.Task {
var rs, err = json.Marshal(data)
if err != nil {
slog.Error("日志数据序列化失败", slog.Any("err", err), slog.Any("data", data))
return nil
}
return asynq.NewTask("logs:request", rs)
}
type LoginLog struct {
}