1.新增获取充值/提现配置接口/api/finance/depositWithdrawConfig

2.优化充值和提现方式
This commit is contained in:
2026-04-23 10:15:01 +08:00
parent 0f28c0fd2a
commit aa1299c018
55 changed files with 901 additions and 750 deletions

View File

@@ -232,7 +232,7 @@ class User extends Backend
if ($amountText === '' || !is_numeric($amountText)) {
return $this->error('金额格式不正确');
}
if (bccomp($amountText, '0', 4) <= 0) {
if (bccomp($amountText, '0', 2) <= 0) {
return $this->error('金额必须大于0');
}
@@ -267,16 +267,16 @@ class User extends Backend
}
$before = strval($user['coin'] ?? '0');
$delta = self::normalizeAmountScale($amountText, 4);
$delta = self::normalizeAmountScale($amountText, 2);
if ($op === 'credit') {
$after = bcadd($before, $delta, 4);
$after = bcadd($before, $delta, 2);
$bizType = 'admin_credit';
$direction = 1;
} else {
if (bccomp($before, $delta, 4) < 0) {
if (bccomp($before, $delta, 2) < 0) {
return $this->error('余额不足,扣点失败');
}
$after = bcsub($before, $delta, 4);
$after = bcsub($before, $delta, 2);
$bizType = 'admin_deduct';
$direction = 2;
}
@@ -365,7 +365,7 @@ class User extends Backend
private static function formatAmountForDisplay(string $amount): string
{
$normalized = self::normalizeAmountScale($amount, 4);
$normalized = self::normalizeAmountScale($amount, 2);
$negative = false;
if (str_starts_with($normalized, '-')) {
$negative = true;