解决bug
This commit is contained in:
@@ -142,8 +142,15 @@ class MessagePushTask(MessagePluginInterface):
|
|||||||
recurring_time = task.get('recurring_time')
|
recurring_time = task.get('recurring_time')
|
||||||
if recurring_time:
|
if recurring_time:
|
||||||
try:
|
try:
|
||||||
# 处理带秒数的时间格式
|
# 处理 timedelta 对象
|
||||||
time_parts = recurring_time.split(':')
|
if isinstance(recurring_time, timedelta):
|
||||||
|
total_seconds = int(recurring_time.total_seconds())
|
||||||
|
hour = total_seconds // 3600
|
||||||
|
minute = (total_seconds % 3600) // 60
|
||||||
|
second = total_seconds % 60
|
||||||
|
else:
|
||||||
|
# 处理字符串格式
|
||||||
|
time_parts = str(recurring_time).split(':')
|
||||||
if len(time_parts) == 3:
|
if len(time_parts) == 3:
|
||||||
hour, minute, second = map(int, time_parts)
|
hour, minute, second = map(int, time_parts)
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user