''' Author: caoziyuan ziyuan.cao@zhuying.com Date: 2025-12-23 15:22:53 LastEditors: caoziyuan ziyuan.cao@zhuying.com LastEditTime: 2025-12-23 15:41:35 FilePath: \naming-backend\app\api\v1\module_common\goodname\model.py Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE ''' # -*- coding: utf-8 -*- from sqlalchemy import String, Integer, Text, SmallInteger from sqlalchemy.orm import Mapped, mapped_column from app.core.base_model import ModelMixin, UserMixin class UserNameRecordModel(ModelMixin, UserMixin): """用户起名记录表""" __tablename__ = "biz_user_name_record" # ========== 基本信息 ========== name: Mapped[str] = mapped_column(String(50), nullable=False, comment="起的名字") surname: Mapped[str | None] = mapped_column(String(20), nullable=True, comment="姓氏") full_name: Mapped[str | None] = mapped_column(String(70), nullable=True, comment="完整姓名") # ========== 名字来源 ========== source: Mapped[str | None] = mapped_column(String(100), nullable=True, comment="出处(如:诗经、楚辞)") source_text: Mapped[str | None] = mapped_column(Text, nullable=True, comment="原文/出处原句") meaning: Mapped[str | None] = mapped_column(Text, nullable=True, comment="名字含义/寓意") # ========== 起名对象信息 ========== gender: Mapped[int | None] = mapped_column(SmallInteger, default=0, nullable=True, comment="性别(0:未知 1:男 2:女)") birth_year: Mapped[int | None] = mapped_column(Integer, nullable=True, comment="出生年份") birth_month: Mapped[int | None] = mapped_column(Integer, nullable=True, comment="出生月份") birth_day: Mapped[int | None] = mapped_column(Integer, nullable=True, comment="出生日期") birth_hour: Mapped[int | None] = mapped_column(Integer, nullable=True, comment="出生时辰(0-23)") lunar_birth: Mapped[str | None] = mapped_column(String(50), nullable=True, comment="农历生日") # ========== 五行八字 ========== wuxing: Mapped[str | None] = mapped_column(String(20), nullable=True, comment="五行属性(如:金木水火土)") bazi: Mapped[str | None] = mapped_column(String(50), nullable=True, comment="八字") wuxing_lack: Mapped[str | None] = mapped_column(String(20), nullable=True, comment="五行缺失") # ========== 起名类型 ========== name_type: Mapped[int | None] = mapped_column(SmallInteger, default=1, nullable=True, comment="起名类型(1:宝宝起名 2:成人改名 3:公司起名 4:店铺起名)") # ========== 评分相关 ========== score: Mapped[int | None] = mapped_column(Integer, nullable=True, comment="名字评分(0-100)") score_detail: Mapped[str | None] = mapped_column(Text, nullable=True, comment="评分详情(JSON)") # ========== 用户操作 ========== is_favorite: Mapped[int] = mapped_column(SmallInteger, default=0, nullable=False, comment="是否收藏(0:否 1:是)") is_used: Mapped[int] = mapped_column(SmallInteger, default=0, nullable=False, comment="是否已使用(0:否 1:是)") # ========== 来源渠道 ========== channel: Mapped[str | None] = mapped_column(String(50), nullable=True, comment="来源渠道(如:小程序、APP、网页)") ip_address: Mapped[str | None] = mapped_column(String(50), nullable=True, comment="用户IP地址")