加入类型转换逻辑,防止解码失败
This commit is contained in:
@@ -179,11 +179,16 @@ class TaskDBOperator(BaseDBOperator):
|
|||||||
values = []
|
values = []
|
||||||
# 需要序列化的字段
|
# 需要序列化的字段
|
||||||
json_fields = ['groups', 'content_miniprogram', 'preview_recipients', 'content_link', 'weekly_days']
|
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():
|
for key, value in updates.items():
|
||||||
# 跳过空值字段
|
# 跳过空值字段
|
||||||
if value is None or (isinstance(value, list) and len(value) == 0):
|
if value is None or (isinstance(value, list) and len(value) == 0):
|
||||||
continue
|
continue
|
||||||
|
# 跳过datetime字段的空字符串
|
||||||
|
if key in datetime_fields and value == '':
|
||||||
|
continue
|
||||||
|
|
||||||
fields.append(f"{key} = %s")
|
fields.append(f"{key} = %s")
|
||||||
# 如果是需要序列化的字段,且值不是字符串类型,则进行序列化
|
# 如果是需要序列化的字段,且值不是字符串类型,则进行序列化
|
||||||
|
|||||||
Reference in New Issue
Block a user