fix(withdraw): 修复提现台账导出PHP8兼容性与页面崩溃问题,统一大余额与导出体验
这个提交包含在:
@@ -89,9 +89,10 @@ class Withdraw extends Common
|
||||
|
||||
public function getChargeRateFormatAttr($value, $data)
|
||||
{
|
||||
$value = $value ?: ($data['charge_rate'] ?? null);
|
||||
$rate = $value !== null && $value !== '' ? $value : ($data['charge_rate'] ?? 0);
|
||||
$rate = is_numeric($rate) ? (string)$rate : '0';
|
||||
|
||||
return bcmul((string)$value, '100', 1) . '%';
|
||||
return function_exists('bcmul') ? (bcmul($rate, '100', 1) . '%') : (round(floatval($rate) * 100, 1) . '%');
|
||||
}
|
||||
|
||||
public function getIsMadowWithdrawAttr($value, $data)
|
||||
@@ -117,14 +118,16 @@ class Withdraw extends Common
|
||||
return false;
|
||||
}
|
||||
return (isset($info['wallet_type']) && $info['wallet_type'] === 'money')
|
||||
|| (isset($info['提现资产']) && $info['提现资产'] === '商城余额');
|
||||
|| (isset($info['提现资产']) && in_array($info['提现资产'], ['钱包余额', '商城余额'], true));
|
||||
}
|
||||
|
||||
public function getRealAmountAttr($value, $data)
|
||||
{
|
||||
$amount = $data['amount'] ?? ($this->amount ?? 0);
|
||||
$chargeFee = $data['charge_fee'] ?? ($this->charge_fee ?? 0);
|
||||
$real = bcsub((string)$amount, (string)$chargeFee, 2);
|
||||
$amount = isset($data['amount']) && is_numeric($data['amount']) ? (string)$data['amount'] : (string)($this->amount ?? '0');
|
||||
$chargeFee = isset($data['charge_fee']) && is_numeric($data['charge_fee']) ? (string)$data['charge_fee'] : (string)($this->charge_fee ?? '0');
|
||||
$amount = is_numeric($amount) ? $amount : '0';
|
||||
$chargeFee = is_numeric($chargeFee) ? $chargeFee : '0';
|
||||
$real = function_exists('bcsub') ? bcsub($amount, $chargeFee, 2) : number_format(floatval($amount) - floatval($chargeFee), 2, '.', '');
|
||||
return max(0, floatval($real));
|
||||
}
|
||||
|
||||
@@ -142,7 +145,7 @@ class Withdraw extends Common
|
||||
$isMadow = (isset($info['wallet_type']) && $info['wallet_type'] === 'madow')
|
||||
|| (isset($info['提现资产']) && strcasecmp($info['提现资产'], 'dmepa') === 0);
|
||||
$isMoney = (isset($info['wallet_type']) && $info['wallet_type'] === 'money')
|
||||
|| (isset($info['提现资产']) && $info['提现资产'] === '商城余额');
|
||||
|| (isset($info['提现资产']) && in_array($info['提现资产'], ['钱包余额', '商城余额'], true));
|
||||
|
||||
if ($isMadow) {
|
||||
$display['提现资产'] = 'DMEPA';
|
||||
@@ -177,18 +180,23 @@ class Withdraw extends Common
|
||||
// 手续费与预计到账
|
||||
$chargeFee = $data['charge_fee'] ?? ($this->charge_fee ?? ($info['charge_fee'] ?? 0));
|
||||
$chargeRate = $data['charge_rate'] ?? ($this->charge_rate ?? ($info['charge_rate'] ?? 0));
|
||||
$chargeFee = is_numeric($chargeFee) ? (string)$chargeFee : '0';
|
||||
$chargeRate = is_numeric($chargeRate) ? (string)$chargeRate : '0';
|
||||
if (floatval($chargeFee) > 0 || floatval($chargeRate) > 0) {
|
||||
$ratePercent = bcmul((string)$chargeRate, '100', 1);
|
||||
$ratePercent = function_exists('bcmul') ? bcmul($chargeRate, '100', 1) : round(floatval($chargeRate) * 100, 1);
|
||||
$display['提现手续费'] = number_format(floatval($chargeFee), 2, '.', '') . ' 元 (' . $ratePercent . '%)';
|
||||
}
|
||||
$amount = $data['amount'] ?? ($this->amount ?? 0);
|
||||
$real = bcsub((string)$amount, (string)$chargeFee, 2);
|
||||
$amount = is_numeric($amount) ? (string)$amount : '0';
|
||||
$real = function_exists('bcsub') ? bcsub($amount, $chargeFee, 2) : number_format(floatval($amount) - floatval($chargeFee), 2, '.', '');
|
||||
$display['预计到账'] = number_format(max(0, floatval($real)), 2, '.', '') . ' 元';
|
||||
} elseif ($isMoney) {
|
||||
$display['提现资产'] = '商城余额';
|
||||
$display['提现资产'] = '钱包余额';
|
||||
$amount = $data['amount'] ?? ($this->amount ?? 0);
|
||||
$chargeFee = $data['charge_fee'] ?? ($this->charge_fee ?? 0);
|
||||
$real = bcsub((string)$amount, (string)$chargeFee, 2);
|
||||
$amount = is_numeric($amount) ? (string)$amount : '0';
|
||||
$chargeFee = is_numeric($chargeFee) ? (string)$chargeFee : '0';
|
||||
$real = function_exists('bcsub') ? bcsub($amount, $chargeFee, 2) : number_format(floatval($amount) - floatval($chargeFee), 2, '.', '');
|
||||
$display['预计到账'] = number_format(max(0, floatval($real)), 2, '.', '') . ' 元';
|
||||
}
|
||||
|
||||
|
||||
@@ -119,13 +119,13 @@ class Reward extends Common
|
||||
{
|
||||
$type = $this->getWalletTypeAttr(null, $data);
|
||||
$map = [
|
||||
'money' => '商城余额',
|
||||
'money' => '钱包余额',
|
||||
'commission' => '佣金钱包',
|
||||
'voucher' => '消费补贴券',
|
||||
'madow' => '分红dmepa',
|
||||
'system' => '平台留存',
|
||||
];
|
||||
return $map[$type] ?? '商城余额';
|
||||
return $map[$type] ?? '钱包余额';
|
||||
}
|
||||
|
||||
public function buyer()
|
||||
|
||||
在新工单中引用
屏蔽一个用户