25 lines
834 B
TypeScript
25 lines
834 B
TypeScript
import type { JsonObject } from '../../types/json.js'
|
|
import { logInfo } from '../../utils/logger.js'
|
|
import { settleDueDepositUnfreezes } from '../worker-platform/worker-profile-service.js'
|
|
|
|
export async function runDepositUnfreezeJob(job: JsonObject) {
|
|
const config =
|
|
job.config && typeof job.config === 'object' && !Array.isArray(job.config)
|
|
? (job.config as JsonObject)
|
|
: {}
|
|
const scanLimit = Math.max(1, Number(config.scanLimit || 100))
|
|
|
|
const result = await settleDueDepositUnfreezes({ limit: scanLimit })
|
|
|
|
logInfo('[deposit-unfreeze]', '押金解冻扫描完成', result)
|
|
|
|
return {
|
|
ok: true,
|
|
status: 'ok',
|
|
message: `扫描 ${result.checkedCount} 笔,解冻 ${result.processedCount} 笔`,
|
|
checkedCount: result.checkedCount,
|
|
failedCount: 0,
|
|
asset: result.processedCount,
|
|
}
|
|
}
|