184 lines
4.6 KiB
Protocol Buffer
184 lines
4.6 KiB
Protocol Buffer
syntax = "proto3";
|
||
|
||
package topfans.activity;
|
||
|
||
option go_package = "github.com/topfans/backend/pkg/proto/activity;activity";
|
||
|
||
import "proto/common.proto";
|
||
import "google/api/annotations.proto";
|
||
|
||
// ==================== 活动相关消息 ====================
|
||
|
||
// 活动信息
|
||
message Activity {
|
||
int64 id = 1;
|
||
string activity_type = 2;
|
||
string title = 3;
|
||
string theme = 17; // 中文主题
|
||
string description = 4;
|
||
int64 star_id = 5;
|
||
int64 start_time = 6;
|
||
int64 end_time = 7;
|
||
int64 target_progress = 8;
|
||
int64 current_progress = 9;
|
||
string status = 10;
|
||
string current_stage = 11; // 当前阶段: early/mid/late/completed
|
||
repeated ActivityItem items = 12;
|
||
string cover_image = 13; // 封面图
|
||
string banner_image = 14; // 横幅图
|
||
string current_stage_background = 15; // 当前阶段背景图
|
||
string current_stage_title = 16; // 当前阶段标题
|
||
}
|
||
|
||
// 活动道具
|
||
message ActivityItem {
|
||
int64 id = 1;
|
||
string item_type = 2;
|
||
string item_name = 3;
|
||
string icon_url = 4;
|
||
int32 crystal_cost = 5;
|
||
int32 contribution_points = 6;
|
||
}
|
||
|
||
// 活动道具列表响应
|
||
message ActivityItemsResponse {
|
||
repeated ActivityItem items = 1;
|
||
}
|
||
|
||
// 购买道具请求
|
||
message PurchaseItemRequest {
|
||
int64 activity_id = 1;
|
||
string item_type = 2;
|
||
int32 quantity = 3;
|
||
int64 star_id = 4;
|
||
int64 user_id = 5; // 当前用户ID
|
||
}
|
||
|
||
// 购买道具响应
|
||
message PurchaseItemResponse {
|
||
topfans.common.BaseResponse base = 1;
|
||
int64 total_crystal_spent = 2; // 本次消费水晶
|
||
int64 total_contribution = 3; // 本次获得贡献点
|
||
int64 current_progress = 4; // 当前活动进度
|
||
int64 remaining_balance = 5; // 剩余水晶余额
|
||
}
|
||
|
||
// 贡献点排名请求
|
||
message ContributionRankingRequest {
|
||
int64 activity_id = 1;
|
||
int64 star_id = 2;
|
||
int32 page = 3;
|
||
int32 page_size = 4;
|
||
int64 user_id = 5; // 当前用户ID,用于获取自己的排名
|
||
}
|
||
|
||
// 贡献点排名项
|
||
message ContributionRankingItem {
|
||
int32 rank = 1;
|
||
int64 user_id = 2;
|
||
string nickname = 3;
|
||
string avatar_url = 4;
|
||
int64 total_contribution = 5;
|
||
int64 total_crystal_spent = 6;
|
||
}
|
||
|
||
// 贡献点排名响应
|
||
message ContributionRankingResponse {
|
||
topfans.common.BaseResponse base = 1;
|
||
repeated ContributionRankingItem items = 2;
|
||
MyContribution my_contribution = 3;
|
||
int32 page = 4;
|
||
int32 page_size = 5;
|
||
int32 total = 6;
|
||
}
|
||
|
||
// 我的贡献信息
|
||
message MyContribution {
|
||
int32 rank = 1;
|
||
int64 total_contribution = 2;
|
||
int64 total_crystal_spent = 3;
|
||
string status = 4; // ranked/unranked
|
||
string nickname = 5;
|
||
string avatar_url = 6;
|
||
}
|
||
|
||
// 活动列表请求
|
||
message GetActivityListRequest {
|
||
int64 star_id = 1;
|
||
string status = 2; // 可选: pending/active/completed/expired
|
||
int32 page = 3;
|
||
int32 page_size = 4;
|
||
}
|
||
|
||
// 活动列表响应
|
||
message GetActivityListResponse {
|
||
topfans.common.BaseResponse base = 1;
|
||
repeated Activity activities = 2;
|
||
int32 page = 3;
|
||
int32 page_size = 4;
|
||
int32 total = 5;
|
||
}
|
||
|
||
// 进度信息请求
|
||
message GetProgressRequest {
|
||
int64 activity_id = 1;
|
||
}
|
||
|
||
// 进度信息响应
|
||
message GetProgressResponse {
|
||
topfans.common.BaseResponse base = 1;
|
||
int64 activity_id = 2;
|
||
int64 current_progress = 3;
|
||
int64 target_progress = 4;
|
||
string current_stage = 5; // early/mid/late/completed
|
||
int64 end_time = 6;
|
||
string status = 7; // pending/active/completed/expired
|
||
}
|
||
|
||
// ==================== 活动服务 ====================
|
||
|
||
service ActivityService {
|
||
// 获取活动列表
|
||
rpc GetActivityList(GetActivityListRequest) returns (GetActivityListResponse) {
|
||
option (google.api.http) = {
|
||
get: "/api/v1/activities"
|
||
};
|
||
}
|
||
|
||
// 获取活动详情
|
||
rpc GetActivity(GetProgressRequest) returns (Activity) {
|
||
option (google.api.http) = {
|
||
get: "/api/v1/activities/{activity_id}"
|
||
};
|
||
}
|
||
|
||
// 获取活动道具列表
|
||
rpc GetActivityItems(GetProgressRequest) returns (ActivityItemsResponse) {
|
||
option (google.api.http) = {
|
||
get: "/api/v1/activities/{activity_id}/items"
|
||
};
|
||
}
|
||
|
||
// 获取活动进度
|
||
rpc GetProgress(GetProgressRequest) returns (GetProgressResponse) {
|
||
option (google.api.http) = {
|
||
get: "/api/v1/activities/{activity_id}/progress"
|
||
};
|
||
}
|
||
|
||
// 购买道具
|
||
rpc PurchaseItem(PurchaseItemRequest) returns (PurchaseItemResponse) {
|
||
option (google.api.http) = {
|
||
post: "/api/v1/activities/{activity_id}/purchase"
|
||
body: "*"
|
||
};
|
||
}
|
||
|
||
// 获取贡献点排名
|
||
rpc GetContributionRanking(ContributionRankingRequest) returns (ContributionRankingResponse) {
|
||
option (google.api.http) = {
|
||
get: "/api/v1/activities/{activity_id}/ranking"
|
||
};
|
||
}
|
||
}
|