feat 包命名规范

This commit is contained in:
2026-02-11 14:49:46 +08:00
parent 1a42e055ae
commit 77cc02fc95
12 changed files with 65 additions and 92 deletions

View File

@@ -0,0 +1,28 @@
package grpcserver
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
}