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)