新增全局流水号
This commit is contained in:
@@ -409,6 +409,16 @@ final class LedgerService {
|
||||
throw new \RuntimeException('ledger_business_mutation_failed');
|
||||
}
|
||||
}
|
||||
$flow_number = \AKSRT\Finance\FinancialFlowService::get_instance()->record_ledger(
|
||||
$command,
|
||||
$transaction_id,
|
||||
$written_entries,
|
||||
$created_at
|
||||
);
|
||||
if (is_wp_error($flow_number)) {
|
||||
throw new LedgerAbort($flow_number);
|
||||
}
|
||||
$result = new LedgerResult($transaction_id, false, $written_entries, $projected_balances, $flow_number);
|
||||
if ($wpdb->query('COMMIT') === false) {
|
||||
throw new \RuntimeException('ledger_commit_failed');
|
||||
}
|
||||
@@ -479,7 +489,8 @@ final class LedgerService {
|
||||
$balances[$entry['user_id']][(string) $entry['asset']] = $entry['balance_after_minor'];
|
||||
}
|
||||
unset($entry);
|
||||
return new LedgerResult($transaction_id, $replayed, (array) $entries, $balances);
|
||||
$flow_number = \AKSRT\Finance\FinancialFlowService::get_instance()->number_for_ledger_transaction($transaction_id);
|
||||
return new LedgerResult($transaction_id, $replayed, (array) $entries, $balances, $flow_number);
|
||||
}
|
||||
|
||||
private function db_error(int $errno, string $detail = ''): \WP_Error {
|
||||
|
||||
Reference in New Issue
Block a user