(step, payload = {})
| 4451 | } |
| 4452 | |
| 4453 | async function completeStepFromBackground(step, payload = {}) { |
| 4454 | if (stopRequested) { |
| 4455 | await setStepStatus(step, 'stopped'); |
| 4456 | await appendManualAccountRunRecordIfNeeded(`step${step}_stopped`, null, STOP_ERROR_MESSAGE); |
| 4457 | notifyStepError(step, STOP_ERROR_MESSAGE); |
| 4458 | return; |
| 4459 | } |
| 4460 | |
| 4461 | const completionState = step === 9 ? await getState() : null; |
| 4462 | await setStepStatus(step, 'completed'); |
| 4463 | await addLog(`步骤 ${step} 已完成`, 'ok'); |
| 4464 | await handleStepData(step, payload); |
| 4465 | if (step === 9) { |
| 4466 | await appendAndBroadcastAccountRunRecord('success', completionState); |
| 4467 | } |
| 4468 | notifyStepComplete(step, payload); |
| 4469 | } |
| 4470 | |
| 4471 | async function appendManualAccountRunRecordIfNeeded(status, stateOverride = null, reason = '') { |
| 4472 | if (!accountRunHistoryHelpers?.appendAccountRunRecord) { |
no test coverage detected