Files
meijiaka-zy/python-api/app/models/bgm_music.py
T

43 lines
1.6 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""
背景音乐模型
==========
装修行业场景化 BGM 库,按知识科普/案例展示/促销活动/家居生活/智能家居
五个场景分类管理。
"""
from sqlalchemy import Float, Integer, String
from sqlalchemy.orm import Mapped, mapped_column
from app.models.base import BaseModelBigInt
class BgmMusic(BaseModelBigInt):
"""
背景音乐表
Attributes:
title: 音乐名称
artist: 艺术家
category: 场景分类 (knowledge/showcase/promotion/lifestyle/tech)
file_path: 相对文件路径(如 knowledge/3_Dance_with_Me.mp3
duration: 时长(秒)
status: 状态 (active/inactive)
sort_order: 排序权重(越小越靠前)
"""
__tablename__ = "mjk_bgm_musics"
title: Mapped[str] = mapped_column(String(255), nullable=False, comment="音乐名称")
artist: Mapped[str] = mapped_column(String(255), nullable=True, comment="艺术家")
category: Mapped[str] = mapped_column(
String(32), nullable=False, index=True, comment="场景分类"
)
file_path: Mapped[str] = mapped_column(String(512), nullable=False, comment="相对文件路径")
url: Mapped[str] = mapped_column(String(1024), nullable=False, comment="七牛云 URL")
duration: Mapped[float] = mapped_column(Float, nullable=True, comment="时长(秒)")
status: Mapped[str] = mapped_column(
String(16), default="active", nullable=False, comment="状态: active/inactive"
)
sort_order: Mapped[int] = mapped_column(Integer, default=0, nullable=False, comment="排序权重")