feat: quene

This commit is contained in:
hashbro
2026-09-01 05:09:00 +08:00
parent 337bf45c79
commit e23550e820
28 changed files with 969 additions and 234 deletions
+40
View File
@@ -0,0 +1,40 @@
<?php
namespace App\Jobs;
use App\Models\WalletAddress;
use App\Services\AutoTransferService;
use Illuminate\Contracts\Queue\ShouldBeUnique;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Queue\Queueable;
class AutoTransferAddress implements ShouldQueue, ShouldBeUnique
{
use Queueable;
public int $tries = 1;
public int $timeout = 180;
public int $uniqueFor = 180;
public function __construct(
public int $walletAddressId,
public string $reason = 'cron',
) {}
public function uniqueId(): string
{
return 'auto-transfer:'.$this->walletAddressId;
}
public function handle(AutoTransferService $autoTransfer): void
{
$address = WalletAddress::query()->find($this->walletAddressId);
if ($address === null) {
return;
}
$autoTransfer->evaluate($address, $this->reason);
}
}