对搜索返回的消息做中英双版本

This commit is contained in:
2026-04-28 15:22:50 +08:00
parent 85133ee92b
commit 9bc439ea5e
32 changed files with 575 additions and 183 deletions

View File

@@ -328,50 +328,50 @@ final class FinanceCashierConfig
private static function validate(array $p): void
{
if (!isset($p['platform_coin']) || !is_array($p['platform_coin'])) {
throw new InvalidArgumentException('platform_coin 格式错误');
throw new InvalidArgumentException('platform_coin format error');
}
$lz = $p['platform_coin']['label_zh'] ?? '';
$le = $p['platform_coin']['label_en'] ?? '';
if (!is_string($lz) || trim($lz) === '' || !is_string($le) || trim($le) === '') {
throw new InvalidArgumentException('请填写平台币中英文名称');
throw new InvalidArgumentException('Platform coin labels (zh/en) are required');
}
if (!isset($p['currencies']) || !is_array($p['currencies']) || $p['currencies'] === []) {
throw new InvalidArgumentException('至少保留一条货币');
throw new InvalidArgumentException('At least one currency is required');
}
$seenCodes = [];
foreach ($p['currencies'] as $idx => $row) {
if (!is_array($row)) {
throw new InvalidArgumentException('货币列表第 ' . ($idx + 1) . ' 行格式错误');
throw new InvalidArgumentException('Currency row format error');
}
$code = $row['code'] ?? '';
if (!is_string($code) || !preg_match('/^[A-Z0-9]{2,12}$/', $code)) {
throw new InvalidArgumentException('货币代码非法:' . (is_string($code) ? $code : ''));
throw new InvalidArgumentException('Currency code is invalid');
}
if (isset($seenCodes[$code])) {
throw new InvalidArgumentException('货币代码不能重复:' . $code);
throw new InvalidArgumentException('Duplicate currency code');
}
$seenCodes[$code] = true;
$dep = $row['deposit_coins_per_fiat'] ?? '';
$wdr = $row['withdraw_coins_per_fiat'] ?? '';
if (!is_string($dep) || $dep === '' || !is_numeric($dep) || bccomp($dep, '0', 2) <= 0) {
throw new InvalidArgumentException('第 ' . ($idx + 1) . ' 行:充值汇率须为大于 0 的数字');
throw new InvalidArgumentException('Deposit rate must be a number greater than 0');
}
if (!is_string($wdr) || $wdr === '' || !is_numeric($wdr) || bccomp($wdr, '0', 2) <= 0) {
throw new InvalidArgumentException('第 ' . ($idx + 1) . ' 行:提现汇率须为大于 0 的数字');
throw new InvalidArgumentException('Withdraw rate must be a number greater than 0');
}
}
if (isset($p['withdraw_banks']) && is_array($p['withdraw_banks'])) {
$seen = [];
foreach ($p['withdraw_banks'] as $idx => $row) {
if (!is_array($row)) {
throw new InvalidArgumentException('银行第 ' . ($idx + 1) . ' 行格式错误');
throw new InvalidArgumentException('Bank row format error');
}
$code = $row['code'] ?? '';
if (!is_string($code) || !preg_match('/^[a-z0-9][a-z0-9_\-]{0,31}$/', $code)) {
throw new InvalidArgumentException('银行代码非法');
throw new InvalidArgumentException('Bank code is invalid');
}
if (isset($seen[$code])) {
throw new InvalidArgumentException('银行代码重复:' . $code);
throw new InvalidArgumentException('Duplicate bank code');
}
$seen[$code] = true;
}
@@ -380,13 +380,13 @@ final class FinanceCashierConfig
foreach (['min_ewallet', 'min_bank'] as $k) {
$v = $p['withdraw_limits'][$k] ?? '0';
if (!is_string($v) || !is_numeric($v) || bccomp($v, '0', 2) < 0) {
throw new InvalidArgumentException('提现最低限额须为不小于 0 的数字');
throw new InvalidArgumentException('Withdraw min limit must be a number not less than 0');
}
}
}
$reg = DepositChannel::codeRegistry();
if ($reg !== [] && (!isset($p['channels']) || !is_array($p['channels']) || $p['channels'] === [])) {
throw new InvalidArgumentException('请配置充值渠道');
throw new InvalidArgumentException('Please configure deposit channels');
}
}
}