调整编辑功能

This commit is contained in:
liuwei
2025-06-10 15:40:09 +08:00
parent 8b4048d437
commit ea67e1fc71

View File

@@ -186,6 +186,21 @@ def update_task(task_id):
# 确保 preview_recipients 是 JSON 字符串
if 'preview_recipients' in data and isinstance(data['preview_recipients'], list):
data['preview_recipients'] = json.dumps(data['preview_recipients'])
# 转换时间格式
if 'created_at' in data:
try:
date = datetime.strptime(data['created_at'], '%a, %d %b %Y %H:%M:%S GMT')
data['created_at'] = date.strftime('%Y-%m-%d %H:%M:%S')
except ValueError:
pass
if 'updated_at' in data:
try:
date = datetime.strptime(data['updated_at'], '%a, %d %b %Y %H:%M:%S GMT')
data['updated_at'] = date.strftime('%Y-%m-%d %H:%M:%S')
except ValueError:
pass
# 更新任务
db.update_task(task_id, data)