|
@@ -62,14 +62,15 @@ class GameLogic extends BaseLogic
|
|
|
}, $list);
|
|
}, $list);
|
|
|
return $list;
|
|
return $list;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
- * 处理游戏tree数据
|
|
|
|
|
- * @return array
|
|
|
|
|
|
|
+ * 获取所有的游戏数据
|
|
|
*/
|
|
*/
|
|
|
- public function getGameTree($game_list)
|
|
|
|
|
|
|
+ public function getAllGameData()
|
|
|
{
|
|
{
|
|
|
- $mainGameMap = $this->gameMainLogic->getMainGameMap();
|
|
|
|
|
|
|
+ $game_list = $this->model->where('status', 1)->order('sort', 'desc')->select()->toArray();
|
|
|
|
|
+
|
|
|
|
|
+ $mainGameMap = $this->gameMainLogic->getMainGameMap();
|
|
|
|
|
|
|
|
$groupedGames = [];
|
|
$groupedGames = [];
|
|
|
foreach ($game_list as $game) {
|
|
foreach ($game_list as $game) {
|
|
@@ -81,17 +82,7 @@ class GameLogic extends BaseLogic
|
|
|
'name' => $game['name']
|
|
'name' => $game['name']
|
|
|
];
|
|
];
|
|
|
}
|
|
}
|
|
|
- $game_list = array_values($groupedGames);
|
|
|
|
|
- return $game_list;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 获取所有的游戏数据
|
|
|
|
|
- */
|
|
|
|
|
- public function getAllGameData()
|
|
|
|
|
- {
|
|
|
|
|
- $game_list = $this->model->where('status', 1)->order('sort', 'desc')->select()->toArray();
|
|
|
|
|
- return $this->getGameTree($game_list);
|
|
|
|
|
|
|
+ return array_values($groupedGames);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -100,14 +91,28 @@ class GameLogic extends BaseLogic
|
|
|
* @return array
|
|
* @return array
|
|
|
*/
|
|
*/
|
|
|
public function getGameListByDeptId($dept_id)
|
|
public function getGameListByDeptId($dept_id)
|
|
|
|
|
+
|
|
|
{
|
|
{
|
|
|
- $game_ids = $this->systemDeptLogic->getGameListByDeptId($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();
|
|
$game_list = $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();
|
|
$game_list = $this->model->where('id', 'in', $game_ids)->where('status', 1)->order('sort', 'desc')->select()->toArray();
|
|
|
}
|
|
}
|
|
|
- return $game_list;
|
|
|
|
|
|
|
+ $mainGameMap = $this->gameMainLogic->getMainGameMap();
|
|
|
|
|
+
|
|
|
|
|
+ $groupedGames = [];
|
|
|
|
|
+ foreach ($game_list as $game) {
|
|
|
|
|
+ $mainId = $game['main_id'];
|
|
|
|
|
+ $groupedGames[$mainId]['id'] = $mainId;
|
|
|
|
|
+ $groupedGames[$mainId]['name'] = $mainGameMap[$mainId] ?? $mainId;
|
|
|
|
|
+ $groupedGames[$mainId]['children'][] = [
|
|
|
|
|
+ 'id' => $game['id'],
|
|
|
|
|
+ 'name' => $game['name']
|
|
|
|
|
+ ];
|
|
|
|
|
+ }
|
|
|
|
|
+ return array_values($groupedGames);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|