Files
sundynix-micro-be/app/radio/api/radio.api
T
2026-04-27 00:02:18 +08:00

378 lines
8.9 KiB
Plaintext

syntax = "v1"
info (
title: "电台业务服务API"
desc: "频道、节目、订阅、互动、支付、VIP、音色等HTTP接口"
author: "sundynix"
version: "v1.0.0"
)
type (
// ---------- 通用 ----------
IdReq {
Id string `json:"id"`
}
IdPathReq {
Id string `path:"id"`
}
IdsReq {
Ids []string `json:"ids"`
}
// ---------- 分类 ----------
CategoryReq {
Name string `json:"name"`
Icon string `json:"icon,optional"`
Sort int `json:"sort,optional"`
}
CategoryUpdateReq {
Id string `json:"id"`
Name string `json:"name,optional"`
Icon string `json:"icon,optional"`
Sort int `json:"sort,optional"`
}
CategoryListReq {
Current int `json:"current,optional"`
PageSize int `json:"pageSize,optional"`
Name string `json:"name,optional"`
}
// ---------- 频道 ----------
ChannelReq {
CategoryId string `json:"categoryId"`
Name string `json:"name"`
Description string `json:"description,optional"`
IsFree int `json:"isFree,optional"`
IsVipOnly int `json:"isVipOnly,optional"`
MonthlyPrice int `json:"monthlyPrice,optional"`
QuarterlyPrice int `json:"quarterlyPrice,optional"`
AnnualPrice int `json:"annualPrice,optional"`
Cover string `json:"cover,optional"`
Tags string `json:"tags,optional"`
Sort int `json:"sort,optional"`
}
ChannelUpdateReq {
Id string `json:"id"`
CategoryId string `json:"categoryId,optional"`
Name string `json:"name,optional"`
Description string `json:"description,optional"`
IsFree int `json:"isFree,optional"`
IsVipOnly int `json:"isVipOnly,optional"`
MonthlyPrice int `json:"monthlyPrice,optional"`
QuarterlyPrice int `json:"quarterlyPrice,optional"`
AnnualPrice int `json:"annualPrice,optional"`
Cover string `json:"cover,optional"`
Tags string `json:"tags,optional"`
Sort int `json:"sort,optional"`
Status int `json:"status,optional"`
}
ChannelListReq {
Current int `json:"current,optional"`
PageSize int `json:"pageSize,optional"`
CategoryId string `json:"categoryId,optional"`
Name string `json:"name,optional"`
}
// ---------- 节目 ----------
ProgramReq {
ChannelId string `json:"channelId"`
Title string `json:"title"`
Description string `json:"description,optional"`
Content string `json:"content,optional"`
Cover string `json:"cover,optional"`
AudioId string `json:"audioId,optional"`
Tags string `json:"tags,optional"`
}
ProgramUpdateReq {
Id string `json:"id"`
ChannelId string `json:"channelId,optional"`
Title string `json:"title,optional"`
Description string `json:"description,optional"`
Content string `json:"content,optional"`
Cover string `json:"cover,optional"`
AudioId string `json:"audioId,optional"`
Tags string `json:"tags,optional"`
Status int `json:"status,optional"`
}
ProgramListReq {
Current int `json:"current,optional"`
PageSize int `json:"pageSize,optional"`
ChannelId string `json:"channelId,optional"`
Title string `json:"title,optional"`
}
// ---------- 音色 ----------
VoiceReq {
SpeakerId string `json:"speakerId"`
Name string `json:"name"`
Description string `json:"description,optional"`
Gender string `json:"gender,optional"`
Icon string `json:"icon,optional"`
AudioId string `json:"audioId,optional"`
Sort int `json:"sort,optional"`
IsDefault int `json:"isDefault,optional"`
}
VoiceUpdateReq {
Id string `json:"id"`
Name string `json:"name,optional"`
Description string `json:"description,optional"`
Gender string `json:"gender,optional"`
Icon string `json:"icon,optional"`
AudioId string `json:"audioId,optional"`
Sort int `json:"sort,optional"`
IsDefault int `json:"isDefault,optional"`
Status int `json:"status,optional"`
}
VoiceListReq {
Current int `json:"current,optional"`
PageSize int `json:"pageSize,optional"`
Gender string `json:"gender,optional"`
}
// ---------- 订阅 ----------
SubscribeReq {
ChannelId string `json:"channelId"`
PlanType string `json:"planType"`
}
// ---------- 互动 ----------
LikeReq {
ProgramId string `json:"programId"`
}
FavoriteReq {
ProgramId string `json:"programId"`
}
CommentReq {
ProgramId string `json:"programId"`
Content string `json:"content"`
ParentId string `json:"parentId,optional"`
}
HistoryReq {
ProgramId string `json:"programId"`
Duration int `json:"duration,optional"`
}
HistoryListReq {
Current int `json:"current,optional"`
PageSize int `json:"pageSize,optional"`
}
// ---------- 支付 ----------
CreatePayOrderReq {
ChannelId string `json:"channelId,optional"`
PlanType string `json:"planType"`
OrderType string `json:"orderType"`
}
// ---------- VIP ----------
VipConfigListReq {
Current int `json:"current,optional"`
PageSize int `json:"pageSize,optional"`
}
// ---------- 数据分析 ----------
AnalyticsReq {
StartDate string `json:"startDate,optional"`
EndDate string `json:"endDate,optional"`
}
// ---------- TTS ----------
TtsReq {
Text string `json:"text"`
SpeakerId string `json:"speakerId,optional"`
}
)
// ========== 无需鉴权 ==========
@server (
prefix: /api/radio
group: callback
)
service radio-api {
@doc "微信支付回调"
@handler WechatPayCallback
post /callback/wechatpay
}
// ========== 需要鉴权 ==========
@server (
prefix: /api/radio
group: category
jwt: Auth
)
service radio-api {
@doc "创建分类"
@handler CreateCategory
post /category/create (CategoryReq)
@doc "更新分类"
@handler UpdateCategory
put /category/update (CategoryUpdateReq)
@doc "删除分类"
@handler DeleteCategory
delete /category/delete (IdsReq)
@doc "分类列表"
@handler GetCategoryList
post /category/list (CategoryListReq)
}
@server (
prefix: /api/radio
group: channel
jwt: Auth
)
service radio-api {
@doc "创建频道"
@handler CreateChannel
post /channel/create (ChannelReq)
@doc "更新频道"
@handler UpdateChannel
put /channel/update (ChannelUpdateReq)
@doc "删除频道"
@handler DeleteChannel
delete /channel/delete (IdsReq)
@doc "频道列表"
@handler GetChannelList
post /channel/list (ChannelListReq)
@doc "频道详情"
@handler GetChannelDetail
get /channel/:id (IdPathReq)
}
@server (
prefix: /api/radio
group: program
jwt: Auth
)
service radio-api {
@doc "创建节目"
@handler CreateProgram
post /program/create (ProgramReq)
@doc "更新节目"
@handler UpdateProgram
put /program/update (ProgramUpdateReq)
@doc "删除节目"
@handler DeleteProgram
delete /program/delete (IdsReq)
@doc "节目列表"
@handler GetProgramList
post /program/list (ProgramListReq)
@doc "节目详情"
@handler GetProgramDetail
get /program/:id (IdPathReq)
@doc "TTS生成音频"
@handler GenerateTts
post /program/tts (TtsReq)
}
@server (
prefix: /api/radio
group: voice
jwt: Auth
)
service radio-api {
@doc "创建音色"
@handler CreateVoice
post /voice/create (VoiceReq)
@doc "更新音色"
@handler UpdateVoice
put /voice/update (VoiceUpdateReq)
@doc "删除音色"
@handler DeleteVoice
delete /voice/delete (IdsReq)
@doc "音色列表"
@handler GetVoiceList
post /voice/list (VoiceListReq)
}
@server (
prefix: /api/radio
group: subscription
jwt: Auth
)
service radio-api {
@doc "我的订阅列表"
@handler GetMySubscriptions
get /subscription/list
}
@server (
prefix: /api/radio
group: interaction
jwt: Auth
)
service radio-api {
@doc "点赞/取消点赞"
@handler ToggleLike
post /interaction/like (LikeReq)
@doc "收藏/取消收藏"
@handler ToggleFavorite
post /interaction/favorite (FavoriteReq)
@doc "评论节目"
@handler CommentProgram
post /interaction/comment (CommentReq)
@doc "记录播放历史"
@handler RecordHistory
post /interaction/history (HistoryReq)
@doc "播放历史列表"
@handler GetHistoryList
post /interaction/history/list (HistoryListReq)
@doc "我的收藏列表"
@handler GetFavoriteList
post /interaction/favorite/list (HistoryListReq)
}
@server (
prefix: /api/radio
group: pay
jwt: Auth
)
service radio-api {
@doc "创建支付订单"
@handler CreatePayOrder
post /pay/create (CreatePayOrderReq)
}
@server (
prefix: /api/radio
group: vip
jwt: Auth
)
service radio-api {
@doc "VIP配置列表"
@handler GetVipConfigList
post /vip/list (VipConfigListReq)
@doc "我的VIP信息"
@handler GetMyVipInfo
get /vip/info
}
@server (
prefix: /api/radio
group: analytics
jwt: Auth
)
service radio-api {
@doc "数据概览"
@handler GetAnalyticsOverview
post /analytics/overview (AnalyticsReq)
@doc "频道数据"
@handler GetChannelAnalytics
post /analytics/channel (AnalyticsReq)
@doc "用户数据"
@handler GetUserAnalytics
post /analytics/user (AnalyticsReq)
}