修复翻译BUG

This commit is contained in:
2026-04-23 17:44:10 +08:00
parent f2b4dab54f
commit de3b9ab6bf
6 changed files with 109 additions and 11 deletions

View File

@@ -283,8 +283,54 @@ class Channel extends Backend
->order($order)
->paginate($limit);
$items = $res->items();
$channelIds = [];
foreach ($items as $item) {
$cid = intval($item['id'] ?? 0);
if ($cid > 0) {
$channelIds[] = $cid;
}
}
$channelIds = array_values(array_unique($channelIds));
if ($channelIds !== []) {
$userCountMap = Db::name('user')
->where('channel_id', 'in', $channelIds)
->group('channel_id')
->column('COUNT(*) AS c', 'channel_id');
$now = time();
foreach ($channelIds as $channelId) {
$latestCount = intval($userCountMap[$channelId] ?? 0);
Db::name('channel')
->where('id', intval($channelId))
->update([
'user_count' => $latestCount,
'update_time' => $now,
]);
}
$profitMap = Db::name('bet_order')
->where('channel_id', 'in', $channelIds)
->where('status', 2)
->group('channel_id')
->column('SUM(total_amount - win_amount - jackpot_extra_amount) AS p', 'channel_id');
foreach ($items as $k => $item) {
$cid = intval($item['id'] ?? 0);
if ($cid <= 0) {
continue;
}
$items[$k]['user_count'] = intval($userCountMap[$cid] ?? 0);
$profit = strval($profitMap[$cid] ?? '0.00');
$items[$k]['profit_amount'] = bcadd($profit, '0', 2);
if (!isset($items[$k]['total_profit_amount']) || $items[$k]['total_profit_amount'] === null || $items[$k]['total_profit_amount'] === '') {
$items[$k]['total_profit_amount'] = $items[$k]['profit_amount'];
}
if (!isset($items[$k]['commission_pool_amount']) || $items[$k]['commission_pool_amount'] === null || $items[$k]['commission_pool_amount'] === '') {
$items[$k]['commission_pool_amount'] = '0.00';
}
}
}
return $this->success('', [
'list' => $res->items(),
'list' => $items,
'total' => $res->total(),
'remark' => get_route_remark(),
]);
@@ -636,7 +682,8 @@ class Channel extends Backend
if (!$this->auth->isSuperAdmin()) {
return $this->error(__('You have no permission'));
}
$res = ChannelSettlementService::settleAllDueChannels(intval($this->auth->id));
// 批量按钮语义:手动触发“待结算渠道”结算,不受结算周期到点限制。
$res = ChannelSettlementService::settleAllDueChannels(intval($this->auth->id), false);
return $this->success('批量结算完成', $res);
}