加入类型转换逻辑,防止解码失败

This commit is contained in:
liuwei
2025-06-12 12:25:10 +08:00
parent 00b770eaa8
commit b07165118c

View File

@@ -179,11 +179,16 @@ class TaskDBOperator(BaseDBOperator):
values = []
# 需要序列化的字段
json_fields = ['groups', 'content_miniprogram', 'preview_recipients', 'content_link', 'weekly_days']
# datetime字段
datetime_fields = ['recurring_end', 'recurring_time', 'schedule_time']
for key, value in updates.items():
# 跳过空值字段
if value is None or (isinstance(value, list) and len(value) == 0):
continue
# 跳过datetime字段的空字符串
if key in datetime_fields and value == '':
continue
fields.append(f"{key} = %s")
# 如果是需要序列化的字段,且值不是字符串类型,则进行序列化