1. 分账资金变动功能
This commit is contained in:
@@ -13,6 +13,7 @@ use common\models\oldDb\CashAccount;
|
||||
use common\models\oldDb\CashApply;
|
||||
use common\models\oldDb\ChargeCashPayRecord;
|
||||
use common\models\oldDb\FundWater;
|
||||
use common\services\AccountAbleChangeLogService;
|
||||
use common\models\oldDb\PaymentProductOrder;
|
||||
use common\models\oldDb\PaymentProductRefund;
|
||||
use common\models\oldDb\PaymentRegister;
|
||||
@@ -309,13 +310,35 @@ class EplpayCallbackController extends \yii\web\Controller
|
||||
$applyOrder->saveOrFail();
|
||||
|
||||
if ($applyOrder->user_type === 3) {
|
||||
$before = $CashAccount->balance;
|
||||
$CashAccount->balance = bcadd($CashAccount->balance, $applyOrder->apply_cash, 6);
|
||||
$CashAccount->withdrawn_frozen = bcsub($CashAccount->withdrawn_frozen, $applyOrder->apply_cash, 6);
|
||||
$CashAccount->saveOrFail();
|
||||
AccountAbleChangeLogService::logSupplierBalanceChange(
|
||||
(int)$applyOrder->user_id,
|
||||
$before,
|
||||
$CashAccount->balance,
|
||||
'withdraw',
|
||||
'yii_cash_apply',
|
||||
(int)$applyOrder->id,
|
||||
['order_no' => (string)$applyOrder->order_no, 'remark' => '提现回调失败回退可提现余额']
|
||||
);
|
||||
} else {
|
||||
$before = $CashAccount->able_cash;
|
||||
$CashAccount->able_cash = $CashAccount->able_cash + $applyOrder->apply_cash;
|
||||
$CashAccount->frozen_cash -= $applyOrder->apply_cash;
|
||||
$CashAccount->saveOrFail();
|
||||
AccountAbleChangeLogService::logCashAccountAbleChange(
|
||||
(int)$applyOrder->user_id,
|
||||
(int)$applyOrder->user_type,
|
||||
$before,
|
||||
$CashAccount->able_cash,
|
||||
'withdraw',
|
||||
'yii_cash_apply',
|
||||
(int)$applyOrder->id,
|
||||
['order_no' => (string)$applyOrder->order_no, 'remark' => '提现回调失败回退可提现金额']
|
||||
);
|
||||
}
|
||||
$CashAccount->saveOrFail();
|
||||
} else {
|
||||
// 获取代扣订单
|
||||
$chargeCpr = ChargeCashPayRecord::find()->where([
|
||||
|
||||
Reference in New Issue
Block a user