Files
sundynix-micro-be/app/radio/rpc/pb/radio.proto
T
2026-04-27 21:23:13 +08:00

398 lines
7.8 KiB
Protocol Buffer

syntax = "proto3";
package radio;
option go_package = "./radio";
// ========== 通用 ==========
message CommonResp {
int64 code = 1;
string msg = 2;
}
message IdReq {
string id = 1;
}
message IdsReq {
repeated string ids = 1;
}
// ========== 用户Profile ==========
message RadioUserProfile {
string id = 1;
string userId = 2;
string nickName = 3;
string avatarId = 4;
int32 isVip = 5;
int64 vipExpireAt = 6;
int32 vipLevel = 7;
}
message GetProfileReq {
string userId = 1;
}
// ========== 分类 ==========
message CategoryInfo {
string id = 1;
string name = 2;
string icon = 3;
int32 sort = 4;
}
message CategoryReq {
string name = 1;
string icon = 2;
int32 sort = 3;
}
message CategoryUpdateReq {
string id = 1;
string name = 2;
string icon = 3;
int32 sort = 4;
}
message CategoryListResp {
repeated CategoryInfo list = 1;
int64 total = 2;
}
message CategoryListReq {
int32 current = 1;
int32 pageSize = 2;
}
// ========== 频道 ==========
message ChannelInfo {
string id = 1;
string categoryId = 2;
string name = 3;
string description = 4;
int32 isFree = 5;
int32 isVipOnly = 6;
int32 monthlyPrice = 7;
int32 quarterlyPrice = 8;
int32 annualPrice = 9;
string cover = 10;
string tags = 11;
int32 sort = 12;
int32 status = 13;
}
message CreateChannelReq {
string categoryId = 1;
string name = 2;
string description = 3;
int32 isFree = 4;
int32 isVipOnly = 5;
int32 monthlyPrice = 6;
int32 quarterlyPrice = 7;
int32 annualPrice = 8;
string cover = 9;
string tags = 10;
int32 sort = 11;
}
message UpdateChannelReq {
string id = 1;
string categoryId = 2;
string name = 3;
string description = 4;
int32 isFree = 5;
int32 isVipOnly = 6;
int32 monthlyPrice = 7;
int32 quarterlyPrice = 8;
int32 annualPrice = 9;
string cover = 10;
string tags = 11;
int32 sort = 12;
int32 status = 13;
}
message ChannelListReq {
int32 current = 1;
int32 pageSize = 2;
string categoryId = 3;
string userId = 4;
}
message ChannelListResp {
repeated ChannelInfo list = 1;
int64 total = 2;
}
// ========== 节目 ==========
message ProgramInfo {
string id = 1;
string channelId = 2;
string title = 3;
string description = 4;
string content = 5;
string cover = 6;
string audioId = 7;
int32 audioStatus = 8;
int32 duration = 9;
string tags = 10;
int32 playCount = 11;
int32 likeCount = 12;
int32 status = 13;
}
message CreateProgramReq {
string channelId = 1;
string title = 2;
string description = 3;
string content = 4;
string cover = 5;
string tags = 6;
}
message UpdateProgramReq {
string id = 1;
string channelId = 2;
string title = 3;
string description = 4;
string content = 5;
string cover = 6;
string audioId = 7;
int32 audioStatus = 8;
int32 duration = 9;
string tags = 10;
int32 status = 11;
}
message ProgramListReq {
int32 current = 1;
int32 pageSize = 2;
string channelId = 3;
string userId = 4;
}
message ProgramListResp {
repeated ProgramInfo list = 1;
int64 total = 2;
}
// ========== 音色 ==========
message VoiceInfo {
string id = 1;
string speakerId = 2;
string name = 3;
string description = 4;
string gender = 5;
string icon = 6;
string audioId = 7;
int32 sort = 8;
int32 status = 9;
int32 isDefault = 10;
}
message CreateVoiceReq {
string speakerId = 1;
string name = 2;
string description = 3;
string gender = 4;
string icon = 5;
string audioId = 6;
int32 sort = 7;
int32 isDefault = 8;
}
message UpdateVoiceReq {
string id = 1;
string speakerId = 2;
string name = 3;
string description = 4;
string gender = 5;
string icon = 6;
string audioId = 7;
int32 sort = 8;
int32 status = 9;
int32 isDefault = 10;
}
message VoiceListReq {
int32 current = 1;
int32 pageSize = 2;
}
message VoiceListResp {
repeated VoiceInfo list = 1;
int64 total = 2;
}
// ========== 互动 ==========
message ToggleLikeReq {
string userId = 1;
string programId = 2;
}
message ToggleFavoriteReq {
string userId = 1;
string programId = 2;
}
message CommentReq {
string userId = 1;
string programId = 2;
string content = 3;
string parentId = 4;
}
message RecordHistoryReq {
string userId = 1;
string programId = 2;
int32 duration = 3;
}
message InteractionListReq {
string userId = 1;
int32 current = 2;
int32 pageSize = 3;
}
message FavoriteListResp {
repeated ProgramInfo list = 1;
int64 total = 2;
}
message HistoryListResp {
repeated ProgramInfo list = 1;
int64 total = 2;
}
// ========== 订阅/VIP ==========
message SubscriptionInfo {
string id = 1;
string channelId = 2;
int64 expiredAt = 3;
int32 status = 4;
}
message SubscriptionListReq {
string userId = 1;
}
message SubscriptionListResp {
repeated SubscriptionInfo list = 1;
}
message CreatePayOrderReq {
string userId = 1;
string channelId = 2;
string planType = 3;
}
message CreatePayOrderResp {
string orderNo = 1;
string prepayId = 2;
}
message VipConfigInfo {
string id = 1;
string name = 2;
string planType = 3;
int32 price = 4;
int32 originalPrice = 5;
int32 duration = 6;
string desc = 7;
}
message VipConfigListResp {
repeated VipConfigInfo list = 1;
}
// ========== 数据分析 ==========
message AnalyticsReq {
string startDate = 1;
string endDate = 2;
}
message AnalyticsOverviewResp {
int64 totalUsers = 1;
int64 totalPlays = 2;
int64 totalChannels = 3;
int64 totalPrograms = 4;
}
message ChannelAnalyticsResp {
repeated ChannelAnalyticsItem list = 1;
}
message ChannelAnalyticsItem {
string channelId = 1;
string channelName = 2;
int64 playCount = 3;
int64 likeCount = 4;
int64 subscriberCount = 5;
}
message UserAnalyticsResp {
int64 newUsers = 1;
int64 activeUsers = 2;
int64 vipUsers = 3;
}
// ========== 服务定义 ==========
service RadioService {
// 用户Profile
rpc GetUserProfile(GetProfileReq) returns (RadioUserProfile);
// 分类
rpc CreateCategory(CategoryReq) returns (CommonResp);
rpc UpdateCategory(CategoryUpdateReq) returns (CommonResp);
rpc DeleteCategory(IdsReq) returns (CommonResp);
rpc GetCategoryList(CategoryListReq) returns (CategoryListResp);
// 频道
rpc CreateChannel(CreateChannelReq) returns (CommonResp);
rpc UpdateChannel(UpdateChannelReq) returns (CommonResp);
rpc DeleteChannel(IdsReq) returns (CommonResp);
rpc GetChannelList(ChannelListReq) returns (ChannelListResp);
rpc GetChannelDetail(IdReq) returns (ChannelInfo);
// 节目
rpc CreateProgram(CreateProgramReq) returns (CommonResp);
rpc UpdateProgram(UpdateProgramReq) returns (CommonResp);
rpc DeleteProgram(IdsReq) returns (CommonResp);
rpc GetProgramList(ProgramListReq) returns (ProgramListResp);
rpc GetProgramDetail(IdReq) returns (ProgramInfo);
// 音色
rpc CreateVoice(CreateVoiceReq) returns (CommonResp);
rpc UpdateVoice(UpdateVoiceReq) returns (CommonResp);
rpc DeleteVoice(IdsReq) returns (CommonResp);
rpc GetVoiceList(VoiceListReq) returns (VoiceListResp);
// 互动
rpc ToggleLike(ToggleLikeReq) returns (CommonResp);
rpc ToggleFavorite(ToggleFavoriteReq) returns (CommonResp);
rpc CommentProgram(CommentReq) returns (CommonResp);
rpc RecordHistory(RecordHistoryReq) returns (CommonResp);
rpc GetFavoriteList(InteractionListReq) returns (FavoriteListResp);
rpc GetHistoryList(InteractionListReq) returns (HistoryListResp);
// 订阅/VIP
rpc GetMySubscriptions(SubscriptionListReq) returns (SubscriptionListResp);
rpc CreatePayOrder(CreatePayOrderReq) returns (CreatePayOrderResp);
rpc GetVipConfigList(IdReq) returns (VipConfigListResp);
rpc GetMyVipInfo(GetProfileReq) returns (RadioUserProfile);
// 数据分析
rpc GetAnalyticsOverview(AnalyticsReq) returns (AnalyticsOverviewResp);
rpc GetChannelAnalytics(AnalyticsReq) returns (ChannelAnalyticsResp);
rpc GetUserAnalytics(AnalyticsReq) returns (UserAnalyticsResp);
}