修改结算排名逻辑
All checks were successful
/ build-services (app/auth_service/Dockerfile, auth, auth) (push) Successful in 40s
/ build-services (app/ecpm_service/Dockerfile, ecpm, ecpm) (push) Successful in 37s
/ start-services (push) Successful in 4s
/ build-services (app/ranking_service/Dockerfile, ranking, ranking) (push) Successful in 39s
/ build-services (app/user_service/Dockerfile, user, user) (push) Successful in 38s
All checks were successful
/ build-services (app/auth_service/Dockerfile, auth, auth) (push) Successful in 40s
/ build-services (app/ecpm_service/Dockerfile, ecpm, ecpm) (push) Successful in 37s
/ start-services (push) Successful in 4s
/ build-services (app/ranking_service/Dockerfile, ranking, ranking) (push) Successful in 39s
/ build-services (app/user_service/Dockerfile, user, user) (push) Successful in 38s
This commit is contained in:
parent
a61268904a
commit
d29be00652
@ -31,6 +31,7 @@ func NewGetEcpmLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetEcpmLo
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (l *GetEcpmLogic) GetEcpm(in *ecpm.GetEcpmRequest) (response *ecpm.GetEcpmResponse, err error) {
|
func (l *GetEcpmLogic) GetEcpm(in *ecpm.GetEcpmRequest) (response *ecpm.GetEcpmResponse, err error) {
|
||||||
|
response = &ecpm.GetEcpmResponse{}
|
||||||
//获取抖音accessToken
|
//获取抖音accessToken
|
||||||
res, err := l.svcCtx.AuthServiceClient.GetAccessToken(l.ctx, &auth.GetAccessTokenRequest{
|
res, err := l.svcCtx.AuthServiceClient.GetAccessToken(l.ctx, &auth.GetAccessTokenRequest{
|
||||||
AppId: in.AppId,
|
AppId: in.AppId,
|
||||||
|
@ -28,73 +28,40 @@ func NewAtomicGetHigherUserLogic(ctx context.Context, svcCtx *svc.ServiceContext
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *AtomicGetHigherUserLogic) AtomicGetHigherUser(in *ranking.AtomicGetHigherUserRequest) (res *ranking.GetRankingListResponse, err error) {
|
func (l *AtomicGetHigherUserLogic) AtomicGetHigherUser(in *ranking.AtomicGetHigherUserRequest) (res *ranking.RankingList, err error) {
|
||||||
//返回 上一名、自己最高分、目前得分三个排名
|
//返回 上一名、自己最高分、目前得分三个排名
|
||||||
res = &ranking.GetRankingListResponse{RankingData: make([]*ranking.RankingList, 0, 3)}
|
|
||||||
cacheKey := rankings.GetRankingsCacheKey(in.AppId, in.Type)
|
cacheKey := rankings.GetRankingsCacheKey(in.AppId, in.Type)
|
||||||
//查询上一名,如果上一名为自己,则查询上上一名
|
//查询上一名,如果上一名为自己,则查询上上一名
|
||||||
findScore := in.Score
|
userId, score, err := l.svcCtx.RedisRanking.AtomicGetHigherUser(l.ctx, cacheKey, float64(uint64(in.Score)<<32+uint64(time.Now().Unix())))
|
||||||
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) {
|
if err != nil && !errors.Is(err, redis.Nil) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if userId == in.UserId {
|
if userId == in.UserId {
|
||||||
findScore = score
|
userId, score, err = l.svcCtx.RedisRanking.AtomicGetHigherUser(l.ctx, cacheKey, float64(uint64(score)<<32+uint64(time.Now().Unix())))
|
||||||
goto label
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果没有上一名则不返回
|
// 如果没有上一名则不返回
|
||||||
if !errors.Is(err, redis.Nil) {
|
if errors.Is(err, redis.Nil) {
|
||||||
userModel, err := l.svcCtx.UserServiceClient.GetUserById(l.ctx, &user.UserId{UserId: userId})
|
return &ranking.RankingList{}, nil
|
||||||
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),
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//自己最高分
|
userModel, err := l.svcCtx.UserServiceClient.GetUserById(l.ctx, &user.UserId{UserId: userId})
|
||||||
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
//最高分大于当前分数,则返回最高分
|
//上一名
|
||||||
if uint32(uint64(maxScore)>>32) > findScore {
|
rank, err := l.svcCtx.RedisRanking.GetRank(l.ctx, cacheKey, strconv.FormatUint(userId, 10))
|
||||||
res.RankingData = append(res.RankingData, &ranking.RankingList{
|
if err != nil && !errors.Is(err, redis.Nil) {
|
||||||
Nickname: mineUser.Nickname,
|
return nil, err
|
||||||
Avatar: mineUser.Avatar,
|
}
|
||||||
Score: uint32(uint64(maxScore) >> 32),
|
res = &ranking.RankingList{
|
||||||
Self: true,
|
Nickname: userModel.Nickname,
|
||||||
Rank: uint32(rank),
|
Avatar: userModel.Avatar,
|
||||||
})
|
Score: score,
|
||||||
|
Rank: uint32(rank),
|
||||||
}
|
}
|
||||||
|
|
||||||
//目前得分
|
|
||||||
res.RankingData = append(res.RankingData, &ranking.RankingList{
|
|
||||||
Nickname: mineUser.Nickname,
|
|
||||||
Avatar: mineUser.Avatar,
|
|
||||||
Score: in.Score,
|
|
||||||
Self: true,
|
|
||||||
})
|
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
68
app/ranking_service/internal/logic/settlement_logic.go
Normal file
68
app/ranking_service/internal/logic/settlement_logic.go
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
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/user_service/user"
|
||||||
|
"github.com/redis/go-redis/v9"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ranking_service/internal/svc"
|
||||||
|
"gitea.youtukeji.com.cn/youtu/youtu_grpc/app/ranking_service/ranking"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
)
|
||||||
|
|
||||||
|
type SettlementLogic struct {
|
||||||
|
ctx context.Context
|
||||||
|
svcCtx *svc.ServiceContext
|
||||||
|
logx.Logger
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewSettlementLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SettlementLogic {
|
||||||
|
return &SettlementLogic{
|
||||||
|
ctx: ctx,
|
||||||
|
svcCtx: svcCtx,
|
||||||
|
Logger: logx.WithContext(ctx),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *SettlementLogic) Settlement(in *ranking.AtomicGetHigherUserRequest) (res *ranking.SettlementResponse, err error) {
|
||||||
|
res = &ranking.SettlementResponse{}
|
||||||
|
cacheKey := rankings.GetRankingsCacheKey(in.AppId, in.Type)
|
||||||
|
|
||||||
|
//查询高一名分数
|
||||||
|
higherLogic := NewAtomicGetHigherUserLogic(l.ctx, l.svcCtx)
|
||||||
|
res.Higher, err = higherLogic.AtomicGetHigherUser(in)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
//查询自己的数据
|
||||||
|
mineUser, err := l.svcCtx.UserServiceClient.GetUserById(l.ctx, &user.UserId{UserId: in.UserId})
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
//自己最高分
|
||||||
|
_, 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
|
||||||
|
}
|
||||||
|
|
||||||
|
if uMax := uint32(uint64(maxScore) >> 32); uMax > in.Score {
|
||||||
|
res.MineMax = uMax
|
||||||
|
} else {
|
||||||
|
res.MineMax = in.Score
|
||||||
|
}
|
||||||
|
|
||||||
|
res.Mine = &ranking.RankingList{
|
||||||
|
Nickname: mineUser.Nickname,
|
||||||
|
Avatar: mineUser.Avatar,
|
||||||
|
Score: in.Score,
|
||||||
|
Self: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
return res, nil
|
||||||
|
}
|
@ -48,7 +48,12 @@ func (s *RankingServiceServer) RemoveRanking(ctx context.Context, in *ranking.Re
|
|||||||
return l.RemoveRanking(in)
|
return l.RemoveRanking(in)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *RankingServiceServer) AtomicGetHigherUser(ctx context.Context, in *ranking.AtomicGetHigherUserRequest) (*ranking.GetRankingListResponse, error) {
|
func (s *RankingServiceServer) AtomicGetHigherUser(ctx context.Context, in *ranking.AtomicGetHigherUserRequest) (*ranking.RankingList, error) {
|
||||||
l := logic.NewAtomicGetHigherUserLogic(ctx, s.svcCtx)
|
l := logic.NewAtomicGetHigherUserLogic(ctx, s.svcCtx)
|
||||||
return l.AtomicGetHigherUser(in)
|
return l.AtomicGetHigherUser(in)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *RankingServiceServer) Settlement(ctx context.Context, in *ranking.AtomicGetHigherUserRequest) (*ranking.SettlementResponse, error) {
|
||||||
|
l := logic.NewSettlementLogic(ctx, s.svcCtx)
|
||||||
|
return l.Settlement(in)
|
||||||
|
}
|
||||||
|
@ -608,6 +608,66 @@ func (x *AtomicGetHigherUserRequest) GetUserId() uint64 {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type SettlementResponse struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
Higher *RankingList `protobuf:"bytes,1,opt,name=higher,proto3" json:"higher,omitempty"`
|
||||||
|
MineMax uint32 `protobuf:"varint,2,opt,name=mineMax,proto3" json:"mineMax,omitempty"`
|
||||||
|
Mine *RankingList `protobuf:"bytes,3,opt,name=mine,proto3" json:"mine,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *SettlementResponse) Reset() {
|
||||||
|
*x = SettlementResponse{}
|
||||||
|
mi := &file_ranking_service_proto_msgTypes[10]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *SettlementResponse) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*SettlementResponse) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *SettlementResponse) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_ranking_service_proto_msgTypes[10]
|
||||||
|
if x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use SettlementResponse.ProtoReflect.Descriptor instead.
|
||||||
|
func (*SettlementResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return file_ranking_service_proto_rawDescGZIP(), []int{10}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *SettlementResponse) GetHigher() *RankingList {
|
||||||
|
if x != nil {
|
||||||
|
return x.Higher
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *SettlementResponse) GetMineMax() uint32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.MineMax
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *SettlementResponse) GetMine() *RankingList {
|
||||||
|
if x != nil {
|
||||||
|
return x.Mine
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
var File_ranking_service_proto protoreflect.FileDescriptor
|
var File_ranking_service_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_ranking_service_proto_rawDesc = string([]byte{
|
var file_ranking_service_proto_rawDesc = string([]byte{
|
||||||
@ -668,43 +728,58 @@ var file_ranking_service_proto_rawDesc = string([]byte{
|
|||||||
0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x73, 0x63,
|
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,
|
0x6f, 0x72, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28,
|
||||||
0x0d, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49,
|
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,
|
0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22,
|
||||||
0xa9, 0x04, 0x0a, 0x0f, 0x72, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x65, 0x72, 0x76,
|
0x96, 0x01, 0x0a, 0x12, 0x53, 0x65, 0x74, 0x74, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65,
|
||||||
0x69, 0x63, 0x65, 0x12, 0x3b, 0x0a, 0x04, 0x50, 0x69, 0x6e, 0x67, 0x12, 0x18, 0x2e, 0x72, 0x61,
|
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x34, 0x0a, 0x06, 0x68, 0x69, 0x67, 0x68, 0x65, 0x72,
|
||||||
0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x52, 0x65,
|
0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x72, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67,
|
||||||
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x72, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x5f,
|
0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x52, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67,
|
||||||
0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
0x4c, 0x69, 0x73, 0x74, 0x52, 0x06, 0x68, 0x69, 0x67, 0x68, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07,
|
||||||
0x12, 0x59, 0x0a, 0x10, 0x53, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x47, 0x61, 0x6d, 0x65, 0x53,
|
0x6d, 0x69, 0x6e, 0x65, 0x4d, 0x61, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x6d,
|
||||||
0x63, 0x6f, 0x72, 0x65, 0x12, 0x28, 0x2e, 0x72, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x73,
|
0x69, 0x6e, 0x65, 0x4d, 0x61, 0x78, 0x12, 0x30, 0x0a, 0x04, 0x6d, 0x69, 0x6e, 0x65, 0x18, 0x03,
|
||||||
0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x47, 0x61,
|
0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x72, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x73,
|
||||||
0x6d, 0x65, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b,
|
0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x52, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x4c, 0x69,
|
||||||
|
0x73, 0x74, 0x52, 0x04, 0x6d, 0x69, 0x6e, 0x65, 0x32, 0xfe, 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, 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,
|
0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x59, 0x0a, 0x10, 0x53, 0x65, 0x74,
|
||||||
0x65, 0x74, 0x52, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x26, 0x2e,
|
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,
|
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,
|
0x53, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x47, 0x61, 0x6d, 0x65, 0x53, 0x63, 0x6f, 0x72, 0x65,
|
||||||
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x72, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x5f,
|
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x72, 0x61, 0x6e, 0x6b, 0x69, 0x6e,
|
||||||
0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x6b, 0x69,
|
0x67, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x52, 0x65,
|
||||||
0x6e, 0x67, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x59,
|
0x73, 0x75, 0x6c, 0x74, 0x12, 0x61, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x6b, 0x69,
|
||||||
0x0a, 0x10, 0x41, 0x64, 0x64, 0x55, 0x73, 0x65, 0x72, 0x47, 0x61, 0x6d, 0x65, 0x53, 0x63, 0x6f,
|
0x6e, 0x67, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x26, 0x2e, 0x72, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67,
|
||||||
0x72, 0x65, 0x12, 0x28, 0x2e, 0x72, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x65, 0x72,
|
0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x6b,
|
||||||
0x76, 0x69, 0x63, 0x65, 0x2e, 0x41, 0x64, 0x64, 0x55, 0x73, 0x65, 0x72, 0x47, 0x61, 0x6d, 0x65,
|
0x69, 0x6e, 0x67, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27,
|
||||||
0x53, 0x63, 0x6f, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x72,
|
0x2e, 0x72, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
|
||||||
0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x42,
|
0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x4c, 0x69, 0x73, 0x74, 0x52,
|
||||||
0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x53, 0x0a, 0x0d, 0x52, 0x65, 0x6d,
|
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x59, 0x0a, 0x10, 0x41, 0x64, 0x64, 0x55, 0x73,
|
||||||
0x6f, 0x76, 0x65, 0x52, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x12, 0x25, 0x2e, 0x72, 0x61, 0x6e,
|
0x65, 0x72, 0x47, 0x61, 0x6d, 0x65, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x12, 0x28, 0x2e, 0x72, 0x61,
|
||||||
0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x52, 0x65, 0x6d,
|
0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x41, 0x64,
|
||||||
0x6f, 0x76, 0x65, 0x52, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
0x64, 0x55, 0x73, 0x65, 0x72, 0x47, 0x61, 0x6d, 0x65, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x52, 0x65,
|
||||||
0x74, 0x1a, 0x1b, 0x2e, 0x72, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x65, 0x72, 0x76,
|
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x72, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x5f,
|
||||||
0x69, 0x63, 0x65, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x6b,
|
0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x42, 0x61, 0x73, 0x65, 0x52, 0x65, 0x73, 0x75,
|
||||||
0x0a, 0x13, 0x41, 0x74, 0x6f, 0x6d, 0x69, 0x63, 0x47, 0x65, 0x74, 0x48, 0x69, 0x67, 0x68, 0x65,
|
0x6c, 0x74, 0x12, 0x53, 0x0a, 0x0d, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x52, 0x61, 0x6e, 0x6b,
|
||||||
0x72, 0x55, 0x73, 0x65, 0x72, 0x12, 0x2b, 0x2e, 0x72, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x5f,
|
0x69, 0x6e, 0x67, 0x12, 0x25, 0x2e, 0x72, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x65,
|
||||||
0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x41, 0x74, 0x6f, 0x6d, 0x69, 0x63, 0x47, 0x65,
|
0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x52, 0x61, 0x6e, 0x6b,
|
||||||
0x74, 0x48, 0x69, 0x67, 0x68, 0x65, 0x72, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65,
|
0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x72, 0x61, 0x6e,
|
||||||
0x73, 0x74, 0x1a, 0x27, 0x2e, 0x72, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x65, 0x72,
|
0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x42, 0x61, 0x73,
|
||||||
0x76, 0x69, 0x63, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x4c,
|
0x65, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x60, 0x0a, 0x13, 0x41, 0x74, 0x6f, 0x6d, 0x69,
|
||||||
0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x0b, 0x5a, 0x09, 0x2e,
|
0x63, 0x47, 0x65, 0x74, 0x48, 0x69, 0x67, 0x68, 0x65, 0x72, 0x55, 0x73, 0x65, 0x72, 0x12, 0x2b,
|
||||||
0x2f, 0x72, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
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, 0x12, 0x5e, 0x0a, 0x0a, 0x53, 0x65, 0x74,
|
||||||
|
0x74, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 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, 0x23, 0x2e, 0x72, 0x61, 0x6e, 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x73,
|
||||||
|
0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x53, 0x65, 0x74, 0x74, 0x6c, 0x65, 0x6d, 0x65, 0x6e,
|
||||||
|
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 (
|
var (
|
||||||
@ -719,7 +794,7 @@ func file_ranking_service_proto_rawDescGZIP() []byte {
|
|||||||
return file_ranking_service_proto_rawDescData
|
return file_ranking_service_proto_rawDescData
|
||||||
}
|
}
|
||||||
|
|
||||||
var file_ranking_service_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
|
var file_ranking_service_proto_msgTypes = make([]protoimpl.MessageInfo, 11)
|
||||||
var file_ranking_service_proto_goTypes = []any{
|
var file_ranking_service_proto_goTypes = []any{
|
||||||
(*Request)(nil), // 0: ranking_service.Request
|
(*Request)(nil), // 0: ranking_service.Request
|
||||||
(*Response)(nil), // 1: ranking_service.Response
|
(*Response)(nil), // 1: ranking_service.Response
|
||||||
@ -731,26 +806,31 @@ var file_ranking_service_proto_goTypes = []any{
|
|||||||
(*AddUserGameScoreRequest)(nil), // 7: ranking_service.AddUserGameScoreRequest
|
(*AddUserGameScoreRequest)(nil), // 7: ranking_service.AddUserGameScoreRequest
|
||||||
(*RemoveRankingRequest)(nil), // 8: ranking_service.RemoveRankingRequest
|
(*RemoveRankingRequest)(nil), // 8: ranking_service.RemoveRankingRequest
|
||||||
(*AtomicGetHigherUserRequest)(nil), // 9: ranking_service.AtomicGetHigherUserRequest
|
(*AtomicGetHigherUserRequest)(nil), // 9: ranking_service.AtomicGetHigherUserRequest
|
||||||
|
(*SettlementResponse)(nil), // 10: ranking_service.SettlementResponse
|
||||||
}
|
}
|
||||||
var file_ranking_service_proto_depIdxs = []int32{
|
var file_ranking_service_proto_depIdxs = []int32{
|
||||||
3, // 0: ranking_service.GetRankingListResponse.rankingData:type_name -> ranking_service.RankingList
|
3, // 0: ranking_service.GetRankingListResponse.rankingData:type_name -> ranking_service.RankingList
|
||||||
0, // 1: ranking_service.ranking_service.Ping:input_type -> ranking_service.Request
|
3, // 1: ranking_service.SettlementResponse.higher:type_name -> ranking_service.RankingList
|
||||||
2, // 2: ranking_service.ranking_service.SetUserGameScore:input_type -> ranking_service.SetUserGameScoreRequest
|
3, // 2: ranking_service.SettlementResponse.mine:type_name -> ranking_service.RankingList
|
||||||
5, // 3: ranking_service.ranking_service.GetRankingList:input_type -> ranking_service.GetRankingListRequest
|
0, // 3: ranking_service.ranking_service.Ping:input_type -> ranking_service.Request
|
||||||
7, // 4: ranking_service.ranking_service.AddUserGameScore:input_type -> ranking_service.AddUserGameScoreRequest
|
2, // 4: ranking_service.ranking_service.SetUserGameScore:input_type -> ranking_service.SetUserGameScoreRequest
|
||||||
8, // 5: ranking_service.ranking_service.RemoveRanking:input_type -> ranking_service.RemoveRankingRequest
|
5, // 5: ranking_service.ranking_service.GetRankingList:input_type -> ranking_service.GetRankingListRequest
|
||||||
9, // 6: ranking_service.ranking_service.AtomicGetHigherUser:input_type -> ranking_service.AtomicGetHigherUserRequest
|
7, // 6: ranking_service.ranking_service.AddUserGameScore:input_type -> ranking_service.AddUserGameScoreRequest
|
||||||
1, // 7: ranking_service.ranking_service.Ping:output_type -> ranking_service.Response
|
8, // 7: ranking_service.ranking_service.RemoveRanking:input_type -> ranking_service.RemoveRankingRequest
|
||||||
6, // 8: ranking_service.ranking_service.SetUserGameScore:output_type -> ranking_service.BaseResult
|
9, // 8: ranking_service.ranking_service.AtomicGetHigherUser:input_type -> ranking_service.AtomicGetHigherUserRequest
|
||||||
4, // 9: ranking_service.ranking_service.GetRankingList:output_type -> ranking_service.GetRankingListResponse
|
9, // 9: ranking_service.ranking_service.Settlement:input_type -> ranking_service.AtomicGetHigherUserRequest
|
||||||
6, // 10: ranking_service.ranking_service.AddUserGameScore:output_type -> ranking_service.BaseResult
|
1, // 10: ranking_service.ranking_service.Ping:output_type -> ranking_service.Response
|
||||||
6, // 11: ranking_service.ranking_service.RemoveRanking:output_type -> ranking_service.BaseResult
|
6, // 11: ranking_service.ranking_service.SetUserGameScore:output_type -> ranking_service.BaseResult
|
||||||
4, // 12: ranking_service.ranking_service.AtomicGetHigherUser:output_type -> ranking_service.GetRankingListResponse
|
4, // 12: ranking_service.ranking_service.GetRankingList:output_type -> ranking_service.GetRankingListResponse
|
||||||
7, // [7:13] is the sub-list for method output_type
|
6, // 13: ranking_service.ranking_service.AddUserGameScore:output_type -> ranking_service.BaseResult
|
||||||
1, // [1:7] is the sub-list for method input_type
|
6, // 14: ranking_service.ranking_service.RemoveRanking:output_type -> ranking_service.BaseResult
|
||||||
1, // [1:1] is the sub-list for extension type_name
|
3, // 15: ranking_service.ranking_service.AtomicGetHigherUser:output_type -> ranking_service.RankingList
|
||||||
1, // [1:1] is the sub-list for extension extendee
|
10, // 16: ranking_service.ranking_service.Settlement:output_type -> ranking_service.SettlementResponse
|
||||||
0, // [0:1] is the sub-list for field type_name
|
10, // [10:17] is the sub-list for method output_type
|
||||||
|
3, // [3:10] is the sub-list for method input_type
|
||||||
|
3, // [3:3] is the sub-list for extension type_name
|
||||||
|
3, // [3:3] is the sub-list for extension extendee
|
||||||
|
0, // [0:3] is the sub-list for field type_name
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { file_ranking_service_proto_init() }
|
func init() { file_ranking_service_proto_init() }
|
||||||
@ -764,7 +844,7 @@ func file_ranking_service_proto_init() {
|
|||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_ranking_service_proto_rawDesc), len(file_ranking_service_proto_rawDesc)),
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_ranking_service_proto_rawDesc), len(file_ranking_service_proto_rawDesc)),
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 10,
|
NumMessages: 11,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
NumServices: 1,
|
NumServices: 1,
|
||||||
},
|
},
|
||||||
|
@ -25,6 +25,7 @@ const (
|
|||||||
RankingService_AddUserGameScore_FullMethodName = "/ranking_service.ranking_service/AddUserGameScore"
|
RankingService_AddUserGameScore_FullMethodName = "/ranking_service.ranking_service/AddUserGameScore"
|
||||||
RankingService_RemoveRanking_FullMethodName = "/ranking_service.ranking_service/RemoveRanking"
|
RankingService_RemoveRanking_FullMethodName = "/ranking_service.ranking_service/RemoveRanking"
|
||||||
RankingService_AtomicGetHigherUser_FullMethodName = "/ranking_service.ranking_service/AtomicGetHigherUser"
|
RankingService_AtomicGetHigherUser_FullMethodName = "/ranking_service.ranking_service/AtomicGetHigherUser"
|
||||||
|
RankingService_Settlement_FullMethodName = "/ranking_service.ranking_service/Settlement"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RankingServiceClient is the client API for RankingService service.
|
// RankingServiceClient is the client API for RankingService service.
|
||||||
@ -36,7 +37,8 @@ type RankingServiceClient interface {
|
|||||||
GetRankingList(ctx context.Context, in *GetRankingListRequest, opts ...grpc.CallOption) (*GetRankingListResponse, error)
|
GetRankingList(ctx context.Context, in *GetRankingListRequest, opts ...grpc.CallOption) (*GetRankingListResponse, error)
|
||||||
AddUserGameScore(ctx context.Context, in *AddUserGameScoreRequest, opts ...grpc.CallOption) (*BaseResult, error)
|
AddUserGameScore(ctx context.Context, in *AddUserGameScoreRequest, opts ...grpc.CallOption) (*BaseResult, error)
|
||||||
RemoveRanking(ctx context.Context, in *RemoveRankingRequest, 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) (*GetRankingListResponse, error)
|
AtomicGetHigherUser(ctx context.Context, in *AtomicGetHigherUserRequest, opts ...grpc.CallOption) (*RankingList, error)
|
||||||
|
Settlement(ctx context.Context, in *AtomicGetHigherUserRequest, opts ...grpc.CallOption) (*SettlementResponse, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type rankingServiceClient struct {
|
type rankingServiceClient struct {
|
||||||
@ -97,9 +99,9 @@ func (c *rankingServiceClient) RemoveRanking(ctx context.Context, in *RemoveRank
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *rankingServiceClient) AtomicGetHigherUser(ctx context.Context, in *AtomicGetHigherUserRequest, opts ...grpc.CallOption) (*GetRankingListResponse, error) {
|
func (c *rankingServiceClient) AtomicGetHigherUser(ctx context.Context, in *AtomicGetHigherUserRequest, opts ...grpc.CallOption) (*RankingList, error) {
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
out := new(GetRankingListResponse)
|
out := new(RankingList)
|
||||||
err := c.cc.Invoke(ctx, RankingService_AtomicGetHigherUser_FullMethodName, in, out, cOpts...)
|
err := c.cc.Invoke(ctx, RankingService_AtomicGetHigherUser_FullMethodName, in, out, cOpts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -107,6 +109,16 @@ func (c *rankingServiceClient) AtomicGetHigherUser(ctx context.Context, in *Atom
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *rankingServiceClient) Settlement(ctx context.Context, in *AtomicGetHigherUserRequest, opts ...grpc.CallOption) (*SettlementResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(SettlementResponse)
|
||||||
|
err := c.cc.Invoke(ctx, RankingService_Settlement_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
// RankingServiceServer is the server API for RankingService service.
|
// RankingServiceServer is the server API for RankingService service.
|
||||||
// All implementations must embed UnimplementedRankingServiceServer
|
// All implementations must embed UnimplementedRankingServiceServer
|
||||||
// for forward compatibility.
|
// for forward compatibility.
|
||||||
@ -116,7 +128,8 @@ type RankingServiceServer interface {
|
|||||||
GetRankingList(context.Context, *GetRankingListRequest) (*GetRankingListResponse, error)
|
GetRankingList(context.Context, *GetRankingListRequest) (*GetRankingListResponse, error)
|
||||||
AddUserGameScore(context.Context, *AddUserGameScoreRequest) (*BaseResult, error)
|
AddUserGameScore(context.Context, *AddUserGameScoreRequest) (*BaseResult, error)
|
||||||
RemoveRanking(context.Context, *RemoveRankingRequest) (*BaseResult, error)
|
RemoveRanking(context.Context, *RemoveRankingRequest) (*BaseResult, error)
|
||||||
AtomicGetHigherUser(context.Context, *AtomicGetHigherUserRequest) (*GetRankingListResponse, error)
|
AtomicGetHigherUser(context.Context, *AtomicGetHigherUserRequest) (*RankingList, error)
|
||||||
|
Settlement(context.Context, *AtomicGetHigherUserRequest) (*SettlementResponse, error)
|
||||||
mustEmbedUnimplementedRankingServiceServer()
|
mustEmbedUnimplementedRankingServiceServer()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,9 +155,12 @@ func (UnimplementedRankingServiceServer) AddUserGameScore(context.Context, *AddU
|
|||||||
func (UnimplementedRankingServiceServer) RemoveRanking(context.Context, *RemoveRankingRequest) (*BaseResult, error) {
|
func (UnimplementedRankingServiceServer) RemoveRanking(context.Context, *RemoveRankingRequest) (*BaseResult, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method RemoveRanking not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method RemoveRanking not implemented")
|
||||||
}
|
}
|
||||||
func (UnimplementedRankingServiceServer) AtomicGetHigherUser(context.Context, *AtomicGetHigherUserRequest) (*GetRankingListResponse, error) {
|
func (UnimplementedRankingServiceServer) AtomicGetHigherUser(context.Context, *AtomicGetHigherUserRequest) (*RankingList, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method AtomicGetHigherUser not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method AtomicGetHigherUser not implemented")
|
||||||
}
|
}
|
||||||
|
func (UnimplementedRankingServiceServer) Settlement(context.Context, *AtomicGetHigherUserRequest) (*SettlementResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method Settlement not implemented")
|
||||||
|
}
|
||||||
func (UnimplementedRankingServiceServer) mustEmbedUnimplementedRankingServiceServer() {}
|
func (UnimplementedRankingServiceServer) mustEmbedUnimplementedRankingServiceServer() {}
|
||||||
func (UnimplementedRankingServiceServer) testEmbeddedByValue() {}
|
func (UnimplementedRankingServiceServer) testEmbeddedByValue() {}
|
||||||
|
|
||||||
@ -274,6 +290,24 @@ func _RankingService_AtomicGetHigherUser_Handler(srv interface{}, ctx context.Co
|
|||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func _RankingService_Settlement_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(AtomicGetHigherUserRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(RankingServiceServer).Settlement(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: RankingService_Settlement_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(RankingServiceServer).Settlement(ctx, req.(*AtomicGetHigherUserRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
// RankingService_ServiceDesc is the grpc.ServiceDesc for RankingService service.
|
// RankingService_ServiceDesc is the grpc.ServiceDesc for RankingService service.
|
||||||
// It's only intended for direct use with grpc.RegisterService,
|
// It's only intended for direct use with grpc.RegisterService,
|
||||||
// and not to be introspected or modified (even as a copy)
|
// and not to be introspected or modified (even as a copy)
|
||||||
@ -305,6 +339,10 @@ var RankingService_ServiceDesc = grpc.ServiceDesc{
|
|||||||
MethodName: "AtomicGetHigherUser",
|
MethodName: "AtomicGetHigherUser",
|
||||||
Handler: _RankingService_AtomicGetHigherUser_Handler,
|
Handler: _RankingService_AtomicGetHigherUser_Handler,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
MethodName: "Settlement",
|
||||||
|
Handler: _RankingService_Settlement_Handler,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Streams: []grpc.StreamDesc{},
|
Streams: []grpc.StreamDesc{},
|
||||||
Metadata: "ranking_service.proto",
|
Metadata: "ranking_service.proto",
|
||||||
|
@ -64,6 +64,13 @@ message AtomicGetHigherUserRequest{
|
|||||||
uint64 userId = 4;
|
uint64 userId = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message SettlementResponse{
|
||||||
|
RankingList higher = 1;
|
||||||
|
uint32 mineMax = 2;
|
||||||
|
RankingList mine = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
service ranking_service {
|
service ranking_service {
|
||||||
rpc Ping(Request) returns(Response);
|
rpc Ping(Request) returns(Response);
|
||||||
@ -76,5 +83,7 @@ service ranking_service {
|
|||||||
|
|
||||||
rpc RemoveRanking(RemoveRankingRequest) returns(BaseResult);
|
rpc RemoveRanking(RemoveRankingRequest) returns(BaseResult);
|
||||||
|
|
||||||
rpc AtomicGetHigherUser(AtomicGetHigherUserRequest) returns(GetRankingListResponse);
|
rpc AtomicGetHigherUser(AtomicGetHigherUserRequest) returns(RankingList);
|
||||||
|
|
||||||
|
rpc Settlement(AtomicGetHigherUserRequest) returns(SettlementResponse);
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ type (
|
|||||||
Request = ranking.Request
|
Request = ranking.Request
|
||||||
Response = ranking.Response
|
Response = ranking.Response
|
||||||
SetUserGameScoreRequest = ranking.SetUserGameScoreRequest
|
SetUserGameScoreRequest = ranking.SetUserGameScoreRequest
|
||||||
|
SettlementResponse = ranking.SettlementResponse
|
||||||
|
|
||||||
RankingService interface {
|
RankingService interface {
|
||||||
Ping(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
|
Ping(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
|
||||||
@ -31,7 +32,8 @@ type (
|
|||||||
GetRankingList(ctx context.Context, in *GetRankingListRequest, opts ...grpc.CallOption) (*GetRankingListResponse, error)
|
GetRankingList(ctx context.Context, in *GetRankingListRequest, opts ...grpc.CallOption) (*GetRankingListResponse, error)
|
||||||
AddUserGameScore(ctx context.Context, in *AddUserGameScoreRequest, opts ...grpc.CallOption) (*BaseResult, error)
|
AddUserGameScore(ctx context.Context, in *AddUserGameScoreRequest, opts ...grpc.CallOption) (*BaseResult, error)
|
||||||
RemoveRanking(ctx context.Context, in *RemoveRankingRequest, 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) (*GetRankingListResponse, error)
|
AtomicGetHigherUser(ctx context.Context, in *AtomicGetHigherUserRequest, opts ...grpc.CallOption) (*RankingList, error)
|
||||||
|
Settlement(ctx context.Context, in *AtomicGetHigherUserRequest, opts ...grpc.CallOption) (*SettlementResponse, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultRankingService struct {
|
defaultRankingService struct {
|
||||||
@ -70,7 +72,12 @@ func (m *defaultRankingService) RemoveRanking(ctx context.Context, in *RemoveRan
|
|||||||
return client.RemoveRanking(ctx, in, opts...)
|
return client.RemoveRanking(ctx, in, opts...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *defaultRankingService) AtomicGetHigherUser(ctx context.Context, in *AtomicGetHigherUserRequest, opts ...grpc.CallOption) (*GetRankingListResponse, error) {
|
func (m *defaultRankingService) AtomicGetHigherUser(ctx context.Context, in *AtomicGetHigherUserRequest, opts ...grpc.CallOption) (*RankingList, error) {
|
||||||
client := ranking.NewRankingServiceClient(m.cli.Conn())
|
client := ranking.NewRankingServiceClient(m.cli.Conn())
|
||||||
return client.AtomicGetHigherUser(ctx, in, opts...)
|
return client.AtomicGetHigherUser(ctx, in, opts...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *defaultRankingService) Settlement(ctx context.Context, in *AtomicGetHigherUserRequest, opts ...grpc.CallOption) (*SettlementResponse, error) {
|
||||||
|
client := ranking.NewRankingServiceClient(m.cli.Conn())
|
||||||
|
return client.Settlement(ctx, in, opts...)
|
||||||
|
}
|
||||||
|
27
etc/prod/else/app.json
Normal file
27
etc/prod/else/app.json
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"appId": "tt8b32fd8f14071db707",
|
||||||
|
"appSecret": "44018e80b1bde34395a52de67ce1e0c37c572d80",
|
||||||
|
"type": "douyin"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"appId": "wxd41b41895a9410ea",
|
||||||
|
"appSecret": "1adc1cdb2a7ab7b166dd68ed89423c4e",
|
||||||
|
"type": "wechat"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"appId": "tt5bc32d7ec4f6ccb907",
|
||||||
|
"appSecret": "da04822d0989831c6fd6e68ee847fa341bf6a23d",
|
||||||
|
"type": "douyin"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"appId": "wxe8bf4985263c7e8b",
|
||||||
|
"appSecret": "e37f2806dac08ffc2c35906836340a3f",
|
||||||
|
"type": "wechat"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"appId": "ttb80fceb2273b8d3202",
|
||||||
|
"appSecret": "9a041421dc6bc50947605d5f0fa6ebd319e0b24a",
|
||||||
|
"type": "douyin"
|
||||||
|
}
|
||||||
|
]
|
Loading…
x
Reference in New Issue
Block a user