对搜索返回的消息做中英双版本
This commit is contained in:
@@ -77,7 +77,7 @@ class AdminWalletService
|
||||
if (is_array($existing)) {
|
||||
$existAdminId = intval($existing['admin_id'] ?? 0);
|
||||
if ($existAdminId !== $adminId) {
|
||||
return ['ok' => false, 'msg' => 'Idempotency key conflict'];
|
||||
return ['ok' => false, 'msg' => __('Idempotency key conflict')];
|
||||
}
|
||||
return [
|
||||
'ok' => true,
|
||||
@@ -90,7 +90,7 @@ class AdminWalletService
|
||||
$wallet = self::ensureWallet($adminId);
|
||||
$before = strval($wallet['balance'] ?? '0.00');
|
||||
if (bccomp($before, $withdrawCoin, 2) < 0) {
|
||||
return ['ok' => false, 'msg' => '钱包余额不足'];
|
||||
return ['ok' => false, 'msg' => __('Insufficient wallet balance')];
|
||||
}
|
||||
$after = bcsub($before, $withdrawCoin, 2);
|
||||
$beforeFrozen = strval($wallet['frozen_balance'] ?? '0.00');
|
||||
|
||||
@@ -13,7 +13,7 @@ class ChannelSettlementService
|
||||
{
|
||||
$channel = Db::name('channel')->where('id', $channelId)->find();
|
||||
if (!is_array($channel)) {
|
||||
return ['ok' => false, 'msg' => '渠道不存在'];
|
||||
return ['ok' => false, 'msg' => __('Channel not found')];
|
||||
}
|
||||
$payload = self::buildSettlePayload($channel);
|
||||
if (is_string($payload)) {
|
||||
@@ -21,11 +21,11 @@ class ChannelSettlementService
|
||||
}
|
||||
$settlementNo = self::generateAgentSettlementNo($auto ? 'A' : 'M', $channelId, intval($payload['period_end_ts']));
|
||||
if (Db::name('agent_settlement_period')->where('settlement_no', $settlementNo)->value('id')) {
|
||||
return ['ok' => false, 'msg' => '结算单号冲突,请重试'];
|
||||
return ['ok' => false, 'msg' => __('Settlement number conflict, please retry')];
|
||||
}
|
||||
$shareRows = self::resolveCommissionSharesForChannel($channelId);
|
||||
if ($shareRows === []) {
|
||||
return ['ok' => false, 'msg' => '渠道下无可用管理员分配比例,无法结算'];
|
||||
return ['ok' => false, 'msg' => __('No available admin share ratios under this channel; cannot settle')];
|
||||
}
|
||||
$now = time();
|
||||
Db::startTrans();
|
||||
@@ -52,7 +52,7 @@ class ChannelSettlementService
|
||||
$now
|
||||
);
|
||||
if ($rows === []) {
|
||||
throw new \RuntimeException('生成待分红记录失败');
|
||||
throw new \RuntimeException('Failed to generate commission rows');
|
||||
}
|
||||
foreach ($rows as $row) {
|
||||
$adminId = intval($row['admin_id'] ?? 0);
|
||||
@@ -92,7 +92,7 @@ class ChannelSettlementService
|
||||
|
||||
public static function settleDividendByChannelAdmin(int $channelId, int $operatorAdminId, string $remark = ''): array
|
||||
{
|
||||
return ['ok' => false, 'msg' => '当前流程为超管结算后自动发放,渠道管理员无需二次结算'];
|
||||
return ['ok' => false, 'msg' => __('This flow pays commissions automatically after super admin settlement; channel admin does not need to settle again')];
|
||||
}
|
||||
|
||||
public static function settleAllDueChannels(int $operatorAdminId, bool $respectCycle = true): array
|
||||
@@ -159,14 +159,14 @@ class ChannelSettlementService
|
||||
{
|
||||
$channelId = intval($row['id'] ?? 0);
|
||||
if ($channelId <= 0) {
|
||||
return '渠道数据异常';
|
||||
return (string) __('Invalid channel data');
|
||||
}
|
||||
$endTs = time();
|
||||
$lastEnd = self::getLastSettlementEndForChannel($channelId);
|
||||
$channelCreateTs = intval($row['create_time'] ?? 0);
|
||||
$periodStartTs = $lastEnd === null ? ($channelCreateTs > 0 ? $channelCreateTs : 0) : $lastEnd;
|
||||
if ($periodStartTs >= $endTs) {
|
||||
return '结算区间无效(开始时间不早于当前)';
|
||||
return (string) __('Invalid settlement period (start time is not earlier than now)');
|
||||
}
|
||||
$stats = self::aggregateBetOrderForChannel($channelId, $periodStartTs, $lastEnd !== null, $endTs);
|
||||
$totalBet = $stats['total_bet'];
|
||||
@@ -234,7 +234,7 @@ class ChannelSettlementService
|
||||
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(strval($ratePercent), '100', 4);
|
||||
return [
|
||||
@@ -247,11 +247,11 @@ class ChannelSettlementService
|
||||
$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 = self::normalizeLadderRulesForSettlement($rulesRaw);
|
||||
if ($rules === []) {
|
||||
return '联营阶梯规则无效或为空';
|
||||
return (string) __('Affiliate ladder rules are empty or invalid');
|
||||
}
|
||||
if (bccomp($platformProfit, '0', 2) <= 0) {
|
||||
return ['commission_rate' => '0.0000', 'calc_base_amount' => '0.00', 'commission_amount' => '0.00'];
|
||||
@@ -268,7 +268,7 @@ class ChannelSettlementService
|
||||
'commission_amount' => bcmul($afterFee, $rateDec, 2),
|
||||
];
|
||||
}
|
||||
return '未知的代理模式';
|
||||
return (string) __('Unknown agent mode');
|
||||
}
|
||||
|
||||
private static function normalizeLadderRulesForSettlement(mixed $rulesRaw): array
|
||||
|
||||
@@ -71,14 +71,14 @@ final class GameRecordService
|
||||
public static function createNextRecordForManual(): array
|
||||
{
|
||||
if (!self::getConfigBool(self::KEY_MANUAL_CREATE)) {
|
||||
return ['ok' => false, 'msg' => '未开启「手动创建下一局」开关'];
|
||||
return ['ok' => false, 'msg' => __('Manual create next round is disabled')];
|
||||
}
|
||||
if (self::hasActiveRecord()) {
|
||||
return ['ok' => false, 'msg' => '存在未结束对局,无法新建'];
|
||||
return ['ok' => false, 'msg' => __('There is an unfinished round; cannot create a new one')];
|
||||
}
|
||||
try {
|
||||
$periodNo = self::createNextRecordRow();
|
||||
return ['ok' => true, 'msg' => '已创建新对局', 'period_no' => $periodNo];
|
||||
return ['ok' => true, 'msg' => __('New round created'), 'period_no' => $periodNo];
|
||||
} catch (Throwable $e) {
|
||||
return ['ok' => false, 'msg' => $e->getMessage()];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user