32 lines
1.1 KiB
PHP
32 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Service;
|
|
|
|
use App\Bean\Queue\Wallet\QueueWalletPlatformTransactionBean;
|
|
use App\Exceptions\QueueException;
|
|
use App\Models\Wallet\Platform\WalletPlatformBalanceTransactionModel;
|
|
use App\Models\Wallet\Platform\WalletPlatformBindModel;
|
|
|
|
class PlatformRechargeService
|
|
{
|
|
function walletPlatformTransactionConsumer(QueueWalletPlatformTransactionBean $bean): void
|
|
{
|
|
//根据钱包id查找平台和用户
|
|
$oWalletPlatformBindModel = new WalletPlatformBindModel();
|
|
$resBindModel = $oWalletPlatformBindModel->findItem($bean->getWalletId());
|
|
if (!$resBindModel) throw new QueueException('钱包不存在');
|
|
$oWalletPlatformBalanceTransactionModel = new WalletPlatformBalanceTransactionModel();
|
|
$res = $oWalletPlatformBalanceTransactionModel->typeRecharge(
|
|
$resBindModel->platform_id,
|
|
$resBindModel->uid,
|
|
$resBindModel->currency_code,
|
|
$bean->getAmount(),
|
|
$bean->getWalletId(),
|
|
$bean->getBlockTransactionId(),
|
|
$bean->getWalletTransactionId()
|
|
);
|
|
if (!$res) throw new QueueException('typeRecharge fail');
|
|
}
|
|
|
|
}
|