topfans/backend/proto/ranking.proto
2026-04-07 22:29:48 +08:00

74 lines
2.4 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 topfans.ranking;
option go_package = "github.com/topfans/backend/pkg/proto/ranking;ranking";
import "proto/common.proto";
import "google/api/annotations.proto";
// ==================== 排行榜相关消息 ====================
// 排行榜请求(热度/自制)
message GetRankingRequest {
string dimension = 1; // 统计维度displaying(展示中), month(本月), total(全部)
int64 star_id = 2; // 粉丝身份ID可选不传则使用当前身份
int32 page = 3; // 页码默认1
int32 page_size = 4; // 每页数量默认10
int64 user_id = 5; // 当前用户ID
}
// 排行榜项
message RankingItem {
int32 rank = 1; // 排名
int64 asset_id = 2; // 藏品ID
string asset_name = 3; // 藏品名称
string cover_url = 4; // 封面图URL
int64 owner_uid = 5; // 持有者ID
string owner_nickname = 6; // 持有者昵称
string owner_avatar = 9; // 持有者头像
int32 like_count = 7; // 点赞数
bool is_original = 8; // 是否自制藏品
}
// 我的排名信息
message MyRanking {
int32 rank = 1; // 排名(上榜时返回)
int64 asset_id = 2; // 藏品ID
string asset_name = 3; // 藏品名称
string cover_url = 4; // 封面图URL
int32 like_count = 5; // 点赞数
string status = 6; // 状态ranked(上榜), unranked(未上榜)
int32 diff_to_rank = 7; // 距离上榜的差距(未上榜时返回)
string owner_nickname = 8; // 持有者昵称
string owner_avatar = 9; // 持有者头像
}
// 排行榜响应
message GetRankingResponse {
topfans.common.BaseResponse base = 1;
MyRanking my_ranking = 2; // 我的排名
repeated RankingItem items = 3; // 排行榜列表
int32 page = 4; // 当前页码
int32 page_size = 5; // 每页数量
int32 total = 6; // 总数
}
// ==================== 排行榜服务 ====================
service RankingService {
// 获取热度排行榜
rpc GetHotRanking(GetRankingRequest) returns (GetRankingResponse) {
option (google.api.http) = {
get: "/api/v1/rankings/hot"
};
}
// 获取自制排行榜
rpc GetOriginalRanking(GetRankingRequest) returns (GetRankingResponse) {
option (google.api.http) = {
get: "/api/v1/rankings/original"
};
}
}