feat 模块增加after start
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user