修改结算排名逻辑
Some checks failed
/ start-services (push) Has been skipped
/ build-services (app/ecpm_service/Dockerfile, ecpm, ecpm) (push) Failing after 24s
/ build-services (app/ranking_service/Dockerfile, ranking, ranking) (push) Failing after 3s
/ build-services (app/user_service/Dockerfile, user, user) (push) Failing after 5s
/ build-services (app/auth_service/Dockerfile, auth, auth) (push) Successful in 59s
Some checks failed
/ start-services (push) Has been skipped
/ build-services (app/ecpm_service/Dockerfile, ecpm, ecpm) (push) Failing after 24s
/ build-services (app/ranking_service/Dockerfile, ranking, ranking) (push) Failing after 3s
/ build-services (app/user_service/Dockerfile, user, user) (push) Failing after 5s
/ build-services (app/auth_service/Dockerfile, auth, auth) (push) Successful in 59s
This commit is contained in:
parent
03d9f121ed
commit
a61268904a
@ -2,10 +2,14 @@ package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ranking_service/internal/logic/rankings"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ranking_service/internal/svc"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ranking_service/ranking"
|
||||
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/user_service/user"
|
||||
"github.com/redis/go-redis/v9"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
@ -24,22 +28,73 @@ func NewAtomicGetHigherUserLogic(ctx context.Context, svcCtx *svc.ServiceContext
|
||||
}
|
||||
}
|
||||
|
||||
func (l *AtomicGetHigherUserLogic) AtomicGetHigherUser(in *ranking.AtomicGetHigherUserRequest) (*ranking.RankingList, error) {
|
||||
func (l *AtomicGetHigherUserLogic) AtomicGetHigherUser(in *ranking.AtomicGetHigherUserRequest) (res *ranking.GetRankingListResponse, err error) {
|
||||
//返回 上一名、自己最高分、目前得分三个排名
|
||||
res = &ranking.GetRankingListResponse{RankingData: make([]*ranking.RankingList, 0, 3)}
|
||||
cacheKey := rankings.GetRankingsCacheKey(in.AppId, in.Type)
|
||||
userId, score, err := l.svcCtx.RedisRanking.AtomicGetHigherUser(l.ctx, cacheKey, float64(in.Score))
|
||||
//查询上一名,如果上一名为自己,则查询上上一名
|
||||
findScore := in.Score
|
||||
label:
|
||||
userId, score, err := l.svcCtx.RedisRanking.AtomicGetHigherUser(l.ctx, cacheKey, float64(uint64(findScore)<<32+uint64(time.Now().Unix())))
|
||||
if err != nil && !errors.Is(err, redis.Nil) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if userId == in.UserId {
|
||||
findScore = score
|
||||
goto label
|
||||
}
|
||||
|
||||
// 如果没有上一名则不返回
|
||||
if !errors.Is(err, redis.Nil) {
|
||||
userModel, err := l.svcCtx.UserServiceClient.GetUserById(l.ctx, &user.UserId{UserId: userId})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
//上一名
|
||||
rank, err := l.svcCtx.RedisRanking.GetRank(l.ctx, cacheKey, strconv.FormatUint(userId, 10))
|
||||
if err != nil && !errors.Is(err, redis.Nil) {
|
||||
return nil, err
|
||||
}
|
||||
res.RankingData = append(res.RankingData, &ranking.RankingList{
|
||||
Nickname: userModel.Nickname,
|
||||
Avatar: userModel.Avatar,
|
||||
Score: findScore,
|
||||
Rank: uint32(rank),
|
||||
})
|
||||
}
|
||||
|
||||
//自己最高分
|
||||
rank, maxScore, err := l.svcCtx.RedisRanking.GetRankAndScore(l.ctx, cacheKey, strconv.FormatUint(in.UserId, 10))
|
||||
if err != nil && !errors.Is(err, redis.Nil) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
//查询自己的数据
|
||||
mineUser, err := l.svcCtx.UserServiceClient.GetUserById(l.ctx, &user.UserId{UserId: in.UserId})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
//查询用户数据,FindOne带缓存
|
||||
userModel, err := l.svcCtx.UserServiceClient.GetUserById(l.ctx, &user.UserId{UserId: userId})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
//最高分大于当前分数,则返回最高分
|
||||
if uint32(uint64(maxScore)>>32) > findScore {
|
||||
res.RankingData = append(res.RankingData, &ranking.RankingList{
|
||||
Nickname: mineUser.Nickname,
|
||||
Avatar: mineUser.Avatar,
|
||||
Score: uint32(uint64(maxScore) >> 32),
|
||||
Self: true,
|
||||
Rank: uint32(rank),
|
||||
})
|
||||
}
|
||||
|
||||
return &ranking.RankingList{
|
||||
Nickname: userModel.Nickname,
|
||||
Avatar: userModel.Avatar,
|
||||
Score: score,
|
||||
}, nil
|
||||
//目前得分
|
||||
res.RankingData = append(res.RankingData, &ranking.RankingList{
|
||||
Nickname: mineUser.Nickname,
|
||||
Avatar: mineUser.Avatar,
|
||||
Score: in.Score,
|
||||
Self: true,
|
||||
})
|
||||
|
||||
return
|
||||
}
|
||||
|
@ -40,6 +40,12 @@ func (r *Ranking) GetRank(ctx context.Context, key, member string) (rank int64,
|
||||
return r.c.ZRevRank(ctx, key, member).Result()
|
||||
}
|
||||
|
||||
// GetRankAndScore 获取指定成员在排行榜中的排名(排名从 0 开始,分数越高排名越靠前)
|
||||
func (r *Ranking) GetRankAndScore(ctx context.Context, key, member string) (rank int64, score float64, err error) {
|
||||
rankScore := r.c.ZRevRankWithScore(ctx, key, member).Val()
|
||||
return rankScore.Rank, rankScore.Score, nil
|
||||
}
|
||||
|
||||
// GetScore 获取指定成员在排行榜中的分数
|
||||
func (r *Ranking) GetScore(ctx context.Context, key, member string) (score float64, err error) {
|
||||
return r.c.ZScore(ctx, key, member).Result()
|
||||
|
@ -48,7 +48,7 @@ func (s *RankingServiceServer) RemoveRanking(ctx context.Context, in *ranking.Re
|
||||
return l.RemoveRanking(in)
|
||||
}
|
||||
|
||||
func (s *RankingServiceServer) AtomicGetHigherUser(ctx context.Context, in *ranking.AtomicGetHigherUserRequest) (*ranking.RankingList, error) {
|
||||
func (s *RankingServiceServer) AtomicGetHigherUser(ctx context.Context, in *ranking.AtomicGetHigherUserRequest) (*ranking.GetRankingListResponse, error) {
|
||||
l := logic.NewAtomicGetHigherUserLogic(ctx, s.svcCtx)
|
||||
return l.AtomicGetHigherUser(in)
|
||||
}
|
||||
|
@ -545,6 +545,7 @@ type AtomicGetHigherUserRequest struct {
|
||||
AppId uint32 `protobuf:"varint,1,opt,name=appId,proto3" json:"appId,omitempty"`
|
||||
Score uint32 `protobuf:"varint,2,opt,name=score,proto3" json:"score,omitempty"`
|
||||
Type uint32 `protobuf:"varint,3,opt,name=type,proto3" json:"type,omitempty"`
|
||||
UserId uint64 `protobuf:"varint,4,opt,name=userId,proto3" json:"userId,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
@ -600,6 +601,13 @@ func (x *AtomicGetHigherUserRequest) GetType() uint32 {
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *AtomicGetHigherUserRequest) GetUserId() uint64 {
|
||||
if x != nil {
|
||||
return x.UserId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
var File_ranking_service_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_ranking_service_proto_rawDesc = string([]byte{
|
||||
@ -653,48 +661,50 @@ var file_ranking_service_proto_rawDesc = string([]byte{
|
||||
0x65, 0x52, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12,
|
||||
0x14, 0x0a, 0x05, 0x61, 0x70, 0x70, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05,
|
||||
0x61, 0x70, 0x70, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20,
|
||||
0x01, 0x28, 0x0d, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0x5c, 0x0a, 0x1a, 0x41, 0x74, 0x6f,
|
||||
0x01, 0x28, 0x0d, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0x74, 0x0a, 0x1a, 0x41, 0x74, 0x6f,
|
||||
0x6d, 0x69, 0x63, 0x47, 0x65, 0x74, 0x48, 0x69, 0x67, 0x68, 0x65, 0x72, 0x55, 0x73, 0x65, 0x72,
|
||||
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x70, 0x70, 0x49, 0x64,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x61, 0x70, 0x70, 0x49, 0x64, 0x12, 0x14, 0x0a,
|
||||
0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x73, 0x63,
|
||||
0x6f, 0x72, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28,
|
||||
0x0d, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x32, 0x9e, 0x04, 0x0a, 0x0f, 0x72, 0x61, 0x6e, 0x6b,
|
||||
0x69, 0x6e, 0x67, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3b, 0x0a, 0x04, 0x50,
|
||||
0x69, 0x6e, 0x67, 0x12, 0x18, 0x2e, 0x72, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x65,
|
||||
0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e,
|
||||
0x72, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e,
|
||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x59, 0x0a, 0x10, 0x53, 0x65, 0x74, 0x55,
|
||||
0x73, 0x65, 0x72, 0x47, 0x61, 0x6d, 0x65, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x12, 0x28, 0x2e, 0x72,
|
||||
0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53,
|
||||
0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x47, 0x61, 0x6d, 0x65, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x52,
|
||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x72, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67,
|
||||
0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73,
|
||||
0x75, 0x6c, 0x74, 0x12, 0x61, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x6b, 0x69, 0x6e,
|
||||
0x67, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x26, 0x2e, 0x72, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x5f,
|
||||
0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x6b, 0x69,
|
||||
0x6e, 0x67, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e,
|
||||
0x0d, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49,
|
||||
0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x32,
|
||||
0xa9, 0x04, 0x0a, 0x0f, 0x72, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x65, 0x72, 0x76,
|
||||
0x69, 0x63, 0x65, 0x12, 0x3b, 0x0a, 0x04, 0x50, 0x69, 0x6e, 0x67, 0x12, 0x18, 0x2e, 0x72, 0x61,
|
||||
0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x52, 0x65,
|
||||
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x72, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x5f,
|
||||
0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
||||
0x12, 0x59, 0x0a, 0x10, 0x53, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x47, 0x61, 0x6d, 0x65, 0x53,
|
||||
0x63, 0x6f, 0x72, 0x65, 0x12, 0x28, 0x2e, 0x72, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x73,
|
||||
0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x47, 0x61,
|
||||
0x6d, 0x65, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b,
|
||||
0x2e, 0x72, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
|
||||
0x2e, 0x42, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x61, 0x0a, 0x0e, 0x47,
|
||||
0x65, 0x74, 0x52, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x26, 0x2e,
|
||||
0x72, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e,
|
||||
0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65,
|
||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x59, 0x0a, 0x10, 0x41, 0x64, 0x64, 0x55, 0x73, 0x65,
|
||||
0x72, 0x47, 0x61, 0x6d, 0x65, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x12, 0x28, 0x2e, 0x72, 0x61, 0x6e,
|
||||
0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x41, 0x64, 0x64,
|
||||
0x55, 0x73, 0x65, 0x72, 0x47, 0x61, 0x6d, 0x65, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x71,
|
||||
0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x72, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x73,
|
||||
0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c,
|
||||
0x74, 0x12, 0x53, 0x0a, 0x0d, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x52, 0x61, 0x6e, 0x6b, 0x69,
|
||||
0x6e, 0x67, 0x12, 0x25, 0x2e, 0x72, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x65, 0x72,
|
||||
0x76, 0x69, 0x63, 0x65, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x52, 0x61, 0x6e, 0x6b, 0x69,
|
||||
0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x72, 0x61, 0x6e, 0x6b,
|
||||
0x69, 0x6e, 0x67, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x42, 0x61, 0x73, 0x65,
|
||||
0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x60, 0x0a, 0x13, 0x41, 0x74, 0x6f, 0x6d, 0x69, 0x63,
|
||||
0x47, 0x65, 0x74, 0x48, 0x69, 0x67, 0x68, 0x65, 0x72, 0x55, 0x73, 0x65, 0x72, 0x12, 0x2b, 0x2e,
|
||||
0x72, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e,
|
||||
0x41, 0x74, 0x6f, 0x6d, 0x69, 0x63, 0x47, 0x65, 0x74, 0x48, 0x69, 0x67, 0x68, 0x65, 0x72, 0x55,
|
||||
0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x72, 0x61, 0x6e,
|
||||
0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x52, 0x61, 0x6e,
|
||||
0x6b, 0x69, 0x6e, 0x67, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x0b, 0x5a, 0x09, 0x2e, 0x2f, 0x72, 0x61,
|
||||
0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x72, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x5f,
|
||||
0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x6b, 0x69,
|
||||
0x6e, 0x67, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x59,
|
||||
0x0a, 0x10, 0x41, 0x64, 0x64, 0x55, 0x73, 0x65, 0x72, 0x47, 0x61, 0x6d, 0x65, 0x53, 0x63, 0x6f,
|
||||
0x72, 0x65, 0x12, 0x28, 0x2e, 0x72, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x65, 0x72,
|
||||
0x76, 0x69, 0x63, 0x65, 0x2e, 0x41, 0x64, 0x64, 0x55, 0x73, 0x65, 0x72, 0x47, 0x61, 0x6d, 0x65,
|
||||
0x53, 0x63, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x72,
|
||||
0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x42,
|
||||
0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x53, 0x0a, 0x0d, 0x52, 0x65, 0x6d,
|
||||
0x6f, 0x76, 0x65, 0x52, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x12, 0x25, 0x2e, 0x72, 0x61, 0x6e,
|
||||
0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x52, 0x65, 0x6d,
|
||||
0x6f, 0x76, 0x65, 0x52, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||
0x74, 0x1a, 0x1b, 0x2e, 0x72, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x65, 0x72, 0x76,
|
||||
0x69, 0x63, 0x65, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x6b,
|
||||
0x0a, 0x13, 0x41, 0x74, 0x6f, 0x6d, 0x69, 0x63, 0x47, 0x65, 0x74, 0x48, 0x69, 0x67, 0x68, 0x65,
|
||||
0x72, 0x55, 0x73, 0x65, 0x72, 0x12, 0x2b, 0x2e, 0x72, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x5f,
|
||||
0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x41, 0x74, 0x6f, 0x6d, 0x69, 0x63, 0x47, 0x65,
|
||||
0x74, 0x48, 0x69, 0x67, 0x68, 0x65, 0x72, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65,
|
||||
0x73, 0x74, 0x1a, 0x27, 0x2e, 0x72, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x65, 0x72,
|
||||
0x76, 0x69, 0x63, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x4c,
|
||||
0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x0b, 0x5a, 0x09, 0x2e,
|
||||
0x2f, 0x72, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
})
|
||||
|
||||
var (
|
||||
@ -735,7 +745,7 @@ var file_ranking_service_proto_depIdxs = []int32{
|
||||
4, // 9: ranking_service.ranking_service.GetRankingList:output_type -> ranking_service.GetRankingListResponse
|
||||
6, // 10: ranking_service.ranking_service.AddUserGameScore:output_type -> ranking_service.BaseResult
|
||||
6, // 11: ranking_service.ranking_service.RemoveRanking:output_type -> ranking_service.BaseResult
|
||||
3, // 12: ranking_service.ranking_service.AtomicGetHigherUser:output_type -> ranking_service.RankingList
|
||||
4, // 12: ranking_service.ranking_service.AtomicGetHigherUser:output_type -> ranking_service.GetRankingListResponse
|
||||
7, // [7:13] is the sub-list for method output_type
|
||||
1, // [1:7] is the sub-list for method input_type
|
||||
1, // [1:1] is the sub-list for extension type_name
|
||||
|
@ -36,7 +36,7 @@ type RankingServiceClient interface {
|
||||
GetRankingList(ctx context.Context, in *GetRankingListRequest, opts ...grpc.CallOption) (*GetRankingListResponse, error)
|
||||
AddUserGameScore(ctx context.Context, in *AddUserGameScoreRequest, opts ...grpc.CallOption) (*BaseResult, error)
|
||||
RemoveRanking(ctx context.Context, in *RemoveRankingRequest, opts ...grpc.CallOption) (*BaseResult, error)
|
||||
AtomicGetHigherUser(ctx context.Context, in *AtomicGetHigherUserRequest, opts ...grpc.CallOption) (*RankingList, error)
|
||||
AtomicGetHigherUser(ctx context.Context, in *AtomicGetHigherUserRequest, opts ...grpc.CallOption) (*GetRankingListResponse, error)
|
||||
}
|
||||
|
||||
type rankingServiceClient struct {
|
||||
@ -97,9 +97,9 @@ func (c *rankingServiceClient) RemoveRanking(ctx context.Context, in *RemoveRank
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *rankingServiceClient) AtomicGetHigherUser(ctx context.Context, in *AtomicGetHigherUserRequest, opts ...grpc.CallOption) (*RankingList, error) {
|
||||
func (c *rankingServiceClient) AtomicGetHigherUser(ctx context.Context, in *AtomicGetHigherUserRequest, opts ...grpc.CallOption) (*GetRankingListResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(RankingList)
|
||||
out := new(GetRankingListResponse)
|
||||
err := c.cc.Invoke(ctx, RankingService_AtomicGetHigherUser_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -116,7 +116,7 @@ type RankingServiceServer interface {
|
||||
GetRankingList(context.Context, *GetRankingListRequest) (*GetRankingListResponse, error)
|
||||
AddUserGameScore(context.Context, *AddUserGameScoreRequest) (*BaseResult, error)
|
||||
RemoveRanking(context.Context, *RemoveRankingRequest) (*BaseResult, error)
|
||||
AtomicGetHigherUser(context.Context, *AtomicGetHigherUserRequest) (*RankingList, error)
|
||||
AtomicGetHigherUser(context.Context, *AtomicGetHigherUserRequest) (*GetRankingListResponse, error)
|
||||
mustEmbedUnimplementedRankingServiceServer()
|
||||
}
|
||||
|
||||
@ -142,7 +142,7 @@ func (UnimplementedRankingServiceServer) AddUserGameScore(context.Context, *AddU
|
||||
func (UnimplementedRankingServiceServer) RemoveRanking(context.Context, *RemoveRankingRequest) (*BaseResult, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method RemoveRanking not implemented")
|
||||
}
|
||||
func (UnimplementedRankingServiceServer) AtomicGetHigherUser(context.Context, *AtomicGetHigherUserRequest) (*RankingList, error) {
|
||||
func (UnimplementedRankingServiceServer) AtomicGetHigherUser(context.Context, *AtomicGetHigherUserRequest) (*GetRankingListResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method AtomicGetHigherUser not implemented")
|
||||
}
|
||||
func (UnimplementedRankingServiceServer) mustEmbedUnimplementedRankingServiceServer() {}
|
||||
|
@ -61,6 +61,7 @@ message AtomicGetHigherUserRequest{
|
||||
uint32 appId = 1;
|
||||
uint32 score = 2;
|
||||
uint32 type = 3;
|
||||
uint64 userId = 4;
|
||||
}
|
||||
|
||||
|
||||
@ -75,5 +76,5 @@ service ranking_service {
|
||||
|
||||
rpc RemoveRanking(RemoveRankingRequest) returns(BaseResult);
|
||||
|
||||
rpc AtomicGetHigherUser(AtomicGetHigherUserRequest) returns(RankingList);
|
||||
rpc AtomicGetHigherUser(AtomicGetHigherUserRequest) returns(GetRankingListResponse);
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ type (
|
||||
GetRankingList(ctx context.Context, in *GetRankingListRequest, opts ...grpc.CallOption) (*GetRankingListResponse, error)
|
||||
AddUserGameScore(ctx context.Context, in *AddUserGameScoreRequest, opts ...grpc.CallOption) (*BaseResult, error)
|
||||
RemoveRanking(ctx context.Context, in *RemoveRankingRequest, opts ...grpc.CallOption) (*BaseResult, error)
|
||||
AtomicGetHigherUser(ctx context.Context, in *AtomicGetHigherUserRequest, opts ...grpc.CallOption) (*RankingList, error)
|
||||
AtomicGetHigherUser(ctx context.Context, in *AtomicGetHigherUserRequest, opts ...grpc.CallOption) (*GetRankingListResponse, error)
|
||||
}
|
||||
|
||||
defaultRankingService struct {
|
||||
@ -70,7 +70,7 @@ func (m *defaultRankingService) RemoveRanking(ctx context.Context, in *RemoveRan
|
||||
return client.RemoveRanking(ctx, in, opts...)
|
||||
}
|
||||
|
||||
func (m *defaultRankingService) AtomicGetHigherUser(ctx context.Context, in *AtomicGetHigherUserRequest, opts ...grpc.CallOption) (*RankingList, error) {
|
||||
func (m *defaultRankingService) AtomicGetHigherUser(ctx context.Context, in *AtomicGetHigherUserRequest, opts ...grpc.CallOption) (*GetRankingListResponse, error) {
|
||||
client := ranking.NewRankingServiceClient(m.cli.Conn())
|
||||
return client.AtomicGetHigherUser(ctx, in, opts...)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user