feat 模块增加after start

This commit is contained in:
2026-01-20 12:11:27 +08:00
parent 23b2220903
commit f80167df85
5 changed files with 32 additions and 16 deletions

View File

@@ -2,9 +2,27 @@ package grpc_server
import (
"context"
"git.hlsq.asia/mmorpg/service-common/db/redis"
)
// 答题总数排行榜
// 正确数量排行榜
// 正确率排行榜
// 错误数量排行榜
// 错误率排行榜
var (
scriptUpdateSha1 string
scriptUpdate = `
local key = KEYS[1]
`
)
// UpdateLeaderboard 更新排行榜
func (s *Server) UpdateLeaderboard(ctx context.Context) error {
if scriptUpdateSha1 == "" {
scriptUpdateSha1 = redis.GetClient().ScriptLoad(ctx, scriptUpdate).Val()
}
redis.GetClient().EvalSha(ctx, scriptUpdateSha1, []string{"key"}, "value")
return nil
}