- Updated AGENTS.md to clarify site admin roles and their associated permissions. - Refactored reconciliation controllers to include admin user validation and improved access control based on admin roles. - Enhanced AdminReconcileJobService to support player-specific reconciliation and site-based job creation. - Removed deprecated rebate commission report functionality from the API and related services. - Improved dashboard overview builders to accommodate new site operator roles and their specific functionalities.
67 lines
1.9 KiB
PHP
67 lines
1.9 KiB
PHP
<?php
|
||
|
||
namespace App\Support;
|
||
|
||
use App\Models\AdminRole;
|
||
|
||
/**
|
||
* 平台「站点管理员」系统角色(slug=site_admin)的默认 prd.* 模板。
|
||
* 接入站点创建时自动绑定;权限可在「平台角色管理」调整。
|
||
*/
|
||
final class SiteAdminDefaultRolePermissions
|
||
{
|
||
/** @var list<string> */
|
||
private const TEMPLATE_SLUGS = [
|
||
'prd.dashboard.view',
|
||
'prd.agent.view',
|
||
'prd.agent.manage',
|
||
'prd.agent.role.view',
|
||
'prd.agent.role.manage',
|
||
'prd.agent.user.view',
|
||
'prd.agent.user.manage',
|
||
'prd.agent.profile.manage',
|
||
'prd.users.manage',
|
||
'prd.tickets.view',
|
||
'prd.report.view',
|
||
'prd.report.export',
|
||
'prd.draw_result.view',
|
||
'prd.wallet_reconcile.manage',
|
||
'prd.settlement.agent.view',
|
||
'prd.settlement.agent.manage',
|
||
];
|
||
|
||
/**
|
||
* @return list<string>
|
||
*/
|
||
public static function templateSlugs(): array
|
||
{
|
||
return self::TEMPLATE_SLUGS;
|
||
}
|
||
|
||
public static function ensurePlatformSiteAdminRole(): AdminRole
|
||
{
|
||
$role = AdminRole::query()->updateOrCreate(
|
||
[
|
||
'slug' => SitePlatformRole::SLUG,
|
||
'scope_type' => AdminRole::SCOPE_SYSTEM,
|
||
],
|
||
[
|
||
'code' => SitePlatformRole::SLUG,
|
||
'name' => '站点管理员',
|
||
'description' => '接入站点后台默认权限(本站代理/玩家/信用结算 + 钱包流水与经营报表 + 期号只读)',
|
||
'status' => 1,
|
||
'is_system' => true,
|
||
'sort_order' => 40,
|
||
'owner_agent_id' => null,
|
||
'delegated_from_role_id' => null,
|
||
],
|
||
);
|
||
|
||
$role->syncLegacyPermissionSlugs(
|
||
AdminPermissionInheritance::expand(self::TEMPLATE_SLUGS),
|
||
);
|
||
|
||
return $role->fresh() ?? $role;
|
||
}
|
||
}
|