js:AAA狗粮批发0.0.2 (#1540)

修复无记录文件时报错
This commit is contained in:
mno
2025-08-10 18:50:58 +08:00
committed by GitHub
parent 287b72a377
commit 26d378d1cb
2 changed files with 17 additions and 12 deletions

View File

@@ -45,10 +45,10 @@ let failcount = 0;
}
{
//校验自定义配置,从未打开过自定义配置时进行警告
for (let i = 0; i < 5; i++) {
log.warn("测试版本可能存在各种bug出现问题请联系作者详见readme");
await sleep(1000);
}
for (let i = 0; i < 5; i++) {
log.warn("测试版本可能存在各种bug出现问题请联系作者详见readme");
await sleep(1000);
}
}
//预处理
await readRecord(accountName);//读取记录文件
@@ -155,14 +155,7 @@ async function readRecord(accountName) {
}
}
if (fileExists) {
log.info(`记录文件 ${recordFilePath} 存在`);
} else {
log.warn(`无记录文件,将使用默认数据`);
}
const content = await file.readText(recordFilePath);
const lines = content.split("\n");
/* ---------- 初始化记录对象 ---------- */
record = {
@@ -175,6 +168,18 @@ async function readRecord(accountName) {
let recordIndex = 0;
if (fileExists) {
log.info(`记录文件 ${recordFilePath} 存在`);
} else {
log.warn(`无记录文件,将使用默认数据`);
return;
}
const content = await file.readText(recordFilePath);
const lines = content.split("\n");
/* ---------- 逐行解析 ---------- */
for (const rawLine of lines) {
const line = rawLine.trim();

View File

@@ -1,7 +1,7 @@
{
"manifest_version": 1,
"name": "AAA狗粮批发测试版本",
"version": "0.0.1",
"version": "0.0.2",
"tags": [
"狗粮"
],