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

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

@@ -574,7 +574,7 @@ class Channel extends Backend
}
$rowsRaw = $request->post('list', []);
if (!is_array($rowsRaw) || $rowsRaw === []) {
return $this->error('请至少配置一条分配记录');
return $this->error(__('Please configure at least one share record'));
}
$adminIds = Db::name('admin')
@@ -585,7 +585,7 @@ class Channel extends Backend
$adminIdSet[(int) $adminId] = true;
}
if ($adminIdSet === []) {
return $this->error('该渠道下暂无管理员,无法配置分配比例');
return $this->error(__('There are no admins under this channel; cannot configure share ratios'));
}
$enabledSum = '0.00';
@@ -602,7 +602,7 @@ class Channel extends Backend
$shareRaw = $line['share_rate'] ?? null;
$shareRate = self::normalizeAmountScale($shareRaw === null ? '0' : (string) $shareRaw, 2);
if (bccomp($shareRate, '0', 2) < 0 || bccomp($shareRate, '100', 2) > 0) {
return $this->error('分配比例必须在0到100之间');
return $this->error(__('Share ratio must be between 0 and 100'));
}
if ($status === 1) {
$enabledSum = bcadd($enabledSum, $shareRate, 2);
@@ -617,10 +617,10 @@ class Channel extends Backend
];
}
if ($insertRows === []) {
return $this->error('请至少配置一条有效分配记录');
return $this->error(__('Please configure at least one valid share record'));
}
if (bccomp($enabledSum, '100.00', 2) !== 0) {
return $this->error('启用的分配比例总和必须等于100');
return $this->error(__('Sum of enabled share ratios must equal 100'));
}
Db::startTrans();
@@ -633,7 +633,7 @@ class Channel extends Backend
return $this->error($e->getMessage());
}
return $this->success('分配比例保存成功');
return $this->success(__('Share ratios saved successfully'));
}
/**
@@ -646,7 +646,7 @@ class Channel extends Backend
return $response;
}
if (!$this->auth->isSuperAdmin()) {
return $this->error('仅超管可执行结算,结算后系统会自动发放至管理员钱包');
return $this->error(__('Only super admin can settle; after settlement, commissions will be automatically paid to admin wallets'));
}
$id = (int) ($request->post('id', $request->get('id', 0)));
@@ -665,9 +665,9 @@ class Channel extends Backend
$res = ChannelSettlementService::settleBySuperAdmin((int) $row['id'], intval($this->auth->id), $remark, false);
if (($res['ok'] ?? false) !== true) {
return $this->error((string) ($res['msg'] ?? '结算失败'));
return $this->error((string) ($res['msg'] ?? __('Settlement failed')));
}
return $this->success('超管结算完成,已按分配比例自动发放给管理员');
return $this->success(__('Super admin settlement completed; paid automatically by share ratios'));
}
/**
@@ -684,7 +684,7 @@ class Channel extends Backend
}
// 批量按钮语义:手动触发“待结算渠道”结算,不受结算周期到点限制。
$res = ChannelSettlementService::settleAllDueChannels(intval($this->auth->id), false);
return $this->success('批量结算完成', $res);
return $this->success(__('Batch settlement completed'), $res);
}
/**
@@ -738,7 +738,7 @@ class Channel extends Backend
{
$channelId = (int) ($row['id'] ?? 0);
if ($channelId <= 0) {
return '渠道数据异常';
return (string) __('Invalid channel data');
}
$endTs = time();
@@ -751,7 +751,7 @@ class Channel extends Backend
}
if ($periodStartTs >= $endTs) {
return '结算区间无效(开始时间不早于当前)';
return (string) __('Invalid settlement period (start time is not earlier than now)');
}
$stats = $this->aggregateBetOrderForChannel($channelId, $periodStartTs, $lastEnd !== null, $endTs);
@@ -864,7 +864,7 @@ class Channel extends Backend
if ($mode === 'turnover') {
$ratePercent = $row['turnover_share_rate'] ?? null;
if ($ratePercent === null || $ratePercent === '') {
return '普通返水代理未配置返水分红比例';
return (string) __('Turnover agent commission rate is not configured');
}
$rateDec = bcdiv((string) $ratePercent, '100', 2);
$amount = bcmul($totalBet, $rateDec, 2);
@@ -879,11 +879,11 @@ class Channel extends Backend
$fee = $row['affiliate_fee_rate'] ?? null;
$rulesRaw = $row['affiliate_ladder_rules'] ?? null;
if ($fee === null || $fee === '') {
return '联营代理未配置成本扣除比例';
return (string) __('Affiliate agent fee rate is not configured');
}
$rules = $this->normalizeLadderRulesForSettlement($rulesRaw);
if ($rules === []) {
return '联营阶梯规则无效或为空';
return (string) __('Affiliate ladder rules are empty or invalid');
}
if (bccomp($platformProfit, '0', 2) <= 0) {
@@ -915,7 +915,7 @@ class Channel extends Backend
];
}
return '未知的代理模式';
return (string) __('Unknown agent mode');
}
/**
@@ -1169,20 +1169,20 @@ class Channel extends Backend
{
$cycle = isset($data['settle_cycle']) ? trim((string) $data['settle_cycle']) : 'weekly';
if (!in_array($cycle, ['daily', 'weekly', 'monthly'], true)) {
return '结算周期不合法';
return (string) __('Invalid settlement cycle');
}
$data['settle_cycle'] = $cycle;
$settleTime = isset($data['settle_time']) ? trim((string) $data['settle_time']) : '02:00:00';
if (!preg_match('/^\d{2}:\d{2}:\d{2}$/', $settleTime)) {
return '结算时间格式不正确(HH:mm:ss';
return (string) __('Invalid settlement time format (HH:mm:ss)');
}
$data['settle_time'] = $settleTime;
if ($cycle === 'weekly') {
$weekday = isset($data['settle_weekday']) ? (int) $data['settle_weekday'] : 1;
if ($weekday < 1 || $weekday > 7) {
return '周结必须选择周一到周日';
return (string) __('Weekly settlement must select Monday to Sunday');
}
$data['settle_weekday'] = $weekday;
} else {
@@ -1192,7 +1192,7 @@ class Channel extends Backend
if ($cycle === 'monthly') {
$monthday = isset($data['settle_monthday']) ? (int) $data['settle_monthday'] : 1;
if ($monthday < 1 || $monthday > 31) {
return '月结日期必须在1到31之间';
return (string) __('Monthly settlement day must be between 1 and 31');
}
$data['settle_monthday'] = $monthday;
} else {
@@ -1204,7 +1204,7 @@ class Channel extends Backend
if (isset($data['turnover_share_rate']) && $data['turnover_share_rate'] !== '' && $data['turnover_share_rate'] !== null) {
$num = (float) $data['turnover_share_rate'];
if ($num < 0 || $num > 100) {
return '返水分红比例必须在0到100之间';
return (string) __('Turnover commission rate must be between 0 and 100');
}
}
return null;
@@ -1213,11 +1213,11 @@ class Channel extends Backend
if ($mode === 'affiliate') {
foreach (['affiliate_share_rate' => '联营占成比例', 'affiliate_fee_rate' => '联营成本扣除比例'] as $field => $label) {
if (!isset($data[$field]) || $data[$field] === '' || $data[$field] === null) {
return $label . '不能为空';
return (string) __('Affiliate share/fee rates are required');
}
$num = (float) $data[$field];
if ($num < 0 || $num > 1) {
return $label . '必须在0到1之间';
return (string) __('Affiliate share/fee rates must be between 0 and 1');
}
}
$ladderErr = $this->validateLadderRulesField($data);
@@ -1262,45 +1262,45 @@ class Channel extends Backend
{
$rulesRaw = $data['affiliate_ladder_rules'] ?? null;
if ($rulesRaw === null || $rulesRaw === '') {
return '联营阶梯规则不能为空';
return (string) __('Affiliate ladder rules are required');
}
if (is_string($rulesRaw)) {
$decoded = json_decode($rulesRaw, true);
if (!is_array($decoded)) {
return '联营阶梯规则必须是有效JSON数组';
return (string) __('Affiliate ladder rules must be a valid JSON array');
}
$rulesRaw = $decoded;
}
if (!is_array($rulesRaw) || $rulesRaw === []) {
return '联营阶梯规则至少需要一条';
return (string) __('Affiliate ladder rules must contain at least one row');
}
$normalized = [];
$prevMinLoss = null;
foreach ($rulesRaw as $idx => $rule) {
if (!is_array($rule)) {
return '联营阶梯规则第' . ($idx + 1) . '行格式错误';
return (string) __('Affiliate ladder rules row format error') . ' #' . ($idx + 1);
}
$minLoss = $rule['minLoss'] ?? ($rule['min_loss'] ?? null);
$shareRate = $rule['shareRate'] ?? ($rule['share_rate'] ?? null);
if ($minLoss === null || $minLoss === '' || !is_numeric((string) $minLoss)) {
return '联营阶梯规则第' . ($idx + 1) . '行起始客损格式错误';
return (string) __('Affiliate ladder rules minLoss format error') . ' #' . ($idx + 1);
}
if ($shareRate === null || $shareRate === '' || !is_numeric((string) $shareRate)) {
return '联营阶梯规则第' . ($idx + 1) . '行占成比例格式错误';
return (string) __('Affiliate ladder rules shareRate format error') . ' #' . ($idx + 1);
}
$minLossNum = (float) $minLoss;
$shareRateNum = (float) $shareRate;
if ($minLossNum < 0) {
return '联营阶梯规则第' . ($idx + 1) . '行起始客损不能为负';
return (string) __('Affiliate ladder rules minLoss cannot be negative') . ' #' . ($idx + 1);
}
if ($shareRateNum < 0 || $shareRateNum > 1) {
return '联营阶梯规则第' . ($idx + 1) . '行占成比例必须在0到1之间';
return (string) __('Affiliate ladder rules shareRate must be between 0 and 1') . ' #' . ($idx + 1);
}
if ($prevMinLoss !== null && $minLossNum <= $prevMinLoss) {
return '联营阶梯规则需按起始客损递增';
return (string) __('Affiliate ladder rules must be strictly increasing by minLoss');
}
$prevMinLoss = $minLossNum;
$normalized[] = [

View File

@@ -81,17 +81,17 @@ class AdminWallet extends Backend
protected function _add(): Response
{
return $this->error('管理员钱包不允许手动新增');
return $this->error(__('Admin wallet does not allow manual creation'));
}
protected function _edit(): Response
{
return $this->error('管理员钱包不允许手动编辑');
return $this->error(__('Admin wallet does not allow manual editing'));
}
protected function _del(): Response
{
return $this->error('管理员钱包不允许删除');
return $this->error(__('Admin wallet does not allow deletion'));
}
}

View File

@@ -63,17 +63,17 @@ class AdminWalletRecord extends Backend
protected function _add(): Response
{
return $this->error('管理员钱包流水不允许手动新增');
return $this->error(__('Admin wallet records do not allow manual creation'));
}
protected function _edit(): Response
{
return $this->error('管理员钱包流水不允许手动编辑');
return $this->error(__('Admin wallet records do not allow manual editing'));
}
protected function _del(): Response
{
return $this->error('管理员钱包流水不允许删除');
return $this->error(__('Admin wallet records do not allow deletion'));
}
}

View File

@@ -152,7 +152,7 @@ class Admin extends Backend
}
$data = $this->normalizeSingleGroup($data);
if (!$this->hasSingleGroup($data['group_arr'] ?? null)) {
return $this->error('请选择且仅选择一个角色组');
return $this->error(__('Please select exactly one role group'));
}
if ($this->modelValidate) {
@@ -184,10 +184,10 @@ class Admin extends Backend
return $this->error(__('You have no permission'));
}
if ($groupChannelId === null || $groupChannelId === '') {
return $this->error('所选角色组未绑定渠道');
return $this->error(__('Selected role group is not bound to a channel'));
}
if ((string) $groupChannelId !== (string) $creatorChannelId) {
return $this->error('所选角色组渠道与当前账号不一致');
return $this->error(__('Selected role group channel does not match current account'));
}
$data['channel_id'] = $creatorChannelId;
$data['parent_admin_id'] = $this->auth->id;
@@ -255,7 +255,7 @@ class Admin extends Backend
}
$data = $this->normalizeSingleGroup($data);
if (!$this->hasSingleGroup($data['group_arr'] ?? null)) {
return $this->error('请选择且仅选择一个角色组');
return $this->error(__('Please select exactly one role group'));
}
$postedGroups = array_map('intval', $data['group_arr'] ?? []);
@@ -331,10 +331,10 @@ class Admin extends Backend
return $this->error(__('You have no permission'));
}
if ($groupChannelId === null || $groupChannelId === '') {
return $this->error('所选角色组未绑定渠道');
return $this->error(__('Selected role group is not bound to a channel'));
}
if ((string) $groupChannelId !== (string) $creatorChannelId) {
return $this->error('所选角色组渠道与当前账号不一致');
return $this->error(__('Selected role group channel does not match current account'));
}
$data['channel_id'] = $creatorChannelId;
} else {

View File

@@ -231,7 +231,7 @@ class DepositChannel extends Backend
}
$items = $payload['items'] ?? null;
if (!is_array($items)) {
return $this->error('items 必须为数组');
return $this->error(__('Items must be an array'));
}
return $this->persistChannelList($items);
@@ -250,7 +250,7 @@ class DepositChannel extends Backend
$got = array_column($clean, 'code');
sort($got);
if ($expectedCodes !== $got) {
return $this->error('请保存全部已注册渠道行(不可缺行)');
return $this->error(__('Please save all registered channel rows (no missing rows)'));
}
$json = DepositChannelLib::encodeForDb($clean);
} catch (InvalidArgumentException $e) {
@@ -261,7 +261,7 @@ class DepositChannel extends Backend
$resourceKey = GameHotDataLock::safeResourceKeyForConfig(DepositChannelLib::CONFIG_KEY);
$lock = GameHotDataLock::tryAcquire(GameHotDataLock::TYPE_GAME_CONFIG, $resourceKey);
if (!$lock['acquired']) {
return $this->error('该配置正在被其他操作占用,请稍后再试');
return $this->error(__('This config is locked by another operation, please try again later'));
}
try {
try {

View File

@@ -264,7 +264,7 @@ class DepositTier extends Backend
}
$rid = $it['id'] ?? '';
if (is_string($rid) && $rid === $newId) {
return $this->error('档位 ID 已存在');
return $this->error(__('Tier ID already exists'));
}
}
$items[] = $this->normalizeFormRow($payload, $newId);
@@ -342,7 +342,7 @@ class DepositTier extends Backend
}
$items = $payload['items'] ?? null;
if (!is_array($items)) {
return $this->error('items 必须为数组');
return $this->error(__('Items must be an array'));
}
return $this->persistTierList($items);
@@ -364,7 +364,7 @@ class DepositTier extends Backend
$resourceKey = GameHotDataLock::safeResourceKeyForConfig(DepositTierLib::CONFIG_KEY);
$lock = GameHotDataLock::tryAcquire(GameHotDataLock::TYPE_GAME_CONFIG, $resourceKey);
if (!$lock['acquired']) {
return $this->error('该配置正在被其他操作占用,请稍后再试');
return $this->error(__('This config is locked by another operation, please try again later'));
}
try {
try {

View File

@@ -119,7 +119,7 @@ class FinanceCashierConfig extends Backend
$resourceKey = GameHotDataLock::safeResourceKeyForConfig(FinanceCashierConfigLib::CONFIG_KEY);
$lock = GameHotDataLock::tryAcquire(GameHotDataLock::TYPE_GAME_CONFIG, $resourceKey);
if (!$lock['acquired']) {
return $this->error('该配置正在被其他操作占用,请稍后再试');
return $this->error(__('This config is locked by another operation, please try again later'));
}
try {
try {

View File

@@ -88,14 +88,14 @@ class StreakWinReward extends Backend
}
$payload = $request->post('rows');
if (!is_array($payload)) {
return $this->error('参数错误');
return $this->error(__('Invalid parameters'));
}
$encoded = StreakWinRewardLib::encodeForDb($payload);
$now = time();
$resourceKey = GameHotDataLock::safeResourceKeyForConfig(StreakWinRewardLib::CONFIG_KEY);
$lock = GameHotDataLock::tryAcquire(GameHotDataLock::TYPE_GAME_CONFIG, $resourceKey);
if (!$lock['acquired']) {
return $this->error('该配置正在被其他操作占用,请稍后再试');
return $this->error(__('This config is locked by another operation, please try again later'));
}
try {
Db::startTrans();
@@ -125,7 +125,7 @@ class StreakWinReward extends Backend
StreakWinRewardLib::clearCache();
GameHotDataCoordinator::afterGameConfigKeyCommitted(StreakWinRewardLib::CONFIG_KEY);
return $this->success('保存成功');
return $this->success(__('Saved successfully'));
} finally {
GameHotDataLock::release(GameHotDataLock::TYPE_GAME_CONFIG, $resourceKey, $lock['token'], $lock['redis_lock']);
}

View File

@@ -95,7 +95,7 @@ class ZiHuaDictionary extends Backend
}
$items = $payload['items'] ?? null;
if (!is_array($items)) {
return $this->error('items 必须为数组');
return $this->error(__('Items must be an array'));
}
try {
$clean = ZiHuaDictionaryLib::prepareItemsForSave($items);
@@ -108,7 +108,7 @@ class ZiHuaDictionary extends Backend
$resourceKey = GameHotDataLock::safeResourceKeyForConfig(ZiHuaDictionaryLib::CONFIG_KEY);
$lock = GameHotDataLock::tryAcquire(GameHotDataLock::TYPE_GAME_CONFIG, $resourceKey);
if (!$lock['acquired']) {
return $this->error('该配置正在被其他操作占用,请稍后再试');
return $this->error(__('This config is locked by another operation, please try again later'));
}
try {
try {

View File

@@ -35,7 +35,7 @@ class PlayRecord extends Backend
if ($response !== null) {
return $response;
}
return $this->error('游玩记录由游戏接口生成,禁止后台手工新增');
return $this->error(__('Play record is generated by game API; manual creation is not allowed'));
}
public function edit(WebmanRequest $request): Response
@@ -44,7 +44,7 @@ class PlayRecord extends Backend
if ($response !== null) {
return $response;
}
return $this->error('游玩记录不可编辑');
return $this->error(__('Play record cannot be edited'));
}
public function del(WebmanRequest $request): Response
@@ -53,7 +53,7 @@ class PlayRecord extends Backend
if ($response !== null) {
return $response;
}
return $this->error('游玩记录不可删除');
return $this->error(__('Play record cannot be deleted'));
}
public function sortable(WebmanRequest $request): Response
@@ -62,7 +62,7 @@ class PlayRecord extends Backend
if ($response !== null) {
return $response;
}
return $this->error('不支持排序');
return $this->error(__('Sorting is not supported'));
}
protected function _index(): Response

View File

@@ -38,7 +38,7 @@ class Record extends Backend
if ($response !== null) {
return $response;
}
return $this->error('游戏对局记录由系统自动生成,禁止后台手工新增');
return $this->error(__('Game record is generated by system; manual creation is not allowed'));
}
public function edit(WebmanRequest $request): Response
@@ -48,7 +48,7 @@ class Record extends Backend
return $response;
}
if ($request->method() === 'POST') {
return $this->error('游戏对局记录不可编辑');
return $this->error(__('Game record cannot be edited'));
}
$pk = $this->model->getPk();
$id = $request->get($pk);
@@ -65,7 +65,7 @@ class Record extends Backend
if ($response !== null) {
return $response;
}
return $this->error('游戏对局记录不可删除');
return $this->error(__('Game record cannot be deleted'));
}
public function abnormalList(WebmanRequest $request): Response

View File

@@ -81,7 +81,7 @@ class ZiHuaDictionary extends Backend
}
$items = $payload['items'] ?? null;
if (!is_array($items)) {
return $this->error('items 必须为数组');
return $this->error(__('Items must be an array'));
}
try {
$clean = ZiHuaDictionaryLib::prepareItemsForSave($items);
@@ -94,7 +94,7 @@ class ZiHuaDictionary extends Backend
$resourceKey = GameHotDataLock::safeResourceKeyForConfig(ZiHuaDictionaryLib::CONFIG_KEY);
$lock = GameHotDataLock::tryAcquire(GameHotDataLock::TYPE_GAME_CONFIG, $resourceKey);
if (!$lock['acquired']) {
return $this->error('该配置正在被其他操作占用,请稍后再试');
return $this->error(__('This config is locked by another operation, please try again later'));
}
try {
try {

View File

@@ -78,7 +78,7 @@ class AdminWithdrawOrder extends Backend
return $this->error(__('Parameter error'));
}
if ($this->request && $this->request->method() === 'POST') {
return $this->error('请使用通过/拒绝按钮审核');
return $this->error(__('Please use approve/reject buttons to review'));
}
$row = $this->loadWithRelations(intval(strval($id)));
if (!$row) {
@@ -111,7 +111,7 @@ class AdminWithdrawOrder extends Backend
return $this->error(__('You have no permission'));
}
if (intval($order['status'] ?? 0) !== 0) {
return $this->error('该提现订单已审核');
return $this->error(__('This withdraw order has already been reviewed'));
}
$remark = trim((string) $request->post('remark', ''));
Db::startTrans();
@@ -122,7 +122,7 @@ class AdminWithdrawOrder extends Backend
Db::rollback();
return $this->error($e->getMessage());
}
return $this->success('审核通过');
return $this->success(__('Approved'));
}
public function reject(WebmanRequest $request): Response
@@ -140,7 +140,7 @@ class AdminWithdrawOrder extends Backend
}
$remark = trim((string) $request->post('remark', ''));
if ($remark === '') {
return $this->error('请填写拒绝原因');
return $this->error(__('Please provide reject reason'));
}
$order = Db::name('admin_withdraw_order')->where('id', $id)->find();
if (!is_array($order)) {
@@ -150,7 +150,7 @@ class AdminWithdrawOrder extends Backend
return $this->error(__('You have no permission'));
}
if (intval($order['status'] ?? 0) !== 0) {
return $this->error('该提现订单已审核');
return $this->error(__('This withdraw order has already been reviewed'));
}
Db::startTrans();
try {
@@ -160,7 +160,7 @@ class AdminWithdrawOrder extends Backend
Db::rollback();
return $this->error($e->getMessage());
}
return $this->success('审核拒绝完成');
return $this->success(__('Rejected'));
}
public function stats(WebmanRequest $request): Response

View File

@@ -35,7 +35,7 @@ class BetOrder extends Backend
if ($response !== null) {
return $response;
}
return $this->error('注单由游戏接口生成,禁止后台手工新增');
return $this->error(__('Bet order is generated by game API; manual creation is not allowed'));
}
public function edit(WebmanRequest $request): Response
@@ -44,7 +44,7 @@ class BetOrder extends Backend
if ($response !== null) {
return $response;
}
return $this->error('注单不可编辑');
return $this->error(__('Bet order cannot be edited'));
}
public function del(WebmanRequest $request): Response
@@ -53,7 +53,7 @@ class BetOrder extends Backend
if ($response !== null) {
return $response;
}
return $this->error('注单不可删除');
return $this->error(__('Bet order cannot be deleted'));
}
public function sortable(WebmanRequest $request): Response
@@ -62,7 +62,7 @@ class BetOrder extends Backend
if ($response !== null) {
return $response;
}
return $this->error('不支持排序');
return $this->error(__('Sorting is not supported'));
}
/**

View File

@@ -93,7 +93,7 @@ class DepositOrder extends Backend
}
if ($this->request && $this->request->method() === 'POST') {
return $this->error('充值订单为自动入账,禁止直接修改,如需补单请走专用工具');
return $this->error(__('Deposit orders are auto-settled; direct modification is not allowed. Use the dedicated tool for manual adjustment.'));
}
$row = $this->loadWithRelations(intval(strval($id)));

View File

@@ -84,7 +84,7 @@ class WithdrawOrder extends Backend
if ($this->request && $this->request->method() === 'POST') {
// 历史 CRUD 的 POST 编辑已被 approve/reject 替代,这里阻止直接改金额绕过审核流程
return $this->error('请使用通过/拒绝按钮完成审核');
return $this->error(__('Please use approve/reject buttons to complete the review'));
}
$row = $this->loadWithRelations(intval(strval($id)));
@@ -119,13 +119,13 @@ class WithdrawOrder extends Backend
$newAmount = $this->decimalParam($request->post('amount'), '0');
$newFee = $this->decimalParam($request->post('fee'), '0');
if (bccomp($newAmount, '0', 2) <= 0) {
return $this->error('申请金额必须大于 0');
return $this->error(__('Apply amount must be greater than 0'));
}
if (bccomp($newFee, '0', 2) < 0) {
return $this->error('手续费不能为负');
return $this->error(__('Fee cannot be negative'));
}
if (bccomp($newFee, $newAmount, 2) > 0) {
return $this->error('手续费不能大于申请金额');
return $this->error(__('Fee cannot be greater than apply amount'));
}
$newActual = bcsub($newAmount, $newFee, 2);
@@ -141,12 +141,12 @@ class WithdrawOrder extends Backend
}
$currentStatus = $this->intParam($order['status'] ?? 0);
if ($currentStatus !== 0) {
return $this->error('该订单已审核,无需重复操作');
return $this->error(__('This order has already been reviewed'));
}
$userId = $this->intParam($order['user_id'] ?? 0);
if ($userId <= 0) {
return $this->error('订单缺少用户信息');
return $this->error(__('Order is missing user info'));
}
$oldAmount = bcadd(strval($order['amount'] ?? '0'), '0', 2);
$diff = bcsub($newAmount, $oldAmount, 2);
@@ -173,12 +173,12 @@ class WithdrawOrder extends Backend
$userRow = Db::name('user')->where('id', $userId)->find();
if (!$userRow) {
Db::rollback();
return $this->error('关联用户不存在');
return $this->error(__('Related user does not exist'));
}
$beforeCoin = bcadd(strval($userRow['coin'] ?? '0'), '0', 2);
if (bccomp($beforeCoin, $diff, 2) < 0) {
Db::rollback();
return $this->error('用户余额不足以补扣调整差额');
return $this->error(__('User balance is insufficient to cover the adjustment difference'));
}
$afterCoin = bcsub($beforeCoin, $diff, 2);
Db::name('user')->where('id', $userId)->update([
@@ -208,7 +208,7 @@ class WithdrawOrder extends Backend
$userRow = Db::name('user')->where('id', $userId)->find();
if (!$userRow) {
Db::rollback();
return $this->error('关联用户不存在');
return $this->error(__('Related user does not exist'));
}
$beforeCoin = bcadd(strval($userRow['coin'] ?? '0'), '0', 2);
$afterCoin = bcadd($beforeCoin, $abs, 2);
@@ -251,7 +251,7 @@ class WithdrawOrder extends Backend
return $this->error($e->getMessage());
}
return $this->success('审核通过', [
return $this->success(__('Approved'), [
'id' => $id,
'amount' => $newAmount,
'fee' => $newFee,
@@ -281,7 +281,7 @@ class WithdrawOrder extends Backend
$remarkRaw = $request->post('remark');
$remark = is_string($remarkRaw) ? trim($remarkRaw) : '';
if ($remark === '') {
return $this->error('请填写拒绝原因');
return $this->error(__('Please provide reject reason'));
}
$order = Db::name('withdraw_order')->where('id', $id)->find();
@@ -293,12 +293,12 @@ class WithdrawOrder extends Backend
}
$currentStatus = $this->intParam($order['status'] ?? 0);
if ($currentStatus !== 0) {
return $this->error('该订单已审核,无需重复操作');
return $this->error(__('This order has already been reviewed'));
}
$userId = $this->intParam($order['user_id'] ?? 0);
if ($userId <= 0) {
return $this->error('订单缺少用户信息');
return $this->error(__('Order is missing user info'));
}
$amount = bcadd(strval($order['amount'] ?? '0'), '0', 2);
$channelIdRaw = $order['channel_id'] ?? null;
@@ -315,7 +315,7 @@ class WithdrawOrder extends Backend
$userRow = Db::name('user')->where('id', $userId)->find();
if (!$userRow) {
Db::rollback();
return $this->error('关联用户不存在');
return $this->error(__('Related user does not exist'));
}
$beforeCoin = bcadd(strval($userRow['coin'] ?? '0'), '0', 2);
$afterCoin = bcadd($beforeCoin, $amount, 2);
@@ -355,7 +355,7 @@ class WithdrawOrder extends Backend
return $this->error($e->getMessage());
}
return $this->success('审核已拒绝', [
return $this->success(__('Rejected'), [
'id' => $id,
'status' => 2,
'remark' => $remark,

View File

@@ -164,18 +164,18 @@ class AdminInfo extends Backend
$receiveType = trim(is_string($request->post('receive_type', '')) ? $request->post('receive_type', '') : '');
$idempotencyKey = trim(is_string($request->post('idempotency_key', '')) ? $request->post('idempotency_key', '') : '');
if ($withdrawCoin === '' || $receiveAccount === '' || $receiveType === '' || $idempotencyKey === '') {
return $this->error('参数缺失');
return $this->error(__('Missing required parameters'));
}
if (mb_strlen($idempotencyKey) > 64) {
return $this->error('幂等键过长');
return $this->error(__('Idempotency key is too long'));
}
if (!is_numeric($withdrawCoin) || bccomp($withdrawCoin, '0', 2) <= 0) {
return $this->error('提现金额必须大于0');
return $this->error(__('Withdraw amount must be greater than 0'));
}
$withdrawCoin = bcadd($withdrawCoin, '0', 2);
$allowedReceiveTypes = ['bank', 'ewallet', 'crypto'];
if (!in_array($receiveType, $allowedReceiveTypes, true)) {
return $this->error('收款类型不合法,仅支持 bank/ewallet/crypto');
return $this->error(__('Invalid receive type; only bank/ewallet/crypto are supported'));
}
$remark = trim((string) $request->post('remark', ''));
$admin = Db::name('admin')->field(['id', 'channel_id'])->where('id', $adminId)->find();
@@ -185,14 +185,14 @@ class AdminInfo extends Backend
$res = AdminWalletService::applyWithdraw($adminId, $channelId, $withdrawCoin, $receiveType, $receiveAccount, $idempotencyKey, $remark);
if (($res['ok'] ?? false) !== true) {
Db::rollback();
return $this->error(strval($res['msg'] ?? '提现申请失败'));
return $this->error(strval($res['msg'] ?? __('Withdraw apply failed')));
}
Db::commit();
} catch (Throwable $e) {
Db::rollback();
return $this->error($e->getMessage());
}
return $this->success('提现申请已提交,待渠道超管审核', [
return $this->success(__('Withdraw request submitted; pending channel super admin review'), [
'order_id' => intval($res['order_id'] ?? 0),
'order_no' => strval($res['order_no'] ?? ''),
'idempotent_hit' => !empty($res['idempotent_hit']),

View File

@@ -234,16 +234,16 @@ class User extends Backend
$opRaw = $request->post('op');
$op = is_string($opRaw) ? trim($opRaw) : '';
if (!in_array($op, ['credit', 'deduct'], true)) {
return $this->error('操作类型不正确');
return $this->error(__('Invalid operation type'));
}
$amountRaw = $request->post('amount');
$amountText = is_string($amountRaw) || is_numeric($amountRaw) ? trim(strval($amountRaw)) : '';
if ($amountText === '' || !is_numeric($amountText)) {
return $this->error('金额格式不正确');
return $this->error(__('Invalid amount format'));
}
if (bccomp($amountText, '0', 2) <= 0) {
return $this->error('金额必须大于0');
return $this->error(__('Amount must be greater than 0'));
}
$remarkRaw = $request->post('remark');
@@ -257,7 +257,7 @@ class User extends Backend
$lock = GameHotDataRedis::userAdminMutationLockTry($userId);
if (!$lock['acquired']) {
return $this->error('该用户正在被其他管理员操作(钱包/并发保存),请稍后再试');
return $this->error(__('This user is being operated by another admin (wallet/concurrent save); please try again later'));
}
try {
@@ -284,7 +284,7 @@ class User extends Backend
$direction = 1;
} else {
if (bccomp($before, $delta, 2) < 0) {
return $this->error('余额不足,扣点失败');
return $this->error(__('Insufficient balance; deduction failed'));
}
$after = bcsub($before, $delta, 2);
$bizType = 'admin_deduct';
@@ -306,7 +306,7 @@ class User extends Backend
]);
if ($affected !== 1) {
Db::rollback();
return $this->error('保存失败:该用户余额已被其他请求修改(如下注、派彩或其他管理员已保存),请刷新后重试');
return $this->error(__('Save failed: user balance changed by another request; please refresh and retry'));
}
Db::name('user_wallet_record')->insert([
@@ -332,7 +332,7 @@ class User extends Backend
GameHotDataCoordinator::afterUserCommitted($userId);
return $this->success('钱包调整成功', [
return $this->success(__('Wallet adjusted successfully'), [
'user_id' => $userId,
'coin_before' => self::formatAmountForDisplay($before),
'coin_after' => self::formatAmountForDisplay($after),

View File

@@ -35,7 +35,7 @@ class UserWalletRecord extends Backend
if ($response !== null) {
return $response;
}
return $this->error('钱包流水仅允许业务入账,禁止后台手工新增');
return $this->error(__('Wallet records are business-generated; manual creation is not allowed'));
}
public function edit(WebmanRequest $request): Response
@@ -44,7 +44,7 @@ class UserWalletRecord extends Backend
if ($response !== null) {
return $response;
}
return $this->error('钱包流水不可编辑');
return $this->error(__('Wallet record cannot be edited'));
}
public function del(WebmanRequest $request): Response
@@ -53,7 +53,7 @@ class UserWalletRecord extends Backend
if ($response !== null) {
return $response;
}
return $this->error('钱包流水不可删除');
return $this->error(__('Wallet record cannot be deleted'));
}
public function sortable(WebmanRequest $request): Response
@@ -62,7 +62,7 @@ class UserWalletRecord extends Backend
if ($response !== null) {
return $response;
}
return $this->error('不支持排序');
return $this->error(__('Sorting is not supported'));
}
/**