1.优化渠道管理中直属投注额度和总投注额度
2.管理员管理中三个菜单数据显示限制
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -38,9 +38,9 @@ class AdminWallet extends Backend
|
||||
list($where, $alias, $limit, $order) = $this->queryBuilder();
|
||||
$table = strtolower($this->model->getTable());
|
||||
$mainShort = $alias[$table] ?? '';
|
||||
if ($mainShort !== '' && $this->auth && !$this->auth->isSuperAdmin()) {
|
||||
// 非超管仅可查看自己钱包
|
||||
$where[] = [$mainShort . '.admin_id', '=', intval($this->auth->id ?? 0)];
|
||||
$scopedAdminIds = $this->getManageableScopeAdminIds();
|
||||
if ($mainShort !== '' && $scopedAdminIds !== []) {
|
||||
$where[] = [$mainShort . '.admin_id', 'in', $scopedAdminIds];
|
||||
}
|
||||
$res = $this->model
|
||||
->withJoin($this->withJoinTable, $this->withJoinType)
|
||||
|
||||
@@ -37,8 +37,9 @@ class AdminWalletRecord extends Backend
|
||||
list($where, $alias, $limit, $order) = $this->queryBuilder();
|
||||
$table = strtolower($this->model->getTable());
|
||||
$mainShort = $alias[$table] ?? '';
|
||||
if ($mainShort !== '' && $this->auth && !$this->auth->isSuperAdmin()) {
|
||||
$where[] = [$mainShort . '.admin_id', '=', intval($this->auth->id ?? 0)];
|
||||
$scopedAdminIds = $this->getManageableScopeAdminIds();
|
||||
if ($mainShort !== '' && $scopedAdminIds !== []) {
|
||||
$where[] = [$mainShort . '.admin_id', 'in', $scopedAdminIds];
|
||||
}
|
||||
|
||||
$res = $this->model
|
||||
|
||||
@@ -42,9 +42,9 @@ class AdminWithdrawOrder extends Backend
|
||||
list($where, $alias, $limit, $order) = $this->queryBuilder();
|
||||
$table = strtolower($this->model->getTable());
|
||||
$mainShort = $alias[$table] ?? '';
|
||||
$channelScope = $this->readableChannelIds();
|
||||
if ($mainShort !== '' && $channelScope !== null) {
|
||||
$where[] = [$mainShort . '.channel_id', 'in', $channelScope];
|
||||
$scopedAdminIds = $this->getManageableScopeAdminIds();
|
||||
if ($mainShort !== '' && $scopedAdminIds !== []) {
|
||||
$where[] = [$mainShort . '.admin_id', 'in', $scopedAdminIds];
|
||||
}
|
||||
$res = $this->model
|
||||
->withJoin($this->withJoinTable, $this->withJoinType)
|
||||
@@ -171,9 +171,9 @@ class AdminWithdrawOrder extends Backend
|
||||
return $response;
|
||||
}
|
||||
$query = Db::name('admin_withdraw_order');
|
||||
$channelScope = $this->readableChannelIds();
|
||||
if ($channelScope !== null) {
|
||||
$query->where('channel_id', 'in', $channelScope);
|
||||
$scopedAdminIds = $this->getManageableScopeAdminIds();
|
||||
if ($scopedAdminIds !== []) {
|
||||
$query->where('admin_id', 'in', $scopedAdminIds);
|
||||
}
|
||||
$rows = $query->field(['status', 'amount', 'actual_amount'])->select()->toArray();
|
||||
$total = count($rows);
|
||||
@@ -232,16 +232,16 @@ class AdminWithdrawOrder extends Backend
|
||||
if ($this->auth->isSuperAdmin() || $this->hasGlobalReadScope()) {
|
||||
return true;
|
||||
}
|
||||
$channelId = intval($order['channel_id'] ?? 0);
|
||||
if ($channelId <= 0) {
|
||||
$adminId = intval($order['admin_id'] ?? 0);
|
||||
if ($adminId <= 0) {
|
||||
return false;
|
||||
}
|
||||
$allowed = $this->readableChannelIds();
|
||||
if ($allowed === null) {
|
||||
$scopedAdminIds = $this->getManageableScopeAdminIds();
|
||||
if ($scopedAdminIds === []) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return in_array($channelId, $allowed, true);
|
||||
return in_array($adminId, $scopedAdminIds, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user