Files
cycle_api/app/Service/Wallet/PlatformRechargeService.php
2024-03-26 20:07:19 +08:00

32 lines
1.2 KiB
PHP

<?php
namespace App\Service\Wallet;
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');
}
}