This commit is contained in:
oneao committed 2026-02-25 17:31:09 +08:00
1 parent 835958886e
commit d04d22723b
155 files changed
+543 -9793

No files matched your search

@@ -0,0 +1,30 @@
package middleware
import (
"allapp/db"
"allapp/logx"
"context"
"github.com/cloudwego/hertz/pkg/app"
)
func RefreshActive() app.HandlerFunc {
return func(c context.Context, ctx *app.RequestContext) {
// 先执行后续 handler
ctx.Next(c)
userID := GetUserID(c)
if userID == 0 {
return
}
// 异步刷新活跃时间
go func(userID int64) {
ctx := context.Background()
if err := db.Queries.UpdateUserLastLoginTime(ctx, userID); err != nil {
logx.CtxError(ctx, "刷新用户活跃时间失败, userID=%d, err=%v", userID, err)
}
}(userID)
}
}