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

fix(Push): Update push content and close emulator

GanSer 1 год назад
Родитель
Сommit
a6e615cb0a
1 измененных файлов с 9 добавлено и 0 удалено
  1. 9 0
      script.py

+ 9 - 0
script.py

@@ -387,6 +387,8 @@ class Script:
             logger.critical('Game page unknown')
             self.save_error_log()
             self.config.notifier.push(title=f'{I18n.trans_zh_cn(command)}{command}', content=f"<{self.config_name}> GamePageUnknownError")
+            self.config.task_call('Restart')
+            self.device.sleep(10)
             return False
         except ScriptError as e:
             logger.critical(e)
@@ -480,6 +482,13 @@ class Script:
                 logger.critical("Possible reason #2: There is a problem with this task. "
                                 "Please contact developers or try to fix it yourself.")
                 logger.critical('Request human takeover')
+                # 添加失败三次的推送通知
+                self.config.notifier.push(
+                    title=f'{I18n.trans_zh_cn(task)}{task}',
+                    content=f"<{self.config_name}> 任务连续失败三次,请上线查看"
+                )
+                # 关闭模拟器
+                self.device.emulator_stop()
                 exit(1)
 
             if success: