补单逻辑
Build docker and publish / build (20.15.1) (push) Has been cancelled

This commit is contained in:
2026-05-06 05:42:48 -07:00
parent 54daa923da
commit 8bc8e81e95
3 changed files with 76 additions and 29 deletions
+28 -7
View File
@@ -277,9 +277,22 @@
const emailInput = document.getElementById("email");
const orderInput = document.getElementById("order-no");
const codeInput = document.getElementById("code");
const API_BASE = "https://tapi.hifast.biz";
let countdownTimer = null;
const ERROR_MESSAGE_MAP = {
"Param Error": "请检查订单号、邮箱和验证码是否填写正确。",
"Verify code error": "邮箱验证码错误或已过期,请重新获取验证码。",
"Too Many Requests": "验证码发送太频繁,请稍后再试。",
"This account has reached the limit of sending times today":
"该邮箱今天获取验证码次数已达上限,请明天再试。"
};
function friendlyMessage(message, fallback) {
return ERROR_MESSAGE_MAP[message] || message || fallback;
}
function showStatus(type, message) {
statusBox.className = `status show ${type}`;
statusBox.textContent = message;
@@ -296,7 +309,7 @@
}
async function postJson(path, body) {
const response = await fetch(path, {
const response = await fetch(`${API_BASE}${path}`, {
method: "POST",
headers: {
"Content-Type": "application/json"
@@ -305,7 +318,9 @@
});
const payload = await response.json().catch(() => ({}));
if (!response.ok || payload.code !== 200) {
throw new Error(payload.msg || "请求失败,请稍后再试");
throw new Error(
friendlyMessage(payload.msg, "请求失败,请稍后再试。")
);
}
return payload.data || {};
}
@@ -361,13 +376,19 @@
email,
code
});
showStatus(
"success",
result.message || "恢复完成,请使用该邮箱验证码登录查看订阅。"
);
const message =
result.message || "恢复完成,请使用该邮箱验证码登录查看订阅。";
if (result.success === false) {
showStatus("error", message);
return;
}
showStatus("success", message);
form.reset();
} catch (error) {
showStatus("error", "订单或邮箱验证码无效,请确认后重试。");
showStatus(
"error",
error.message || "恢复失败,请检查信息后重试。"
);
} finally {
submitButton.disabled = false;
submitButton.textContent = "恢复订阅";