add service dir

This commit is contained in:
cano
2024-03-26 20:07:19 +08:00
parent 6ce37d789f
commit 01e93acdd8
20 changed files with 24 additions and 30 deletions

View File

@ -0,0 +1,31 @@
<?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');
}
}