diff --git a/Scripts/NewAddToCart_Web.js b/Scripts/NewAddToCart_Web.js index ffb451b..c179f7d 100644 --- a/Scripts/NewAddToCart_Web.js +++ b/Scripts/NewAddToCart_Web.js @@ -151,11 +151,43 @@ function finalizeAndClean() { } } +function doneWithPage(title, message, type = "warn") { + const color = type === "error" ? "#e05050" : type === "warn" ? "#e8a838" : "#52b043"; + const icon = type === "error" ? "❌" : type === "warn" ? "⚠️" : "✅"; + const html = ` + + + + +Xbox Cart · 尼区 + + + +
+
${icon}
+
${title}
+
${message}
+
Xbox Cart · 🇳🇬 尼区
+
+ +`; + $done({ response: { status: 200, headers: { "Content-Type": "text/html;charset=utf-8", "Cache-Control": "no-store, no-cache, must-revalidate", "Pragma": "no-cache" }, body: html } }); +} + function startTask() { if (!MUID || !MS_CV) { log("error", "缺少 MUID/CV"); $notification.post("❌ Xbox 脚本错误", "缺少必要参数", "请检查 MUID 或 MS_CV"); - finalizeAndClean(); + doneWithPage("缺少必要参数", "未找到 MUID 或 MS-CV,请确认已正确写入:

cart-x-authorization-muid
cart-ms-cv", "error"); return; } if (productList.length === 0) { @@ -167,9 +199,9 @@ function startTask() { url: REMOTE_COMMIT_URL, headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ remaining: {} }) - }, () => $done({})); + }, () => doneWithPage("暂无商品", `远程队列与本地列表均为空,无需加购。

来源: ${sourceLabel}`, "warn")); } else { - $done({}); + doneWithPage("暂无商品", `远程队列与本地列表均为空,无需加购。

来源: ${sourceLabel}`, "warn"); } return; } @@ -248,4 +280,4 @@ $httpClient.get(REMOTE_READ_URL, (error, response, data) => { } startTask(); } -}); +}); \ No newline at end of file