From 94db2e2d723a4171ff00bcc3e363d2e4dbe886c4 Mon Sep 17 00:00:00 2001 From: shenshuo <191715030@qq.com> Date: Tue, 22 Oct 2024 17:34:23 +0800 Subject: [PATCH] =?UTF-8?q?2024=E5=B9=B410=E6=9C=8822=E6=97=A5=20=E8=B6=85?= =?UTF-8?q?=E7=AE=A1=E5=BC=80=E5=90=AFMFA=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mg/handlers/token_v4_handler.py | 4 ++-- models/authority.py | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/mg/handlers/token_v4_handler.py b/mg/handlers/token_v4_handler.py index b3d5fdf..28d4010 100644 --- a/mg/handlers/token_v4_handler.py +++ b/mg/handlers/token_v4_handler.py @@ -41,8 +41,8 @@ def post(self, *args, **kwargs): with DBContext('r') as session: user_info = session.query(Users).filter(Users.id == user_id).first() - if user_info.superuser == '0': - return self.write(dict(code=-4, msg='超级用户不能生成长期令牌')) + # if user_info.superuser == '0': + # return self.write(dict(code=-4, msg='超级用户不能生成长期令牌')) # 生成token is_superuser = True if user_info.superuser == '0' else False diff --git a/models/authority.py b/models/authority.py index e4f4ece..33562a9 100644 --- a/models/authority.py +++ b/models/authority.py @@ -14,7 +14,7 @@ Base = declarative_base() -class Users(TimeBaseModel, Base): +class Users(Base): __tablename__ = 'codo_a_users' # 用户表 @@ -38,6 +38,8 @@ class Users(TimeBaseModel, Base): fs_id = Column('fs_id', String(180), default='') # 飞书ID ext_info = Column('ext_info', JSON(), default={}, comment='扩展字段存JSON') # 扩展字段 ## + create_time = Column(DateTime, nullable=False, default=datetime.now) # 记录的创建时间 + update_time = Column(DateTime, nullable=False, default=datetime.now, index=True) # 更新时间 last_ip = Column('last_ip', String(20), default='') last_login = Column('last_login', DateTime(), default=datetime.now, onupdate=datetime.now)