youtu_grpc/app/ranking_management/ranking_management.proto

55 lines
1.3 KiB
Protocol Buffer
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

syntax = "proto3";
package ranking_management;
option go_package = "./ranking_management";
message Request {
string ping = 1;
}
message Response {
string pong = 1;
}
// 定义SetUserGameScoreRequest消息类型
message SetUserGameScoreRequest {
uint32 score = 1; // 对应json的"score"
uint32 type = 2; // 对应json的"type", 带默认值0
uint64 userId = 3; // 用户id
uint32 appId = 4; // 小程序id
}
// 定义RankingData消息类型
message RankingList {
string nickname = 1; // 昵称对应db:"nickname"
string avatar = 2; // 头像对应db:"avatar"
uint32 score = 3; // 得分对应db:"score"
uint64 user_id = 4; // 用户ID对应db:"app_user_id"
uint32 rank = 5; // 排名对应db:"rank"
bool self = 6; // 是否自我判断
}
message GetRankingListResponse {
repeated RankingList rankingData = 1;
}
message GetRankingListRequest {
uint32 appId = 1;
uint32 type = 2;
uint64 userId = 3;
}
// 定义Base响应结构
message BaseResult {
int32 error_code = 1; // 错误码
string error_msg = 2; // 错误信息
}
service Ranking_management {
rpc Ping(Request) returns(Response);
rpc SetUserGameScore (SetUserGameScoreRequest) returns (BaseResult);
rpc GetRankingList (GetRankingListRequest) returns (GetRankingListResponse);
}