| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521 |
- <?php
- declare (strict_types=1);
- namespace app\controller;
- use app\BaseController;
- use app\service\MenuService;
- use app\service\PermissionService;
- class Menu extends BaseController
- {
- /**
- * 获取用户菜单列表
- */
- public function getUserMenus()
- {
- // return json_success([
- // [
- // 'meta' => [
- // 'title' => 'page.dashboard.title'
- // ],
- // 'name' => 'Dashboard',
- // 'path' => '/',
- // 'redirect' => '/analytics',
- // 'children' => [
- // [
- // 'name' => 'Analytics',
- // 'path' => '/analytics',
- // 'component' => '/dashboard/analytics/index',
- // 'meta' => [
- // 'affixTab' => true,
- // 'title' => 'page.dashboard.analytics'
- // ]
- // ]
- // ]
- // ]
- // ]);
- $webMenu = [];
- $webMenu[] = [
- "meta" => [
- "icon" => "solar:widget-5-linear",
- "order" => -1,
- "title" => "page.dashboard.title",
- ],
- "name" => "Dashboard",
- "path" => "/dashboard",
- "children" => [
- [
- "name" => "Analytics",
- "path" => "/analytics",
- "component" => "/dashboard/analytics/index.vue",
- "meta" => [
- "affixTab" => true,
- "icon" => "lucide:area-chart",
- "title" => "dashboard.analytics_title",
- ],
- ],
- [
- "name" => "GgrReport",
- "path" => "/ggr-report",
- "component" => "/dashboard/ggr_report/index.vue",
- "meta" => [
- "icon" => "solar:align-bottom-outline",
- "title" => "dashboard.ggr_report_title",
- ],
- ],
- ],
- ];
- // 综合数据
- $webMenu[] = [
- "meta" => [
- "keepAlive" => true,
- "icon" => "solar:cloud-check-outline",
- "order" => 1,
- "title" => "data_statistics.title",
- ],
- "name" => "DataStatistics",
- "path" => "/data-statistics",
- "children" => [
- [
- "meta" => [
- "title" => "data_statistics.data_agent_title",
- "icon" => "solar:server-minimalistic-linear",
- "keepAlive" => true,
- ],
- "name" => "Agent",
- "path" => "/data-statistics/agent",
- "component" => "/data_statistics/agent/index.vue",
- ],
- [
- "meta" => [
- "title" => "data_statistics.daily_title",
- "icon" => "solar:notebook-linear",
- "keepAlive" => true,
- ],
- "name" => "Daily",
- "path" => "/data-statistics/daily",
- "children" => [
- [
- "meta" => [
- "title" => "data_statistics.agent_title",
- "keepAlive" => true,
- ],
- "name" => "DailyAgent",
- "path" => "/data-statistics/daily/agent",
- "component" => "/data_statistics/daily/agent/index.vue",
- ],
- [
- "meta" => [
- "title" => "data_statistics.game_title",
- "keepAlive" => true,
- ],
- "name" => "DailyGame",
- "path" => "/data-statistics/daily/game",
- "component" => "/data_statistics/daily/game/index.vue",
- ],
- ],
- ],
- [
- "meta" => [
- "title" => "data_statistics.history_title",
- "icon" => "solar:sort-by-time-outline",
- "keepAlive" => true,
- ],
- "name" => "History",
- "path" => "/data-statistics/history",
- "children" => [
- [
- "meta" => [
- "title" => "data_statistics.history_agent_title",
- "keepAlive" => true,
- ],
- "name" => "HistoryAgent",
- "path" => "/data-statistics/history/agent",
- "component" => "/data_statistics/history/agent/index.vue",
- ],
- ],
- ],
- [
- "meta" => [
- "title" => "data_statistics.trend_title",
- "icon" => "solar:chart-square-outline",
- "keepAlive" => true,
- ],
- "name" => "Trend",
- "path" => "/data-statistics/trend",
- "children" => [
- [
- "meta" => [
- "title" => "data_statistics.trend_win_lose_title",
- "keepAlive" => true,
- ],
- "name" => "TrendWinLose",
- "path" => "/data-statistics/trend/win_lose",
- "component" => "/data_statistics/trend/win_lose/index.vue",
- ],
- [
- "meta" => [
- "title" => "data_statistics.trend_rewards_title",
- "keepAlive" => true,
- ],
- "name" => "TrendRewards",
- "path" => "/data-statistics/trend/rewards",
- "component" => "/data_statistics/trend/rewards/index.vue",
- ],
- [
- "meta" => [
- "title" => "data_statistics.trend_agent_title",
- "keepAlive" => true,
- ],
- "name" => "TrendAgent",
- "path" => "/data-statistics/trend/agent",
- "component" => "/data_statistics/trend/agent/index.vue",
- ],
- ],
- ],
- [
- "meta" => [
- "title" => "data_statistics.rank_title",
- "icon" => "solar:ranking-outline",
- "keepAlive" => true,
- ],
- "name" => "Rank",
- "path" => "/data-statistics/rank",
- "children" => [
- [
- "meta" => [
- "title" => "data_statistics.rank_win_title",
- "keepAlive" => true,
- ],
- "name" => "RankWin",
- "path" => "/data-statistics/rank/win",
- "component" => "/data_statistics/rank/win/index.vue",
- ],
- [
- "meta" => [
- "title" => "data_statistics.rank_lose_title",
- "keepAlive" => true,
- ],
- "name" => "RankLose",
- "path" => "/data-statistics/rank/lose",
- "component" => "/data_statistics/rank/lose/index.vue",
- ],
- [
- "meta" => [
- "title" => "data_statistics.rank_bet_title",
- "keepAlive" => true,
- ],
- "name" => "RankBet",
- "path" => "/data-statistics/rank/bet_amount",
- "component" => "/data_statistics/rank/bet/index.vue",
- ],
- ],
- ],
- ],
- ];
- // 玩家数据
- $webMenu[] = [
- "meta" => [
- "keepAlive" => true,
- "icon" => "solar:user-broken",
- "order" => 2,
- "title" => "player_data.title",
- ],
- "name" => "PlayerData",
- "path" => "/player-data",
- "children" => [
- [
- "meta" => [
- "title" => "player_data.player_list",
- "icon" => "solar:users-group-rounded-outline",
- "keepAlive" => true,
- ],
- "name" => "AntDesignPlayerList",
- "path" => "/player-data/player-list",
- "component" => "/player_data/player_list/index.vue",
- ],
- [
- "meta" => [
- "title" => "player_data.game_records",
- "icon" => "solar:gamepad-minimalistic-outline",
- "keepAlive" => true,
- ],
- "name" => "GameRecordList",
- "path" => "/player-data/game-records",
- "component" => "/player_data/game_records/index.vue",
- ],
- [
- "meta" => [
- "title" => "player_data.funds_change",
- "icon" => "solar:reorder-broken",
- "keepAlive" => true,
- ],
- "name" => "FundsChangeList",
- "path" => "/player-data/funds-change",
- "component" => "/player_data/funds_change/index.vue",
- ],
- [
- "meta" => [
- "title" => "player_data.transform_records",
- "icon" => "solar:card-recive-line-duotone",
- "keepAlive" => true,
- ],
- "name" => "TransformRecordsList",
- "path" => "/player-data/transform-records",
- "component" => "/player_data/transform_records/index.vue",
- ],
- ],
- ];
- // 游戏数据
- $webMenu[] = [
- "meta" => [
- "icon" => "solar:ghost-smile-outline",
- "keepAlive" => true,
- "order" => 3,
- "title" => "game_data.title",
- ],
- "name" => "gameData",
- "path" => "/game-data",
- "children" => [
- [
- "meta" => [
- "title" => "game_data.game_summary_title",
- "icon" => "solar:dollar-outline",
- "keepAlive" => true,
- ],
- "name" => "gameDataGameSummary",
- "path" => "/game-data/game-summary",
- "component" => "/game_data/game_summary/index.vue",
- ],
- [
- "meta" => [
- "title" => "game_data.bet_level_title",
- "icon" => "solar:card-transfer-outline",
- "keepAlive" => true,
- ],
- "name" => "gameDataBetLevel",
- "path" => "/game-data/bet-level",
- "component" => "/game_data/bet_level/index.vue",
- ],
- ],
- ];
- // 游戏调整
- $webMenu[] = [
- "meta" => [
- "icon" => "solar:gamepad-outline",
- "keepAlive" => true,
- "order" => 4,
- "title" => "game_control.title",
- ],
- "name" => "gameControl",
- "path" => "/game-control",
- "children" => [
- [
- "meta" => [
- "title" => "game_control.game_config",
- "icon" => "solar:gamepad-old-outline",
- "keepAlive" => true,
- ],
- "name" => "GameControlGameConfig",
- "path" => "/game-control/game_config",
- "component" => "/game_control/game_config/index.vue",
- ],
- [
- "meta" => [
- "title" => "game_control.play_control_title",
- "icon" => "solar:remote-controller-outline",
- "keepAlive" => true,
- ],
- "name" => "GameControlGamePlayerControl",
- "path" => "/game-control/player-control",
- "children" => [
- [
- "meta" => [
- "title" => "game_control.play_control_list_title",
- "keepAlive" => true,
- ],
- "name" => "GameControlGamePlayerControlList",
- "path" => "/game-control/player-control/list",
- "component" =>
- "/game_control/player_control/list/index.vue",
- ],
- [
- "meta" => [
- "title" => "game_control.play_control_record_title",
- "keepAlive" => true,
- ],
- "name" => "GameControlGamePlayerControlRecord",
- "path" => "/game-control/player-control/record",
- "component" =>
- "/game_control/player_control/record/index.vue",
- ],
- ],
- ],
- [
- "meta" => [
- "title" => "game_control.control_auto_rtp_title",
- "icon" => "solar:station-outline",
- "keepAlive" => true,
- ],
- "name" => "GameControlGameAutoRtpControl",
- "path" => "/game-control/auto-rtp",
- "children" => [
- [
- "meta" => [
- "title" => "game_control.control_auto_rtp_config_title",
- "keepAlive" => true,
- ],
- "name" => "GameControlGameAutoRtpControlConfig",
- "path" => "/game-control/auto-rtp/config",
- "component" => "/game_control/auto_rtp/config/index.vue",
- ],
- ],
- ],
- [
- "meta" => [
- "title" => "feed_user.feed_user_title",
- "icon" => "solar:bomb-emoji-broken",
- "keepAlive" => true,
- ],
- "name" => "FeedUser",
- "path" => "/game-control/feed-user",
- "children" => [
- [
- "meta" => [
- "title" => "feed_user.feed_user_global_title",
- "keepAlive" => true,
- ],
- "name" => "FeedUserGlobal",
- "path" => "/game-control/feed-user/global",
- "component" => "/game_control/feed_user/global/index.vue",
- ],
- [
- "meta" => [
- "title" => "feed_user.feed_user_list_title",
- "keepAlive" => true,
- ],
- "name" => "FeedUserList",
- "path" => "/game-control/feed-user/list",
- "component" => "/game_control/feed_user/list/index.vue",
- ],
- [
- "meta" => [
- "title" => "feed_user.feed_user_record_title",
- "keepAlive" => true,
- ],
- "name" => "FeedUserRecord",
- "path" => "/game-control/feed-user/record",
- "component" => "/game_control/feed_user/record/index.vue",
- ],
- ],
- ],
- ],
- ];
- // 日志管理
- $webMenu[] = [
- "meta" => [
- "keepAlive" => true,
- "icon" => "solar:document-text-outline",
- "order" => 4,
- "title" => "log.title",
- ],
- "name" => "Log",
- "path" => "/log",
- "children" => [
- [
- "meta" => [
- "title" => "log.agent_title",
- "icon" => "solar:document-add-linear",
- "keepAlive" => true,
- ],
- "name" => "LogAgent",
- "path" => "/log/agent",
- "children" => [
- [
- "meta" => [
- "title" => "log.login_title",
- "keepAlive" => true,
- ],
- "name" => "LogAgentLogin",
- "path" => "/log/agent/login",
- "component" => "/log/agent/login/index.vue",
- ],
- [
- "meta" => [
- "title" => "log.operation_title",
- "keepAlive" => true,
- ],
- "name" => "LogOperation",
- "path" => "/log/agent/operation",
- "component" => "/log/agent/operation/index.vue",
- ],
- ],
- ],
- ],
- ];
- // 权限管理
- $webMenu[] = [
- "meta" => [
- "icon" => "solar:verified-check-outline",
- "keepAlive" => true,
- "order" => 4,
- "title" => "user.title",
- ],
- "name" => "Permission",
- "path" => "/user",
- "children" => [
- [
- "meta" => [
- "title" => "user.role_list",
- "icon" => "solar:shield-user-outline",
- ],
- "name" => "RoleList",
- "path" => "/user/role-list",
- "component" => "/user/role_list/index.vue",
- ],
- [
- "meta" => [
- "title" => "user.user_list",
- "icon" => "solar:users-group-rounded-outline",
- ],
- "name" => "UserList",
- "path" => "/user/user-list",
- "component" => "/user/user_list/index.vue",
- ],
- ],
- ];
- try {
- $menus = MenuService::getMenuTree($this->userId);
- $menus = $webMenu;
- return json_success($menus);
- } catch (\Exception $e) {
- return json_error('获取菜单失败:' . $e->getMessage());
- }
- }
- /**
- * 获取所有权限配置(用于角色权限分配)
- */
- public function getAllPermissions()
- {
- try {
- $permissions = PermissionService::getAllPermissions();
- return json_success($permissions);
- } catch (\Exception $e) {
- return json_error([], '获取权限配置失败:' . $e->getMessage());
- }
- }
- }
|