wallet tron transactions
This commit is contained in:
46
app/Jobs/Wallet/WalletBlockQueue.php
Normal file
46
app/Jobs/Wallet/WalletBlockQueue.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs\Wallet;
|
||||
|
||||
use App\Bean\Queue\Wallet\QueueWalletBlockBean;
|
||||
use App\Service\Coin\Tron\UsdtTrx20Service;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class WalletBlockQueue implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//处理tron区块任务
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*/
|
||||
public function handle(array $params): void
|
||||
{
|
||||
$oQueueWalletBlockBean = new QueueWalletBlockBean($params);
|
||||
$oUsdtTrx20Service = new UsdtTrx20Service();
|
||||
try {
|
||||
$oUsdtTrx20Service->tronBlockConsumer($oQueueWalletBlockBean);
|
||||
} catch (\Exception $e) {
|
||||
}
|
||||
}
|
||||
|
||||
public static function putToQueue(QueueWalletBlockBean $bean,$delaySec = null): \Illuminate\Foundation\Bus\PendingDispatch
|
||||
{
|
||||
$queue = self::dispatch($bean->toArrayNotNull())->onQueue(QueueWalletBlockBean::QUEUE_NAME);
|
||||
if(!empty($delaySec)){
|
||||
$queue->delay(now()->addSeconds($delaySec));
|
||||
}
|
||||
return $queue;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user