Skip to content

Commit 4c67836

Browse files
fix(auto-exchange): 解决UID识别验证问题
- 添加UID类型检查确保为正整数 - 验证OCR识别结果的有效性 - 在UID识别失败时抛出具体错误信息 - 防止无效UID导致后续兑换流程异常
1 parent 680392c commit 4c67836

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

  • repo/js/每月自动兑换抽卡资源

repo/js/每月自动兑换抽卡资源/main.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@ async function isTaskRefreshed(filePath, options = {}) {
4343
throw new Error("已重试" + (try_count - 1) + "次数,超出最大重试" + try_count_max + "次数");
4444
}
4545
if (!config.user.uid) {
46-
config.user.uid = await ocrUid();
46+
const resolvedUid = await ocrUid();
47+
if (!Number.isInteger(resolvedUid) || resolvedUid <= 0) {
48+
throw new Error(`UID 识别失败: ${resolvedUid}`);
49+
}
50+
config.user.uid = resolvedUid;
4751
}
4852
const uid = config.user.uid;
4953
const current = {uid: uid, time: undefined}

0 commit comments

Comments
 (0)