修复提现金额问题
This commit is contained in:
@@ -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'; // 提现
|
||||
|
||||
Reference in New Issue
Block a user