fix: 修改getCloudflareUsage函数中的错误处理逻辑,确保返回默认值而非抛出错误

This commit is contained in:
cmliu
2025-11-08 19:30:51 +08:00
parent 319f5f6744
commit 084a28b631

View File

@@ -1509,7 +1509,7 @@ async function getCloudflareUsage(Email, GlobalAPIKey, AccountID, APIToken) {
const cfg = { "Content-Type": "application/json" };
try {
if (!AccountID && (!Email || !GlobalAPIKey)) throw new Error("请提供账户ID或API密钥");
if (!AccountID && (!Email || !GlobalAPIKey)) return { success: false, pages: 0, workers: 0, total: 0 };
if (!AccountID) {
const r = await fetch(`${API}/accounts`, {