From a898024dbc4eb2666e12eca66b94d21702235989 Mon Sep 17 00:00:00 2001 From: lq Date: Mon, 30 Sep 2024 10:01:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=8F=90=E7=8E=B0=E9=87=91?= =?UTF-8?q?=E9=A2=9D=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controllers/EplpayCallbackController.php | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/member/modules/v1/controllers/EplpayCallbackController.php b/member/modules/v1/controllers/EplpayCallbackController.php index b90fb10..4ac168d 100644 --- a/member/modules/v1/controllers/EplpayCallbackController.php +++ b/member/modules/v1/controllers/EplpayCallbackController.php @@ -6,6 +6,7 @@ use common\forms\LedgerForm; use common\jobs\ProductOrderRefundJob; use common\jobs\ProductOrderSyncPlatformJob; +use common\models\ChargeCashPayRecord; use common\models\PaymentRegister; use common\models\PaymentRegisterRefund; use common\models\Register; @@ -307,15 +308,29 @@ class EplpayCallbackController extends \yii\web\Controller $CashAccount->frozen_cash -= $applyOrder->apply_cash; $CashAccount->saveOrFail(); } else { + // 获取代扣订单 + $chargeCpr = ChargeCashPayRecord::find()->where([ + 'status' => 2, + 'order_no' => $applyOrder->order_no + ])->one(); $applyOrder->dakuan_status = 1; $applyOrder->dakuan_time = date('Y-m-d H:i:s'); $applyOrder->saveOrFail(); - $CashAccount->frozen_cash -= $applyOrder->apply_cash; - $CashAccount->withdrawn_cash += $applyOrder->apply_cash; - $CashAccount->charge_cash += $applyOrder->charge_cash; + $CashAccount->frozen_cash = bcsub($CashAccount->frozen_cash, $applyOrder->apply_cash, 2); + $CashAccount->withdrawn_cash = bcadd($CashAccount->withdrawn_cash, $applyOrder->apply_cash, 2); + $CashAccount->charge_cash = bcadd($CashAccount->charge_cash, $applyOrder->charge_cash, 2); $CashAccount->saveOrFail(); + // 扣除平台账户的金额 + $platformAccount = CashAccount::find()->where([ + 'user_id' => 0, + 'user_type' => 2 + ])->one(); + $platformAccount->able_cash = bcsub($platformAccount->able_cash, $chargeCpr->charge_cash, 2); + $platformAccount->charge_cash = bcadd($platformAccount->charge_cash, $chargeCpr->charge_cash, 2); + $platformAccount->saveOrFail(); + // 增加流水记录 $fundWater = new FundWater(); $fundWater->type = 'withdraw'; // 提现