From e26a7859a8900b152e10961d91fa6ad19a8deb9c Mon Sep 17 00:00:00 2001 From: zhaoqingang <zhaoqg0118@163.com> Date: 星期四, 06 三月 2025 14:41:27 +0800 Subject: [PATCH] 首页通用对话增加 --- app/models/user_model.py | 26 ++++++++++++++++++++++++-- 1 files changed, 24 insertions(+), 2 deletions(-) diff --git a/app/models/user_model.py b/app/models/user_model.py index b76cdc8..bb3a382 100644 --- a/app/models/user_model.py +++ b/app/models/user_model.py @@ -189,7 +189,7 @@ def encrypted_password(self, password): - return cipher_suite.encrypt(password.encode("utf-8")).decode("utf-8") + return cipher_suite.encrypt(str(password).encode("utf-8")).decode("utf-8") def decrypted_password(self): return cipher_suite.decrypt(self.password).decode("utf-8") @@ -232,4 +232,26 @@ @staticmethod def decrypted_password(password): - return cipher_suite.decrypt(password).decode("utf-8") \ No newline at end of file + return cipher_suite.decrypt(password).decode("utf-8") + + +class UserTokenModel(Base): + __tablename__ = "user_token" + id = Column(String(16), primary_key=True) + account = Column(String(255)) + password = Column(String(255)) + access_token = Column(String(1000)) + refresh_token = Column(String(1000)) + created_at = Column(DateTime, default=datetime.now()) + updated_at = Column(DateTime, default=datetime.now()) + + def to_json(self): + return { + 'id': self.id, + 'account': self.username, + 'createTime': self.created_at, + 'updateTime': self.updated_at, + 'password': self.password, + 'access_token': self.access_token, + 'refresh_token': self.refresh_token, + } \ No newline at end of file -- Gitblit v1.8.0