spark-server/internal/module/music/entity/track.go
DESKTOP-L8OUL9F\gfl0034 ade98eef4d feat(music): 曲目增加背景图字段与管理端上传
新增 migration 0021(background_key/url)、playlist/CRUD 返回 backgroundUrl、
POST .../music/{id}/background,并热更 popadmin 音乐列表背景上传;公读策略放行 perm/music/*。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-24 09:17:21 +08:00

41 lines
1.2 KiB
Go

package entity
import "time"
const (
SettingMemberPreviewSeconds = "member_preview_seconds"
DefaultPreviewSeconds = 30
MaxCoverBytes = 5 << 20 // 5 MiB
MaxBackgroundBytes = 5 << 20 // 5 MiB
MaxAudioBytes = 50 << 20 // 50 MiB
)
// Track is one curated music item for the Spark music list.
type Track struct {
ID int64 `json:"id"`
Title string `json:"title"`
CoverKey string `json:"coverKey"`
AudioKey string `json:"audioKey"`
BackgroundKey string `json:"backgroundKey"`
CoverURL string `json:"coverUrl"`
AudioURL string `json:"audioUrl"`
BackgroundURL string `json:"backgroundUrl"`
RequireMember bool `json:"requireMember"`
SortOrder int `json:"sortOrder"`
Enabled bool `json:"enabled"`
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
// Settings is the global music ops config.
type Settings struct {
MemberPreviewSeconds int `json:"memberPreviewSeconds"`
}
// Playlist is the client-facing payload.
type Playlist struct {
Items []Track `json:"items"`
MemberPreviewSeconds int `json:"memberPreviewSeconds"`
}