mirror of
https://github.com/babalae/bettergi-scripts-list.git
synced 2026-03-30 05:49:51 +08:00
feat(config): 添加复活重试次数配置选项
- 在配置文件中添加 retry_count 参数,默认值为 3 - 从设置界面读取重试次数并转换为整数值 - 将硬编码的重试次数 5 替换为配置值 - 在设置界面添加下拉选择框供用户自定义重试次数 - 添加复活重试功能的 UI 输出调用
This commit is contained in:
@@ -4,6 +4,7 @@ import {ocrPhysical} from "../utils/physical";
|
||||
const config = {
|
||||
//setting设置放在这个json
|
||||
run: {
|
||||
retry_count: 3,//复活重试次数
|
||||
config: '',
|
||||
// load_uid_config: false,
|
||||
loads: [],//加载方式list
|
||||
@@ -176,6 +177,7 @@ async function initConfig() {
|
||||
// config.user.physical.min = physical.min
|
||||
// 初始化uid
|
||||
config.user.uid = await ocrUid()
|
||||
config.run.retry_count = (settings.retry_count?parseInt(settings.retry_count):config.run.retry_count)
|
||||
const bgi_tools_token = settings.bgi_tools_token || "Authorization= "
|
||||
const list = Array.from(bgi_tools_token.split("=")).map(item => item.trim());
|
||||
config.bgi_tools.token.name = list[0]
|
||||
|
||||
@@ -88,7 +88,7 @@ async function autoDomain(autoFight) {
|
||||
log.debug(`副本轮数:${domainParam.DomainRoundNum}`)
|
||||
|
||||
// 复活重试
|
||||
for (let i = 0; i < 5; i++) {
|
||||
for (let i = 0; i < config.run.retry_count; i++) {
|
||||
try {
|
||||
await dispatcher.RunAutoDomainTask(domainParam);
|
||||
// 其他场景不重试
|
||||
@@ -102,6 +102,7 @@ async function autoDomain(autoFight) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
await outDomainUI()
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -145,7 +146,7 @@ async function autoLeyLineOutcrop(autoLeyLineOutcrop) {
|
||||
param.isResinExhaustionMode = true;
|
||||
param.openModeCountMin = true;
|
||||
// 复活重试
|
||||
for (let i = 0; i < 5; i++) {
|
||||
for (let i = 0; i < config.run.retry_count; i++) {
|
||||
try {
|
||||
await dispatcher.RunAutoLeyLineOutcropTask(param);
|
||||
// 其他场景不重试
|
||||
|
||||
@@ -17,6 +17,17 @@
|
||||
"label": "自动秘境计划配置\n语法:说明太长 去看文档",
|
||||
"default": ""
|
||||
},
|
||||
{
|
||||
"name": "retry_count",
|
||||
"type": "select",
|
||||
"label": "复活重试次数",
|
||||
"options": [
|
||||
"1","2","3",
|
||||
"4","5","6",
|
||||
"7","8","9",
|
||||
] ,
|
||||
"default": "3"
|
||||
},
|
||||
{
|
||||
"type": "separator"
|
||||
},
|
||||
@@ -39,8 +50,7 @@
|
||||
"type": "input-text",
|
||||
"label": "bgi_tools推送全部配置api(去看文档)",
|
||||
"default": "http://127.0.0.1:8081/bgi/auto/plan/domain/json/all"
|
||||
}
|
||||
,
|
||||
},
|
||||
{
|
||||
"name": "bgi_tools_token",
|
||||
"type": "input-text",
|
||||
|
||||
Reference in New Issue
Block a user