feat: 订阅列表和免费列表

This commit is contained in:
Blizzard
2026-03-03 17:09:37 +08:00
parent d79beb4663
commit 042c99aa46
21 changed files with 4182 additions and 209 deletions
+9 -8
View File
@@ -8,14 +8,15 @@ import (
// RadioCategory 电台分类表
type RadioCategory struct {
global.BaseModel
Name string `gorm:"size:50" json:"name"` // 分类名称
Description string `gorm:"size:255" json:"description"` // 分类描述
IconId string `gorm:"size:50" json:"iconId"` // 图标OSS ID
Icon *system.Oss `gorm:"foreignKey:IconId" json:"icon"` // 图标OSS
CoverId string `gorm:"size:50" json:"coverId"` // 封面图OSS ID
Cover *system.Oss `gorm:"foreignKey:CoverId" json:"cover"` // 封面图OSS
Sort int `gorm:"default:0" json:"sort"` // 排序
Status int `gorm:"default:1" json:"status"` // 状态 0:禁用 1:启用
Name string `gorm:"size:50" json:"name"` // 分类名称
Description string `gorm:"size:255" json:"description"` // 分类描述
IconId string `gorm:"size:50" json:"iconId"` // 图标OSS ID
Icon *system.Oss `gorm:"foreignKey:IconId" json:"icon"` // 图标OSS
CoverId string `gorm:"size:50" json:"coverId"` // 封面图OSS ID
Cover *system.Oss `gorm:"foreignKey:CoverId" json:"cover"` // 封面图OSS
Sort int `gorm:"default:0" json:"sort"` // 排序
Status int `gorm:"default:1" json:"status"` // 状态 0:禁用 1:启用
Channels []*RadioChannel `gorm:"foreignKey:CategoryId" json:"channels"`
}
func (RadioCategory) TableName() string {
+15 -11
View File
@@ -8,17 +8,21 @@ import (
// RadioChannel 电台频道表
type RadioChannel struct {
global.BaseModel
CategoryId string `gorm:"size:50;index" json:"categoryId"` // 分类ID
Name string `gorm:"size:50" json:"name"` // 频道名称
Description string `gorm:"size:500" json:"description"` // 频道描述
Price int `gorm:"default:0;comment:价格,单位,分 " json:"price"` //价格 单位:分
CoverId string `gorm:"size:50" json:"coverId"` // 封面图OSS ID
Cover *system.Oss `gorm:"foreignKey:CoverId" json:"cover"` // 封面图OSS
Tags string `gorm:"size:255" json:"tags"` // 标签,逗号分隔
IsVipOnly int `gorm:"default:0" json:"isVipOnly"` // 是否VIP专享 0:否 1:是
Sort int `gorm:"default:0" json:"sort"` // 排序
Status int `gorm:"default:1" json:"status"` // 状态 0:禁用 1:启用
HasSubscribed int `gorm:"-" json:"hasSubscribed"` // 状态 0:未订阅 1:已订阅
CategoryId string `gorm:"size:50;index" json:"categoryId"` // 分类ID
Name string `gorm:"size:50" json:"name"` // 频道名称
Description string `gorm:"size:500" json:"description"` // 频道描述
IsFree int `gorm:"default:0" json:"isFree"` //是否永久免费 0:否 1:是
IsVipOnly int `gorm:"default:0" json:"isVipOnly"` // 是否VIP专享 0:否 1:是
MonthlyPrice int `gorm:"default:0;comment:价格,单位,分 " json:"monthlyPrice"` //包月价格 单位:分
QuarterlyPrice int `gorm:"default:0;comment:价格,单位,分 " json:"quarterlyPrice"` //包季度价格 单位:分
AnnualPrice int `gorm:"default:0;comment:价格,单位,分 " json:"annualPrice"` //包年价格 单位:分
CoverId string `gorm:"size:50" json:"coverId"` // 封面图OSS ID
Cover *system.Oss `gorm:"foreignKey:CoverId" json:"cover"` // 封面图OSS
Tags string `gorm:"size:255" json:"tags"` // 标签,逗号分隔
Sort int `gorm:"default:0" json:"sort"` // 排序
Status int `gorm:"default:1" json:"status"` // 状态 0:禁用 1:启用
HasSubscribed int `gorm:"-" json:"hasSubscribed"` // 状态 0:未订阅 1:已订阅
Programs []*RadioProgram `gorm:"foreignKey:ChannelId" json:"programs"` //频道下的节目
}
func (RadioChannel) TableName() string {
+5 -4
View File
@@ -7,10 +7,11 @@ import (
// RadioHistory 用户收听历史表
type RadioHistory struct {
global.BaseModel
UserId string `gorm:"size:50;index" json:"userId"` // 用户ID
ProgramId string `gorm:"size:50;index" json:"programId"` // 节目ID
Progress int `gorm:"default:0" json:"progress"` // 播放进度(秒)
Duration int `gorm:"default:0" json:"duration"` // 节目总时长(秒)
UserId string `gorm:"size:50;index" json:"userId"` // 用户ID
ProgramId string `gorm:"size:50;index" json:"programId"` // 节目ID
Progress int `gorm:"default:0" json:"progress"` // 播放进度(秒)
Duration int `gorm:"default:0" json:"duration"` // 节目总时长(秒)
RadioProgram *RadioProgram `gorm:"foreignKey:ProgramId" json:"program"`
}
func (RadioHistory) TableName() string {
+14 -13
View File
@@ -8,19 +8,20 @@ import (
// RadioProgram 电台节目表
type RadioProgram struct {
global.BaseModel
ChannelId string `gorm:"size:50;index" json:"channelId"` // 频道ID
Title string `gorm:"size:100" json:"title"` // 节目标题
Description string `gorm:"size:500" json:"description"` // 节目描述
Content string `gorm:"type:text" json:"content"`
CoverId string `gorm:"size:50" json:"coverId"` // 封面图OSS ID
Cover *system.Oss `gorm:"foreignKey:CoverId" json:"coverUrl"` // 封面图OSS
AudioId string `gorm:"size:50" json:"audioId"` // 音频OSS ID
Audio *system.Oss `gorm:"foreignKey:AudioId" json:"audio"` // 音频OSS
Duration int `gorm:"default:0" json:"duration"` // 时长(秒)
Tags string `gorm:"size:255" json:"tags"` // 标签,逗号分隔
PlayCount int `gorm:"default:0" json:"playCount"` // 播放次数
LikeCount int `gorm:"default:0" json:"likeCount"` // 点赞次数
Status int `gorm:"default:1" json:"status"` // 状态 0:下架 1:上架
ChannelId string `gorm:"size:50;index" json:"channelId"` // 频道ID
Title string `gorm:"size:100" json:"title"` // 节目标题
Description string `gorm:"size:500" json:"description"` // 节目描述
Content string `gorm:"type:text" json:"content"`
CoverId string `gorm:"size:50" json:"coverId"` // 封面图OSS ID
Cover *system.Oss `gorm:"foreignKey:CoverId" json:"cover"` // 封面图OSS
AudioId string `gorm:"size:50" json:"audioId"` // 音频OSS ID
Audio *system.Oss `gorm:"foreignKey:AudioId" json:"audio"` // 音频OSS
Duration int `gorm:"default:0" json:"duration"` // 时长(秒)
Tags string `gorm:"size:255" json:"tags"` // 标签,逗号分隔
PlayCount int `gorm:"default:0" json:"playCount"` // 播放次数
LikeCount int `gorm:"default:0" json:"likeCount"` // 点赞次数
Status int `gorm:"default:1" json:"status"` // 状态 0:下架 1:上架
Channel *RadioChannel `gorm:"foreignKey:ChannelId" json:"channel"`
}
func (RadioProgram) TableName() string {
+4 -3
View File
@@ -7,9 +7,10 @@ import (
// RadioSubscription 用户订阅表
type RadioSubscription struct {
global.BaseModel
UserId string `gorm:"size:50;index;not null;uniqueIndex:idx_user_channel" json:"userId"` // 用户ID
ChannelId string `gorm:"size:50;index;uniqueIndex:idx_user_channel" json:"channelId"` // 频道ID
Status int `gorm:"type:tinyint;default:1"` //1-订阅中,2-已取消
UserId string `gorm:"size:50;index;not null;uniqueIndex:idx_user_channel" json:"userId"` // 用户ID
ChannelId string `gorm:"size:50;index;uniqueIndex:idx_user_channel" json:"channelId"` // 频道ID
Status int `gorm:"type:tinyint;default:1"` //1-订阅中,2-已取消
Channel *RadioChannel `gorm:"foreignKey:ChannelId" json:"channel"`
}
func (RadioSubscription) TableName() string {
-1
View File
@@ -11,7 +11,6 @@ type GetCategoryList struct {
// SaveCategory 保存分类请求
type SaveCategory struct {
Id string `json:"id" form:"id"` // 分类ID(更新时使用)
Name string `json:"name" binding:"required"` // 分类名称
Description string `json:"description"` // 分类描述
IconId string `json:"iconId"` // 图标URL
+25 -18
View File
@@ -12,26 +12,33 @@ type GetChannelList struct {
// SaveChannel 保存频道请求
type SaveChannel struct {
Id string `json:"id" form:"id"` // 频道ID(更新时使用)
CategoryId string `json:"categoryId" binding:"required"` // 分类ID
Name string `json:"name" binding:"required"` // 频道名称
Description string `json:"description"` // 频道描述
CoverId string `json:"coverId"` // 封面图URL
Tags string `json:"tags"` // 标签
IsVipOnly int `json:"isVipOnly"` // 是否VIP专享
Sort int `json:"sort"` // 排序
Status int `json:"status"` // 状态
CategoryId string `json:"categoryId" binding:"required"` // 分类ID
Name string `json:"name" binding:"required"` // 频道名称
Description string `json:"description"` // 频道描述
CoverId string `json:"coverId"` // 封面图URL
Tags string `json:"tags"` // 标签
IsFree int `json:"isFree"` //是否永久免费
IsVipOnly int `json:"isVipOnly"` //是否vip专享
MonthlyPrice int `json:"monthlyPrice"` //包月价格
QuarterlyPrice int `json:"quarterlyPrice"` //包季价格
AnnualPrice int `json:"annualPrice"` //包季价格
Sort int `json:"sort"` // 排序
Status int `json:"status"` // 状态
}
// UpdateChannel 更新频道请求
type UpdateChannel struct {
Id string `json:"id" binding:"required"` // 频道ID
CategoryId string `json:"categoryId"` // 分类ID
Name string `json:"name"` // 频道名称
Description string `json:"description"` // 频道描述
CoverId string `json:"coverId"` // 封面图URL
Tags string `json:"tags"` // 标签
IsVipOnly int `json:"isVipOnly"` // 是否VIP专享
Sort int `json:"sort"` // 排序
Status int `json:"status"` // 状态
Id string `json:"id" binding:"required"` // 频道ID
CategoryId string `json:"categoryId"` // 分类ID
Name string `json:"name"` // 频道名称
Description string `json:"description"` // 频道描述
CoverId string `json:"coverId"` // 封面图URL
Tags string `json:"tags"` // 标签
IsFree int `json:"isFree"`
IsVipOnly int `json:"isVipOnly"` //是否vip专享
MonthlyPrice int `json:"monthlyPrice"` //包月价格
QuarterlyPrice int `json:"quarterlyPrice"` //包季价格
AnnualPrice int `json:"annualPrice"` //包季价格
Sort int `json:"sort"` // 排序
Status int `json:"status"` // 状态
}
+3 -4
View File
@@ -5,14 +5,13 @@ import common "sundynix-go/model/commom/request"
// GetProgramList 获取节目列表请求
type GetProgramList struct {
common.PageInfo
ChannelId string `json:"channelId" form:"channelId"` // 频道ID
Title string `json:"title" form:"title"` // 节目标题
Status int `json:"status" form:"status"` // 状态
ChannelId string `json:"channelId" binding:"required" form:"channelId"` // 频道ID
Title string `json:"title" form:"title"` // 节目标题
Status int `json:"status" form:"status"` // 状态
}
// SaveProgram 保存节目请求
type SaveProgram struct {
Id string `json:"id" form:"id"` // 节目ID(更新时使用)
ChannelId string `json:"channelId" binding:"required"` // 频道ID
Title string `json:"title" binding:"required"` // 节目标题
Description string `json:"description"` // 节目描述