MCPcopy Create free account
hub / github.com/Tron521/codex-console-temp / startVendorAutoBind

Function startVendorAutoBind

static/js/payment.js:1517–1552  ·  view source on GitHub ↗
(task, vendorConfig)

Source from the content-addressed store, hash-verified

1515}
1516
1517async function startVendorAutoBind(task, vendorConfig) {
1518 const taskId = Number(task?.id || 0);
1519 if (!taskId) {
1520 throw new Error("任务 ID 无效");
1521 }
1522 const redeemCode = String(vendorConfig?.redeem_code || "").trim();
1523 if (!redeemCode) {
1524 throw new Error("兑换码不能为空");
1525 }
1526 showVendorProgressPanel(true);
1527 resetVendorProgressPanel();
1528 vendorProgressState.taskId = taskId;
1529 vendorProgressState.lastConfig = {
1530 redeem_code: redeemCode,
1531 checkout_url: String(vendorConfig?.checkout_url || "").trim(),
1532 api_url: String(vendorConfig?.api_url || "").trim(),
1533 api_key: String(vendorConfig?.api_key || "").trim(),
1534 };
1535 stopVendorProgressPolling();
1536 setVendorStopButtonState(true, true);
1537 setVendorRetryButtonState(true, false);
1538 appendVendorLogs([{ time: "--:--:--", message: `任务 #${taskId} 已创建,开始执行卡商接口订阅...` }]);
1539 const data = await api.post(`/payment/bind-card/tasks/${taskId}/auto-bind-vendor`, {
1540 redeem_code: redeemCode,
1541 checkout_url: String(vendorConfig?.checkout_url || "").trim() || undefined,
1542 api_url: String(vendorConfig?.api_url || "").trim() || undefined,
1543 api_key: String(vendorConfig?.api_key || "").trim() || undefined,
1544 timeout_seconds: 240,
1545 });
1546 updateVendorProgressUi(data?.progress || { progress: 5, status: "running" }, taskId);
1547 appendVendorLogs(data?.progress?.logs || []);
1548 vendorProgressState.cursor = Number(data?.progress?.next_cursor || 0);
1549 vendorProgressState.timer = setTimeout(() => {
1550 pollVendorProgress(taskId);
1551 }, 1200);
1552}
1553
1554async function retryVendorAutoTask() {
1555 const taskId = Number(vendorProgressState.taskId || 0);

Callers 2

retryVendorAutoTaskFunction · 0.85
createBindCardTaskFunction · 0.85

Calls 9

showVendorProgressPanelFunction · 0.85
resetVendorProgressPanelFunction · 0.85
setVendorStopButtonStateFunction · 0.85
appendVendorLogsFunction · 0.85
updateVendorProgressUiFunction · 0.85
pollVendorProgressFunction · 0.85
postMethod · 0.45

Tested by

no test coverage detected