whereIn('KindID', $openGames) ->select('KindName', 'KindID') ->pluck('KindName', 'KindID')->toArray(); // 用户游戏局数 $gameCount = DB::table(TableName::QPRecordDB() . 'RecordUserGameCount') ->where('UserID',$UserID) ->whereIn('GameID', $openGames) ->pluck('Cnt', 'GameID')->toArray(); $data = []; foreach ($gameNames as $key => &$value){ $data[$value] = $gameCount[$key] ?? 0; } return $data; } }