(task, bindData)
| 2413 | } |
| 2414 | |
| 2415 | async function runLocalAutoBindInBackground(task, bindData) { |
| 2416 | try { |
| 2417 | const autoResult = await submitLocalAutoBind(task, bindData); |
| 2418 | if (autoResult?.verified) { |
| 2419 | toast.success(`任务 #${task.id} 全自动绑卡完成: ${String(autoResult.subscription_type || "").toUpperCase()}`); |
| 2420 | } else if (autoResult?.paid_confirmed) { |
| 2421 | toast.success(`任务 #${task.id} 已确认支付,等待订阅同步(可点“同步订阅”)`, 7000); |
| 2422 | } else if (autoResult?.pending || autoResult?.need_user_action) { |
| 2423 | const stage = String(autoResult?.local_auto?.stage || autoResult?.local_auto?.error || "challenge").toUpperCase(); |
| 2424 | toast.warning( |
| 2425 | `任务 #${task.id} 全自动绑卡已提交(${stage}),请在支付页完成验证后点击“我已完成支付”或“同步订阅”。`, |
| 2426 | 9000 |
| 2427 | ); |
| 2428 | } else { |
| 2429 | const sub = String(autoResult?.subscription_type || "free").toUpperCase(); |
| 2430 | toast.warning(`任务 #${task.id} 全自动绑卡执行完成,但当前订阅为 ${sub},请稍后再同步`, 7000); |
| 2431 | } |
| 2432 | } catch (autoErr) { |
| 2433 | toast.error(`任务 #${task.id} 全自动绑卡失败: ${formatErrorMessage(autoErr)}`); |
| 2434 | } finally { |
| 2435 | try { |
| 2436 | await loadBindCardTasks(); |
| 2437 | } catch (_) { |
| 2438 | // 忽略刷新异常,避免覆盖前面的业务提示 |
| 2439 | } |
| 2440 | } |
| 2441 | } |
| 2442 | |
| 2443 | // 生成并创建绑卡任务 |
| 2444 | async function createBindCardTask() { |
no test coverage detected