支付和加密
This commit is contained in:
@@ -7,6 +7,7 @@ use common\forms\DrugRollBackForm;
|
||||
use common\forms\LedgerForm;
|
||||
use common\jobs\ProductOrderRefundJob;
|
||||
use common\jobs\ProductOrderSyncPlatformJob;
|
||||
use common\models\newDb\AccountBalanceModel;
|
||||
use common\models\oldDb\Callback;
|
||||
use common\models\oldDb\CashAccount;
|
||||
use common\models\oldDb\CashApply;
|
||||
@@ -288,10 +289,15 @@ class EplpayCallbackController extends \yii\web\Controller
|
||||
if(!$applyOrder){
|
||||
throw new Exception('提现申请不存在');
|
||||
}
|
||||
$CashAccount = CashAccount::findOne([
|
||||
'user_type' => $applyOrder->user_type,
|
||||
'user_id' => $applyOrder->user_id
|
||||
]);
|
||||
if ($applyOrder->user_type === 3) {
|
||||
$CashAccount = AccountBalanceModel::find()->where([ 'user_id' => $applyOrder->user_id, 'type' => $applyOrder->user_type])->one();
|
||||
} else {
|
||||
$CashAccount = CashAccount::findOne([
|
||||
'user_type' => $applyOrder->user_type,
|
||||
'user_id' => $applyOrder->user_id
|
||||
]);
|
||||
}
|
||||
|
||||
if(!$CashAccount){
|
||||
throw new Exception('分账账号不存在');
|
||||
}
|
||||
@@ -302,8 +308,13 @@ class EplpayCallbackController extends \yii\web\Controller
|
||||
$applyOrder->dakuan_status = -1;
|
||||
$applyOrder->saveOrFail();
|
||||
|
||||
$CashAccount->able_cash = $CashAccount->able_cash + $applyOrder->apply_cash;
|
||||
$CashAccount->frozen_cash -= $applyOrder->apply_cash;
|
||||
if ($applyOrder->user_type === 3) {
|
||||
$CashAccount->balance = bcadd($CashAccount->balance, $applyOrder->apply_cash, 6);
|
||||
$CashAccount->withdrawn_frozen = bcsub($CashAccount->withdrawn_frozen, $applyOrder->apply_cash, 6);
|
||||
} else {
|
||||
$CashAccount->able_cash = $CashAccount->able_cash + $applyOrder->apply_cash;
|
||||
$CashAccount->frozen_cash -= $applyOrder->apply_cash;
|
||||
}
|
||||
$CashAccount->saveOrFail();
|
||||
} else {
|
||||
// 获取代扣订单
|
||||
@@ -314,12 +325,17 @@ class EplpayCallbackController extends \yii\web\Controller
|
||||
$applyOrder->dakuan_time = date('Y-m-d H:i:s');
|
||||
$applyOrder->saveOrFail();
|
||||
|
||||
$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);
|
||||
if ($applyOrder->user_type === 3) {
|
||||
$CashAccount->withdrawn_frozen = bcsub($CashAccount->withdrawn_frozen, $applyOrder->apply_cash, 6);
|
||||
$CashAccount->withdrawn = bcadd($CashAccount->withdrawn, $applyOrder->apply_cash, 6);
|
||||
$CashAccount->charge = bcadd($CashAccount->charge, $applyOrder->charge_cash, 6);
|
||||
} else {
|
||||
$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,
|
||||
|
||||
Reference in New Issue
Block a user