1.优化渠道管理中直属投注额度和总投注额度

2.管理员管理中三个菜单数据显示限制
This commit is contained in:
2026-05-30 15:53:36 +08:00
parent 16a7ef7413
commit f6197a9af5
13 changed files with 195 additions and 92 deletions

View File

@@ -25,6 +25,7 @@ class Channel extends Backend
'settleStats',
'dividendRecordList',
'directBetRecordList',
'companyBetRecordList',
'settlementBetRecordList',
];
@@ -751,6 +752,7 @@ class Channel extends Backend
}
}
$paidDividendTotal = '0.00';
$companyTotalBetAmount = '0.00';
if ($channelIdList !== []) {
$paidRow = Db::name('agent_commission_record')
->where('channel_id', 'in', $channelIdList)
@@ -758,6 +760,12 @@ class Channel extends Backend
->field('SUM(commission_amount) AS s')
->find();
$paidDividendTotal = bcadd(strval(is_array($paidRow) ? ($paidRow['s'] ?? '0') : '0'), '0', 2);
$companyBetRow = Db::name('game_play_record')
->where('channel_id', 'in', $channelIdList)
->field('SUM(total_amount) AS s')
->find();
$companyTotalBetAmount = bcadd(strval(is_array($companyBetRow) ? ($companyBetRow['s'] ?? '0') : '0'), '0', 2);
}
return $this->success('', [
'channel_total' => $total,
@@ -767,6 +775,7 @@ class Channel extends Backend
'carryover_total' => $carryoverTotal,
'carryover_positive_total' => $carryoverPositiveTotal,
'paid_dividend_total' => $paidDividendTotal,
'company_total_bet_amount' => $companyTotalBetAmount,
]);
}
@@ -779,7 +788,7 @@ class Channel extends Backend
if ($response !== null) {
return $response;
}
if (!$this->auth->check('channel/viewDividendRecords')) {
if (!$this->auth->check('channel/index')) {
return $this->error(__('You have no permission'));
}
@@ -840,7 +849,7 @@ class Channel extends Backend
}
/**
* 渠道直属玩家下注记录(直属投注额列点击)
* 渠道直属玩家下注记录(直属投注额列点击;该渠道名下玩家全部注单
*/
public function directBetRecordList(WebmanRequest $request): Response
{
@@ -848,7 +857,7 @@ class Channel extends Backend
if ($response !== null) {
return $response;
}
if (!$this->auth->check('channel/viewDirectBetRecords')) {
if (!$this->auth->check('channel/index')) {
return $this->error(__('You have no permission'));
}
@@ -861,27 +870,31 @@ class Channel extends Backend
}
/**
* 参与分红口径的下注记录(操作列「查看总投注金额」
* 公司总投注记录下注明细(顶部公司总投注额点击;含未结算,当前账号可见渠道范围
*/
public function settlementBetRecordList(WebmanRequest $request): Response
public function companyBetRecordList(WebmanRequest $request): Response
{
$response = $this->initializeBackend($request);
if ($response !== null) {
return $response;
}
if (!$this->auth->check('channel/viewSettlementBetRecords')) {
if (!$this->auth->check('channel/index')) {
return $this->error(__('You have no permission'));
}
$channelId = (int) ($request->get('channel_id', 0));
if ($channelId <= 0 || !$this->assertChannelAccessible($channelId)) {
return $this->error(__('You have no permission'));
}
return $this->success('', $this->fetchChannelPlayRecordListPayload($request, $channelId, true));
return $this->success('', $this->fetchChannelPlayRecordListPayload($request, 0, false));
}
/**
* @deprecated 请使用 companyBetRecordList
*/
public function settlementBetRecordList(WebmanRequest $request): Response
{
return $this->companyBetRecordList($request);
}
/**
* @param int $channelId 0=当前账号可见全部渠道
* @return array{list: array<int, array<string, mixed>>, total: int, summary: array{record_count:int,total_bet_amount:string,total_win_amount:string}}
*/
private function fetchChannelPlayRecordListPayload(WebmanRequest $request, int $channelId, bool $settledOnly): array
@@ -1054,8 +1067,21 @@ class Channel extends Backend
$query = Db::name('game_play_record')->alias('pr')
->leftJoin('user u', 'u.id = pr.user_id')
->leftJoin('game_record gr', 'gr.id = pr.period_id')
->leftJoin('channel c', 'c.id = pr.channel_id')
->where('pr.channel_id', $channelId);
->leftJoin('channel c', 'c.id = pr.channel_id');
if ($channelId > 0) {
if (!$this->assertChannelAccessible($channelId)) {
$query->where('pr.channel_id', 0);
return $query;
}
$query->where('pr.channel_id', $channelId);
} else {
$scope = $this->readableChannelIds();
if ($scope === []) {
$query->where('pr.channel_id', 0);
} elseif ($scope !== null) {
$query->whereIn('pr.channel_id', $scope);
}
}
if ($settledOnly) {
$query->where('pr.status', 2);
}