mirror of
https://github.com/cnlimiter/codex-register.git
synced 2026-08-10 23:23:44 +08:00
feat(mail): 添加收件箱功能,自动获得验证码
This commit is contained in:
@@ -42,7 +42,7 @@ class Account(Base):
|
||||
client_id = Column(String(255)) # OAuth Client ID
|
||||
account_id = Column(String(255))
|
||||
workspace_id = Column(String(255))
|
||||
email_service = Column(String(50), nullable=False) # 'tempmail', 'outlook', 'custom_domain'
|
||||
email_service = Column(String(50), nullable=False) # 'tempmail', 'outlook', 'moe_mail'
|
||||
email_service_id = Column(String(255)) # 邮箱服务中的ID
|
||||
proxy_used = Column(String(255))
|
||||
registered_at = Column(DateTime, default=datetime.utcnow)
|
||||
@@ -89,7 +89,7 @@ class EmailService(Base):
|
||||
__tablename__ = 'email_services'
|
||||
|
||||
id = Column(Integer, primary_key=True, autoincrement=True)
|
||||
service_type = Column(String(50), nullable=False) # 'outlook', 'custom_domain'
|
||||
service_type = Column(String(50), nullable=False) # 'outlook', 'moe_mail'
|
||||
name = Column(String(100), nullable=False)
|
||||
config = Column(JSONEncodedDict, nullable=False) # 服务配置(加密存储)
|
||||
enabled = Column(Boolean, default=True)
|
||||
|
||||
@@ -117,6 +117,14 @@ class DatabaseSessionManager:
|
||||
Base.metadata.create_all(bind=self.engine)
|
||||
|
||||
with self.engine.connect() as conn:
|
||||
# 数据迁移:将旧的 custom_domain 记录统一为 moe_mail
|
||||
try:
|
||||
conn.execute(text("UPDATE email_services SET service_type='moe_mail' WHERE service_type='custom_domain'"))
|
||||
conn.execute(text("UPDATE accounts SET email_service='moe_mail' WHERE email_service='custom_domain'"))
|
||||
conn.commit()
|
||||
except Exception as e:
|
||||
logger.warning(f"迁移 custom_domain -> moe_mail 时出错: {e}")
|
||||
|
||||
for table_name, column_name, column_type in migrations:
|
||||
try:
|
||||
# 检查列是否存在
|
||||
|
||||
Reference in New Issue
Block a user