重构消息存储逻辑,使用Peewee模型存储消息和撤回消息,添加时间戳处理

This commit is contained in:
墨梓柒
2025-05-15 10:24:25 +08:00
parent 224c1e3fb7
commit 2be0130d23
3 changed files with 77 additions and 33 deletions

View File

@@ -2,6 +2,7 @@ from collections import defaultdict
from datetime import datetime, timedelta
from typing import Any, Dict, Tuple, List
from src.common.logger import get_module_logger
from src.manager.async_task_manager import AsyncTask
@@ -82,8 +83,10 @@ class OnlineTimeRecordTask(AsyncTask):
else:
# 若没有记录,则插入新的在线时间记录
new_record = OnlineTime.create(
timestamp=current_time.timestamp(), # 添加此行
start_timestamp=current_time,
end_timestamp=extended_end_time,
duration=5, # 初始时长为5分钟
)
self.record_id = new_record.id
except Exception as e: