1.优化渠道管理中直属投注额度和总投注额度
2.管理员管理中三个菜单数据显示限制
This commit is contained in:
@@ -7,6 +7,8 @@ namespace app\common\controller;
|
||||
use Throwable;
|
||||
use app\admin\library\Auth;
|
||||
use app\common\service\AdminChannelScopeService;
|
||||
use app\common\service\AdminCommissionDistributionService;
|
||||
use support\think\Db;
|
||||
use app\common\library\token\TokenExpirationException;
|
||||
use app\admin\library\traits\Backend as BackendTrait;
|
||||
use support\Response;
|
||||
@@ -542,4 +544,49 @@ class Backend extends Api
|
||||
|
||||
return array_values(array_unique($paths));
|
||||
}
|
||||
|
||||
/**
|
||||
* 角色组管理范围内可见的管理员 ID(本人 + 代理树下级 + 本人所在组及下级组内管理员)
|
||||
* 超管或全平台只读范围返回空数组表示不限制
|
||||
*
|
||||
* @return int[]
|
||||
*/
|
||||
protected function getManageableScopeAdminIds(): array
|
||||
{
|
||||
if ($this->auth === null || !$this->auth->isLogin()) {
|
||||
return [0];
|
||||
}
|
||||
if ($this->auth->isSuperAdmin() || $this->hasGlobalReadScope()) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$operatorId = intval($this->auth->id);
|
||||
$ids = AdminCommissionDistributionService::getVisibleAdminIdsForOperator($operatorId, false);
|
||||
|
||||
$ownGroupIds = Db::name('admin_group_access')->where('uid', $operatorId)->column('group_id');
|
||||
$childGroupIds = $this->auth->getAdminChildGroups();
|
||||
$groupIds = array_values(array_unique(array_merge(
|
||||
array_map(static fn($id) => intval(strval($id)), $ownGroupIds),
|
||||
array_map(static fn($id) => intval(strval($id)), $childGroupIds)
|
||||
)));
|
||||
if ($groupIds !== []) {
|
||||
$groupAdminIds = Db::name('admin_group_access')
|
||||
->where('group_id', 'in', $groupIds)
|
||||
->column('uid');
|
||||
foreach ($groupAdminIds as $uid) {
|
||||
$uidInt = intval(strval($uid));
|
||||
if ($uidInt > 0) {
|
||||
$ids[] = $uidInt;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($operatorId > 0) {
|
||||
$ids[] = $operatorId;
|
||||
}
|
||||
|
||||
$ids = array_values(array_unique(array_filter($ids, static fn(int $id): bool => $id > 0)));
|
||||
|
||||
return $ids === [] ? [0] : $ids;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user