topfans/backend/proto/starbook.proto
2026-04-20 18:26:13 +08:00

101 lines
2.8 KiB
Protocol Buffer
Raw Permalink 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.starbook;
option go_package = "github.com/topfans/backend/pkg/proto/starbook;starbook";
import "proto/common.proto";
import "google/api/annotations.proto";
// 星册服务 - 典藏/活动藏品体系重构
service StarbookService {
// 星册首页
rpc GetStarbookHome(GetStarbookHomeRequest) returns (GetStarbookHomeResponse) {
option (google.api.http) = {
get: "/api/v1/starbook/home"
};
}
// 藏品列表(分页)
rpc GetStarbookItems(GetStarbookItemsRequest) returns (GetStarbookItemsResponse) {
option (google.api.http) = {
get: "/api/v1/starbook/items"
};
}
}
// ==================== 星册首页 ====================
// 星册首页请求
message GetStarbookHomeRequest {
}
// 星册首页响应
message GetStarbookHomeResponse {
topfans.common.BaseResponse base = 1;
StarbookHomeData data = 2;
}
// 星册首页数据
message StarbookHomeData {
repeated AssetGroup groups = 1;
}
// 资产分组
message AssetGroup {
string type = 1; // 'regular' / 'collection' / 'activity'
string category = 2; // 'castlove'(regular) / collection_category / activity_type
string category_name = 3;
// regular 使用 grades 分组collection/activity 使用 flat items 列表
repeated GradeSection grades = 4; // 仅 regular 时有效
repeated AssetItem items = 5; // collection / activity 时有效
int32 total_count = 6;
bool has_more = 7;
}
// 等级分组(仅 regular 类型使用)
message GradeSection {
int32 grade = 1; // 等级1/2/3/4/5...
repeated AssetItem items = 2;
int32 total_count = 3;
bool has_more = 4;
}
// 资产项
message AssetItem {
int64 asset_id = 1;
string name = 2;
string cover_url_signed = 3; // 预签名封面URL
int32 like_count = 4;
int64 created_at = 5;
string category = 6; // regular: 'castlove' / collection: category / activity: activity_type
int32 grade = 7; // 仅 regular 时有效1/2/3...),其他类型为 0
int32 display_status = 8; // 展示状态0=待展示, 1=已展示
}
// ==================== 藏品列表(分页) ====================
// 藏品列表请求
message GetStarbookItemsRequest {
string type = 1; // 'regular' / 'collection' / 'activity'
string category = 2; // regular 时固定传 'castlove'
int32 grade = 3; // 仅 regular 时有效1/2/3...
int32 page = 4; // 默认 1
int32 page_size = 5; // 默认 20
}
// 藏品列表响应
message GetStarbookItemsResponse {
topfans.common.BaseResponse base = 1;
AssetListData data = 2;
}
// 藏品列表数据
message AssetListData {
repeated AssetItem items = 1;
int64 total = 2;
int32 page = 3;
int32 page_size = 4;
bool has_more = 5;
}