|
@@ -166,12 +166,16 @@ class GameLogic extends BaseLogic
|
|
|
}
|
|
}
|
|
|
$query->where('status', 1);
|
|
$query->where('status', 1);
|
|
|
$query->order('sort', 'desc');
|
|
$query->order('sort', 'desc');
|
|
|
- $game_list = $this->getList($query);
|
|
|
|
|
|
|
+ $gameList = $this->getList($query);
|
|
|
|
|
|
|
|
|
|
+ return $this->gameTree($gameList);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public function gameTree($gameList)
|
|
|
|
|
+ {
|
|
|
$mainGameMap = $this->gameMainLogic->getMainGameMap();
|
|
$mainGameMap = $this->gameMainLogic->getMainGameMap();
|
|
|
-
|
|
|
|
|
- $groupedGames = [];
|
|
|
|
|
- foreach ($game_list as $game) {
|
|
|
|
|
|
|
+ $groupedGames = [];
|
|
|
|
|
+ foreach ($gameList as $game) {
|
|
|
$mainId = $game['main_id'];
|
|
$mainId = $game['main_id'];
|
|
|
$groupedGames[$mainId]['id'] = 'main_id_'.$mainId;
|
|
$groupedGames[$mainId]['id'] = 'main_id_'.$mainId;
|
|
|
$groupedGames[$mainId]['name'] = $mainGameMap[$mainId] ?? $mainId;
|
|
$groupedGames[$mainId]['name'] = $mainGameMap[$mainId] ?? $mainId;
|
|
@@ -179,10 +183,9 @@ class GameLogic extends BaseLogic
|
|
|
'id' => $game['id'],
|
|
'id' => $game['id'],
|
|
|
'name' => '['.$game['id'].']'.$game['name']
|
|
'name' => '['.$game['id'].']'.$game['name']
|
|
|
];
|
|
];
|
|
|
- }
|
|
|
|
|
|
|
+ }
|
|
|
return array_values($groupedGames);
|
|
return array_values($groupedGames);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
/**
|
|
/**
|
|
|
* 根据权限获取游戏列表
|
|
* 根据权限获取游戏列表
|
|
|
*/
|
|
*/
|
|
@@ -234,10 +237,10 @@ class GameLogic extends BaseLogic
|
|
|
}
|
|
}
|
|
|
$query->where('status', 1);
|
|
$query->where('status', 1);
|
|
|
$query->order('sort', 'desc');
|
|
$query->order('sort', 'desc');
|
|
|
- $game_list = $query->select()->toArray();
|
|
|
|
|
|
|
+ $gameList = $query->select()->toArray();
|
|
|
$mainGameMap = $this->gameMainLogic->getMainGameMap();
|
|
$mainGameMap = $this->gameMainLogic->getMainGameMap();
|
|
|
$groupedGames = [];
|
|
$groupedGames = [];
|
|
|
- foreach ($game_list as $game) {
|
|
|
|
|
|
|
+ foreach ($gameList as $game) {
|
|
|
$mainId = $game['main_id'];
|
|
$mainId = $game['main_id'];
|
|
|
$groupedGames[$mainId]['id'] = 'main_id_'.$mainId;
|
|
$groupedGames[$mainId]['id'] = 'main_id_'.$mainId;
|
|
|
$groupedGames[$mainId]['disabled'] = ($where['single'] ?? false);
|
|
$groupedGames[$mainId]['disabled'] = ($where['single'] ?? false);
|
|
@@ -260,36 +263,24 @@ class GameLogic extends BaseLogic
|
|
|
|
|
|
|
|
{
|
|
{
|
|
|
$game_ids = $this->systemDeptLogic->getGameIdsByDeptId($dept_id);
|
|
$game_ids = $this->systemDeptLogic->getGameIdsByDeptId($dept_id);
|
|
|
- $game_list = [];
|
|
|
|
|
|
|
+
|
|
|
if($game_ids==='*'){
|
|
if($game_ids==='*'){
|
|
|
- $game_list = $this->model->where('status', 1)->order('sort', 'desc')->select()->toArray();
|
|
|
|
|
|
|
+ $gameList = $this->model->where('status', 1)->order('sort', 'desc')->select()->toArray();
|
|
|
}else{
|
|
}else{
|
|
|
- $game_list = $this->model->where('id', 'in', $game_ids)->where('status', 1)->order('sort', 'desc')->select()->toArray();
|
|
|
|
|
|
|
+ $gameList = $this->model->where('id', 'in', $game_ids)->where('status', 1)->order('sort', 'desc')->select()->toArray();
|
|
|
}
|
|
}
|
|
|
- $mainGameMap = $this->gameMainLogic->getMainGameMap();
|
|
|
|
|
-
|
|
|
|
|
- $groupedGames = [];
|
|
|
|
|
- foreach ($game_list as $game) {
|
|
|
|
|
- $mainId = $game['main_id'];
|
|
|
|
|
- $groupedGames[$mainId]['id'] = 'main_id_'.$mainId;
|
|
|
|
|
- $groupedGames[$mainId]['name'] = $mainGameMap[$mainId] ?? $mainId;
|
|
|
|
|
- $groupedGames[$mainId]['children'][] = [
|
|
|
|
|
- 'id' => $game['id'],
|
|
|
|
|
- 'name' => '['.$game['id'].']'.$game['name']
|
|
|
|
|
- ];
|
|
|
|
|
- }
|
|
|
|
|
- return array_values($groupedGames);
|
|
|
|
|
|
|
+ return $this->gameTree($gameList);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 设置部门游戏权限
|
|
* 设置部门游戏权限
|
|
|
* @param array $where
|
|
* @param array $where
|
|
|
- * @param array $game_list
|
|
|
|
|
|
|
+ * @param array $gameList
|
|
|
* @return void
|
|
* @return void
|
|
|
*/
|
|
*/
|
|
|
- public function setGameListByDeptId($dept_id, $game_list)
|
|
|
|
|
|
|
+ public function setGameListByDeptId($dept_id, $gameList)
|
|
|
{
|
|
{
|
|
|
- $this->systemDeptLogic->setGameListByDeptId($dept_id, $game_list);
|
|
|
|
|
|
|
+ $this->systemDeptLogic->setGameListByDeptId($dept_id, $gameList);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|