对搜索返回的消息做中英双版本
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user