26 lines
1.1 KiB
Python
26 lines
1.1 KiB
Python
# -*- coding: utf-8 -*-
|
|
|
|
from datetime import datetime
|
|
from sqlalchemy import String, DateTime, Text
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from app.core.base_model import ModelMixin
|
|
|
|
|
|
class MiniappUserModel(ModelMixin):
|
|
"""
|
|
小程序用户模型
|
|
|
|
存储微信小程序用户信息
|
|
"""
|
|
__tablename__: str = "miniapp_user"
|
|
__table_args__: dict[str, str] = ({'comment': '小程序用户表'})
|
|
|
|
openid: Mapped[str] = mapped_column(String(64), nullable=False, unique=True, index=True, comment="微信openid")
|
|
unionid: Mapped[str | None] = mapped_column(String(64), nullable=True, unique=True, comment="微信unionid")
|
|
session_key: Mapped[str | None] = mapped_column(String(64), nullable=True, comment="会话密钥")
|
|
nickname: Mapped[str | None] = mapped_column(String(64), nullable=True, comment="昵称")
|
|
avatar: Mapped[str | None] = mapped_column(String(512), nullable=True, comment="头像URL")
|
|
phone: Mapped[str | None] = mapped_column(String(20), nullable=True, comment="手机号")
|
|
last_login: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), nullable=True, comment="最后登录时间")
|