Просмотр исходного кода

Merge pull request #698 from ohspecial/feat1

fix(GuildBanquet):修复保存配置参数
huangrunheng 1 год назад
Родитель
Сommit
16293026fa
1 измененных файлов с 7 добавлено и 1 удалено
  1. 7 1
      tasks/GuildBanquet/script_task.py

+ 7 - 1
tasks/GuildBanquet/script_task.py

@@ -154,10 +154,16 @@ class ScriptTask(GameUi, GuildBanquetAssets):
         UserWarning: Pydantic serializer warnings:
   Expected `enum` but got `Weekday` with value `<Weekday.Thursday: '星期四'>` - serialized value may not be as expected
         """
+        
         try:
             # 当结束宴会时,设置宴会时间的日期及时间,宴会时间设置为运行结束时间提前15分钟
             next_time = datetime.now() - timedelta(minutes=15)
+            next_time = next_time.replace(second=0, microsecond=0)
+            # 计算下次运行时间
+            next_time = datetime.time(next_time)
+            
             today = datetime.now().weekday()          
+            
             # 修改配置文件
             if today == self.banquet_day_1:
                 self.run_time.run_time_1 = next_time
@@ -188,7 +194,7 @@ class ScriptTask(GameUi, GuildBanquetAssets):
 if __name__ == '__main__':
     from module.config.config import Config
     from module.device.device import Device
-    c = Config('xiaohao')
+    c = Config('oas1')
     d = Device(c)
     t = ScriptTask(c, d)
     t.run()