实现 sse 检查订单,减少请求次数

This commit is contained in:
2025-12-04 09:45:35 +08:00
parent caa997b95c
commit 2d053ddf49
14 changed files with 107 additions and 67 deletions

View File

@@ -1,33 +0,0 @@
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 {
}