对搜索返回的消息做中英双版本
This commit is contained in:
@@ -149,7 +149,7 @@ final class DepositTier
|
||||
foreach ($items as $idx => $row) {
|
||||
$no = $idx + 1;
|
||||
if (!is_array($row)) {
|
||||
throw new InvalidArgumentException('第 ' . $no . ' 行格式错误');
|
||||
throw new InvalidArgumentException('Row format error');
|
||||
}
|
||||
|
||||
$id = isset($row['id']) && is_string($row['id']) ? trim($row['id']) : '';
|
||||
@@ -157,10 +157,10 @@ final class DepositTier
|
||||
$id = self::generateId();
|
||||
}
|
||||
if (!preg_match('/^[a-zA-Z0-9_\-]{1,32}$/', $id)) {
|
||||
throw new InvalidArgumentException('第 ' . $no . ' 行 ID 非法');
|
||||
throw new InvalidArgumentException('Tier id is invalid');
|
||||
}
|
||||
if (isset($seenId[$id])) {
|
||||
throw new InvalidArgumentException('档位 ID 重复:' . $id);
|
||||
throw new InvalidArgumentException('Duplicate tier id');
|
||||
}
|
||||
$seenId[$id] = true;
|
||||
|
||||
@@ -170,45 +170,45 @@ final class DepositTier
|
||||
$title = self::stringField($row, 'name');
|
||||
}
|
||||
if ($title === '') {
|
||||
throw new InvalidArgumentException('第 ' . $no . ' 行中文充值名称不能为空');
|
||||
throw new InvalidArgumentException('Tier title (zh) is required');
|
||||
}
|
||||
if (mb_strlen($title) > 64) {
|
||||
throw new InvalidArgumentException('第 ' . $no . ' 行中文充值名称过长');
|
||||
throw new InvalidArgumentException('Tier title (zh) is too long');
|
||||
}
|
||||
|
||||
$titleEn = self::stringField($row, 'title_en');
|
||||
if (mb_strlen($titleEn) > 64) {
|
||||
throw new InvalidArgumentException('第 ' . $no . ' 行英文充值名称过长');
|
||||
throw new InvalidArgumentException('Tier title (en) is too long');
|
||||
}
|
||||
|
||||
$currency = self::normalizeCurrency($row['currency'] ?? '');
|
||||
if ($currency === '') {
|
||||
throw new InvalidArgumentException('第 ' . $no . ' 行支付货币不能为空');
|
||||
throw new InvalidArgumentException('Currency is required');
|
||||
}
|
||||
|
||||
$payAmount = self::normalizeAmount($row['pay_amount'] ?? '');
|
||||
if (bccomp($payAmount, '0', 2) <= 0) {
|
||||
throw new InvalidArgumentException('第 ' . $no . ' 行支付货币额度必须大于 0');
|
||||
throw new InvalidArgumentException('Pay amount must be greater than 0');
|
||||
}
|
||||
|
||||
$amount = self::normalizeAmount($row['amount'] ?? '');
|
||||
if (bccomp($amount, '0', 2) <= 0) {
|
||||
throw new InvalidArgumentException('第 ' . $no . ' 行基础平台币到账必须大于 0');
|
||||
throw new InvalidArgumentException('Base credit amount must be greater than 0');
|
||||
}
|
||||
|
||||
$bonus = self::normalizeAmount($row['bonus_amount'] ?? '0');
|
||||
if (bccomp($bonus, '0', 2) < 0) {
|
||||
throw new InvalidArgumentException('第 ' . $no . ' 行赠送金额不能为负数');
|
||||
throw new InvalidArgumentException('Bonus amount cannot be negative');
|
||||
}
|
||||
|
||||
$desc = self::stringField($row, 'desc');
|
||||
if (mb_strlen($desc) > 255) {
|
||||
throw new InvalidArgumentException('第 ' . $no . ' 行中文描述过长');
|
||||
throw new InvalidArgumentException('Description (zh) is too long');
|
||||
}
|
||||
|
||||
$descEn = self::stringField($row, 'desc_en');
|
||||
if (mb_strlen($descEn) > 255) {
|
||||
throw new InvalidArgumentException('第 ' . $no . ' 行英文描述过长');
|
||||
throw new InvalidArgumentException('Description (en) is too long');
|
||||
}
|
||||
|
||||
$sort = isset($row['sort']) && is_numeric($row['sort']) ? intval($row['sort']) : 0;
|
||||
@@ -248,7 +248,7 @@ final class DepositTier
|
||||
{
|
||||
$encoded = json_encode($items, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
||||
if ($encoded === false) {
|
||||
throw new InvalidArgumentException('JSON 编码失败');
|
||||
throw new InvalidArgumentException('JSON encode failed');
|
||||
}
|
||||
return $encoded;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user