sdsf
All checks were successful
Deploy / deploy-staging (push) Successful in 25s
Deploy / deploy-production (push) Has been skipped

This commit is contained in:
2026-06-22 00:12:32 +02:00
parent 5c615aa878
commit 650a0bd11a
10 changed files with 413 additions and 34 deletions

View File

@@ -459,6 +459,76 @@ final class MiningRepository
]);
}
public function listWalletWithdrawals(string $projectKey): array
{
$stmt = $this->pdo->prepare(
'SELECT * FROM ' . $this->table('wallet_withdrawals') . ' WHERE project_key = :project_key AND owner_sub = :owner_sub ORDER BY withdrawal_at ASC, id ASC'
);
$stmt->execute(['project_key' => $projectKey, 'owner_sub' => $this->ownerSub]);
return $this->normalizeRows($stmt->fetchAll() ?: []);
}
public function saveWalletWithdrawal(string $projectKey, array $payload): array
{
if ($this->driver === 'pgsql') {
$stmt = $this->pdo->prepare(
'INSERT INTO ' . $this->table('wallet_withdrawals') . ' (
project_key, owner_sub, withdrawal_at, coins_amount, withdrawal_currency, note
) VALUES (
:project_key, :owner_sub, :withdrawal_at, :coins_amount, :withdrawal_currency, :note
)
RETURNING *'
);
$stmt->execute([
'project_key' => $projectKey,
'owner_sub' => $this->ownerSub,
'withdrawal_at' => $payload['withdrawal_at'],
'coins_amount' => $payload['coins_amount'],
'withdrawal_currency' => $payload['withdrawal_currency'],
'note' => $payload['note'],
]);
return $this->normalizeRow($stmt->fetch() ?: []);
}
$stmt = $this->pdo->prepare(
'INSERT INTO ' . $this->table('wallet_withdrawals') . ' (
project_key, owner_sub, withdrawal_at, coins_amount, withdrawal_currency, note
) VALUES (
:project_key, :owner_sub, :withdrawal_at, :coins_amount, :withdrawal_currency, :note
)'
);
$stmt->execute([
'project_key' => $projectKey,
'owner_sub' => $this->ownerSub,
'withdrawal_at' => $payload['withdrawal_at'],
'coins_amount' => $payload['coins_amount'],
'withdrawal_currency' => $payload['withdrawal_currency'],
'note' => $payload['note'],
]);
$id = (int) $this->pdo->lastInsertId();
$fetch = $this->pdo->prepare('SELECT * FROM ' . $this->table('wallet_withdrawals') . ' WHERE id = :id LIMIT 1');
$fetch->execute(['id' => $id]);
return $this->normalizeRow($fetch->fetch() ?: []);
}
public function deleteWalletWithdrawal(string $projectKey, int $withdrawalId): void
{
if ($withdrawalId <= 0) {
return;
}
$stmt = $this->pdo->prepare(
'DELETE FROM ' . $this->table('wallet_withdrawals') . '
WHERE id = :id AND project_key = :project_key AND owner_sub = :owner_sub'
);
$stmt->execute([
'id' => $withdrawalId,
'project_key' => $projectKey,
'owner_sub' => $this->ownerSub,
]);
}
public function listWalletSnapshots(string $projectKey, int $limit = 100): array
{
$stmt = $this->pdo->prepare(