|
|
@@ -49,31 +49,44 @@ class GameGroupLogic extends BaseLogic
|
|
|
|
|
|
/**
|
|
|
* 给游戏分组用的游戏列表
|
|
|
+ * $where['game_group_id]
|
|
|
*/
|
|
|
- public function getGameListOptionsByGroup()
|
|
|
+ public function getGameListOptionsByGroup($where)
|
|
|
{
|
|
|
+
|
|
|
+ // 获取gameGroupId, 如果存在,则返回的游戏需要加上这个分组的game_list
|
|
|
+ $gameGroupId = $where['game_group_id'];
|
|
|
+
|
|
|
+
|
|
|
+ // 游戏分组数据
|
|
|
$data = $this->model->where('1=1')->order('sort', 'desc')->order('id', 'desc')->select()->toArray();
|
|
|
|
|
|
// 已经存在分组的game_list
|
|
|
$gameIdList = [];
|
|
|
-
|
|
|
foreach ($data as $item) {
|
|
|
- $temGameListArray = explode(',', $item['game_list']);
|
|
|
- $gameIdList = array_merge($gameIdList, $temGameListArray);
|
|
|
+ // 传入的分组,不加入筛选去除筛选,用于编辑回显示
|
|
|
+ if($item['id']!=$gameGroupId){
|
|
|
+ $temGameListArray = explode(',', $item['game_list']);
|
|
|
+ $gameIdList = array_merge($gameIdList, $temGameListArray);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- $where = [];
|
|
|
- $where[] = ['status', 1];
|
|
|
+ $groupWhere = [];
|
|
|
+ $groupWhere[] = ['status', '=', 1];
|
|
|
+
|
|
|
+
|
|
|
|
|
|
if (!empty($gameIdList)) {
|
|
|
- $where[] = ['id', 'notin', implode(',', $gameIdList)];
|
|
|
+ $groupWhere[] = [ 'id', 'notin', implode(',', $gameIdList)];
|
|
|
}
|
|
|
|
|
|
- $game = Db::connect('db_center')->table('pf_game')->where($where)->select()->toArray();
|
|
|
+ // 平台游戏
|
|
|
+ $pfCame = Db::connect('db_center')->table('pf_game')->where($groupWhere)->select()->toArray();
|
|
|
+
|
|
|
|
|
|
$mainGameMap = $this->gameMainLogic->getMainGameMap();
|
|
|
$groupedGames = [];
|
|
|
- foreach ($game as $item) {
|
|
|
+ foreach ($pfCame as $item) {
|
|
|
$mainId = $item['main_id'];
|
|
|
$groupedGames[$mainId]['id'] = 'main_id_'.$mainId;
|
|
|
$groupedGames[$mainId]['name'] = $mainGameMap[$mainId] ?? $mainId;
|