取消提现手续费-附加一些功能测试

This commit is contained in:
2024-09-29 16:44:06 +08:00
parent 3cca920102
commit 8ffba61ea7
4 changed files with 174 additions and 10 deletions

View File

@@ -93,12 +93,10 @@ class DivideAccountController extends BaseAdminController
$CashAccount->last_apply_time = date('Y-m-d H:i:s', time());
$CashAccount->saveOrFail();
// TODO 暂时关闭手续费
// TODO 暂时关闭手续费 扣除平台的手续费
$pQianliuwu=bcdiv(0.65,100,4);
$pShouxufei=bcadd(bcmul($post['apply_cash'],$pQianliuwu,2),2,3);
$Platform->charge_cash = bcadd($Platform->charge_cash, $pShouxufei, 2);
$Platform->saveOrFail();
$shouxufei = 0;
// $Platform->updateAllCounters(['able_cash'=>1]);
// $Platform->updateAllCounters(['total_cash'=>1]);
@@ -548,10 +546,11 @@ class DivideAccountController extends BaseAdminController
*
* @param $orderNo
* @param $status
* @param string $chargeCash // 在status = 2的时候是冻结金额
* @return void
* @throws Exception
*/
private function updateChargeCashPayRecordStatusByOrderNo($orderNo, $status, $chargeCash)
private function updateChargeCashPayRecordStatusByOrderNo($orderNo, $status, $chargeCash = '')
{
if (empty($orderNo) || empty($status)) throw new Exception('参数错误');
// 记录代付的手续费
@@ -560,21 +559,29 @@ class DivideAccountController extends BaseAdminController
$chargeCpr->saveOrFail();
if ($status == 2) {
if (empty($chargeCash)) {
throw new Exception('充值金额不能为空');
throw new Exception('金额不能为空');
}
$account = CashAccount::find()->where([
'user_id' => $chargeCpr->user_id,
'user_type' => $chargeCpr->user_type
'user_id' => $chargeCpr->store_id,
'user_type' => $chargeCpr->type
])->one();
// 将冻结金额和充值金额进行合并计算,并将结果赋值给可用金额
$account->charge_cash = bcadd($account->frozen_cash, $chargeCpr->charge_cash, 2);
$account->charge_cash = bcadd($account->charge_cash, $chargeCpr->charge_cash, 2);
// 从冻结金额中减去充值金额,并将结果赋值回冻结金额
$account->frozen_cash = bcsub($account->frozen_cash, $chargeCash, 2);
// 减少账户可用余额
$account->able_cash = bcsub($account->able_cash, $chargeCpr->charge_cash, 2);
$account->saveOrFail();
return $account->saveOrFail();
}
// if ($status == 3) {
// $account = CashAccount::find()->where([
// 'user_id' => 0,
// 'user_type' => 2
// ])->one();
// // 将冻结金额和充值金额进行合并计算,并将结果赋值给可用金额
// $account->charge_cash = bcadd($account->charge_cash, $chargeCpr->charge_cash, 2);
// return $account->saveOrFail();
// }
}
/**