feat 包命名规范
This commit is contained in:
28
internal/grpcserver/server_leaderboard.go
Normal file
28
internal/grpcserver/server_leaderboard.go
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user