refactor: 统一日志管理 + 数据库索引优化
- db/schema.py: 添加 4 个复合索引优化查询性能 - idx_user_schedules_user_enabled - idx_schedule_execution_logs_schedule_id/user_id/status - db/users.py: print → logger,密码升级日志改为记录 user_id - crypto_utils.py: print → logger - password_utils.py: print → logger 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
"""
|
||||
import bcrypt
|
||||
import hashlib
|
||||
from app_logger import get_logger
|
||||
logger = get_logger(__name__)
|
||||
|
||||
|
||||
def hash_password_bcrypt(password):
|
||||
@@ -35,7 +37,7 @@ def verify_password_bcrypt(password, password_hash):
|
||||
return bcrypt.checkpw(password.encode('utf-8'),
|
||||
password_hash.encode('utf-8'))
|
||||
except Exception as e:
|
||||
print(f"bcrypt验证异常: {e}")
|
||||
logger.error(f"bcrypt验证异常: {e}")
|
||||
return False
|
||||
|
||||
|
||||
@@ -70,5 +72,5 @@ def verify_password_sha256(password, password_hash):
|
||||
computed_hash = hashlib.sha256(password.encode()).hexdigest()
|
||||
return computed_hash == password_hash
|
||||
except Exception as e:
|
||||
print(f"SHA256验证异常: {e}")
|
||||
logger.error(f"SHA256验证异常: {e}")
|
||||
return False
|
||||
|
||||
Reference in New Issue
Block a user