wallet tron transactions

This commit is contained in:
cano
2024-03-25 06:15:36 +08:00
parent 4b8f205e86
commit 489090382f
83 changed files with 5424 additions and 1343 deletions

View File

@ -1,6 +1,6 @@
<?php
namespace App\Jobs;
namespace App\Jobs\Api;
use App\Exceptions\ModelException;
use App\Models\Api\Post\PostPushBoxModel;

View File

@ -1,6 +1,6 @@
<?php
namespace App\Jobs;
namespace App\Jobs\Api;
use App\Models\Api\Customer\CustomerUserExtendModel;
use Illuminate\Bus\Queueable;

View File

@ -0,0 +1,47 @@
<?php
namespace App\Jobs\Wallet;
use App\Bean\Queue\Wallet\QueueEventBean;
use App\Exceptions\QueueException;
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 WalletAddressTransactionQueue implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* Create a new job instance.
*/
public function __construct()
{
//钱包地址交易账变处理队列
}
/**
* Execute the job.
*/
public function handle(array $params): void
{
$oQueueEventBean = new QueueEventBean($params);
$oUsdtTrx20Service = new UsdtTrx20Service();
try {
$oUsdtTrx20Service->walletAddressTransactionConsumer($oQueueEventBean);
} catch (\Exception $e) {
}
}
public static function putToQueue(QueueEventBean $bean,$delaySec = null): \Illuminate\Foundation\Bus\PendingDispatch
{
$queue = self::dispatch($bean->toArrayNotNull())->onQueue(QueueEventBean::QUEUE_NAME);
if(!empty($delaySec)){
$queue->delay(now()->addSeconds($delaySec));
}
return $queue;
}
}

View 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;
}
}

View File

@ -0,0 +1,43 @@
<?php
namespace App\Jobs\Wallet;
use App\Bean\Queue\Wallet\QueueWalletBlockTransactionBean;
use App\Exceptions\QueueException;
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 WalletBlockTransactionQueue implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* Create a new job instance.
*/
public function __construct()
{
//
}
/**
* Execute the job.
*/
public function handle(array $params): void
{
$oQueueWalletBlockTransactionBean = new QueueWalletBlockTransactionBean($params);
$oUsdtTrx20Service = new UsdtTrx20Service();
try {
$oUsdtTrx20Service->tronBlockTransactionConsumer($oQueueWalletBlockTransactionBean);
} catch (\Exception $e) {
}
}
public static function putToQueue(QueueWalletBlockTransactionBean $bean): \Illuminate\Foundation\Bus\PendingDispatch
{
return self::dispatch($bean->toArrayNotNull())->onQueue(QueueWalletBlockTransactionBean::QUEUE_NAME);
}
}

View File

@ -0,0 +1,36 @@
<?php
namespace App\Jobs\Wallet;
use App\Bean\Queue\Wallet\QueueNotifyToPlatformBean;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
class WalletNotifyToPlatformQueue implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* Create a new job instance.
*/
public function __construct()
{
//通知到平台
}
/**
* Execute the job.
*/
public function handle(): void
{
//
}
public static function putToQueue(QueueNotifyToPlatformBean $bean): \Illuminate\Foundation\Bus\PendingDispatch
{
return self::dispatch($bean->toArrayNotNull())->onQueue(QueueNotifyToPlatformBean::QUEUE_NAME);
}
}

View File

@ -0,0 +1,55 @@
<?php
namespace App\Jobs\Wallet;
use App\Bean\Queue\Wallet\QueueWalletPlatformTransactionBean;
use App\Exceptions\QueueException;
use App\Models\Wallet\Wallet\WalletAddressTransactionModel;
use App\Service\PlatformRechargeService;
use App\Service\PlatformWithdrawService;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
class WalletPlatformTransactionQueue implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* Create a new job instance.
*/
public function __construct()
{
//处理平台到账账变
}
/**
* Execute the job.
*/
public function handle(array $params): void
{
$bean = new QueueWalletPlatformTransactionBean($params);
$oWithdrawService = new PlatformWithdrawService();
$oRechargeSService = new PlatformRechargeService();
try {
$type = $bean->getType();
//提现
if ($type == WalletAddressTransactionModel::TYPE_WITHDRAW) {
$oWithdrawService->walletPlatformTransactionConsumer($bean);
}
//充值
if ($type == WalletAddressTransactionModel::TYPE_RECHARGE) {
$oRechargeSService->walletPlatformTransactionConsumer($bean);
}
} catch (\Exception $e) {
}
}
public static function putToQueue(QueueWalletPlatformTransactionBean $bean): \Illuminate\Foundation\Bus\PendingDispatch
{
return self::dispatch($bean->toArrayNotNull())->onQueue(QueueWalletPlatformTransactionBean::QUEUE_NAME);
}
}

View File

@ -0,0 +1,47 @@
<?php
namespace App\Jobs\Wallet;
use App\Bean\Queue\Wallet\QueueWalletPlatformWithdrawTransferBean;
use App\Exceptions\QueueException;
use App\Service\PlatformWithdrawService;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
class WalletPlatformWithdrawTransferQueue implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* Create a new job instance.
*/
public function __construct()
{
//处理提现任务
}
/**
* Execute the job.
*/
public function handle(array $params): void
{
$bean = new QueueWalletPlatformWithdrawTransferBean($params);
$oService = new PlatformWithdrawService();
try {
$oService->withdrawTransferConsumer($bean);
} catch (\Exception $e) {
}
}
public static function putToQueue(QueueWalletPlatformWithdrawTransferBean $bean, $delaySec = null): \Illuminate\Foundation\Bus\PendingDispatch
{
$queue = self::dispatch($bean->toArrayNotNull())->onQueue(QueueWalletPlatformWithdrawTransferBean::QUEUE_NAME);
if(!empty($delaySec)){
$queue->delay(now()->addSeconds($delaySec));
}
return $queue;
}
}

View File

@ -1,39 +0,0 @@
<?php
namespace App\Jobs;
use App\Models\Wallet\PlatformUser\WalletPlatformUserTransactionModel;
use App\Models\Wallet\Wallet\WalletAddrModel;
use App\Models\Wallet\Wallet\WalletAddrTransactionModel;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldBeUnique;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
class WalletAddrTransactionChangeQueue implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* Create a new job instance.
*/
public function __construct()
{
//钱包账变队列,用于处理用户和平台账变
}
/**
* Execute the job.
*/
public function handle(array $params): void
{
$wallet_addr_transaction_id = $params['wallet_addr_transaction_id'];
$wallet_addr_transaction_type = $params['wallet_addr_transaction_type'];
$oWalletAddrModel = new WalletAddrModel();
$oWalletAddrModel->walletAddrTransactionChangeConsumer($wallet_addr_transaction_id, $wallet_addr_transaction_type);
}
}

View File

@ -1,35 +0,0 @@
<?php
namespace App\Jobs;
use App\Models\Wallet\PlatformUser\WalletPlatformUserTransactionModel;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldBeUnique;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
class WalletPlatformUserWithdrawQueue implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* Create a new job instance.
*/
public function __construct()
{
//处理平台用户提现
}
/**
* Execute the job.
*/
public function handle(array $params): void
{
$id = $params['wallet_platform_user_transaction_id'];
$oWalletPlatformUserTransactionModel = new WalletPlatformUserTransactionModel();
$oWalletPlatformUserTransactionModel->withdrawConsumer($id);
}
}