注册码 + 管理员系统:
User 模型新增 is_admin 字段
新增 InviteCode 模型(邀请码表)
注册接口必须提供有效邀请码,使用后自动标记
管理员接口:查看所有用户、启用/禁用用户、生成/删除邀请码
前端新增管理面板页面 /admin,导航栏对管理员显示入口
注册页面新增邀请码输入框
选择性超话签到:
新增 GET /api/v1/accounts/{id}/topics 接口获取超话列表
POST /signin 接口支持 {"topic_indices": [0,1,3]} 选择性签到
新增超话选择页面 /accounts/{id}/topics,支持全选/手动勾选
账号详情页新增"选择超话签到"按钮
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
"""Shared ORM models for Weibo-HotSign."""
|
||||
|
||||
from .base import Base, get_db, engine, AsyncSessionLocal
|
||||
from .user import User
|
||||
from .user import User, InviteCode
|
||||
from .account import Account
|
||||
from .task import Task
|
||||
from .signin_log import SigninLog
|
||||
@@ -12,6 +12,7 @@ __all__ = [
|
||||
"engine",
|
||||
"AsyncSessionLocal",
|
||||
"User",
|
||||
"InviteCode",
|
||||
"Account",
|
||||
"Task",
|
||||
"SigninLog",
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -19,6 +19,7 @@ class User(Base):
|
||||
wx_openid = Column(String(64), unique=True, nullable=True, index=True)
|
||||
wx_nickname = Column(String(100), nullable=True)
|
||||
wx_avatar = Column(String(500), nullable=True)
|
||||
is_admin = Column(Boolean, default=False)
|
||||
created_at = Column(DateTime, server_default=func.now())
|
||||
is_active = Column(Boolean, default=True)
|
||||
|
||||
@@ -26,3 +27,15 @@ class User(Base):
|
||||
|
||||
def __repr__(self):
|
||||
return f"<User(id={self.id}, username='{self.username}')>"
|
||||
|
||||
|
||||
class InviteCode(Base):
|
||||
__tablename__ = "invite_codes"
|
||||
|
||||
id = Column(String(36), primary_key=True, default=lambda: str(uuid.uuid4()))
|
||||
code = Column(String(32), unique=True, nullable=False, index=True)
|
||||
created_by = Column(String(36), nullable=False)
|
||||
used_by = Column(String(36), nullable=True)
|
||||
is_used = Column(Boolean, default=False)
|
||||
created_at = Column(DateTime, server_default=func.now())
|
||||
used_at = Column(DateTime, nullable=True)
|
||||
|
||||
Reference in New Issue
Block a user