Mẫu cấu hình đối tượng danh mục trò chơi tĩnh bằng JavaScript và JSON.
JavaScript
// Ví dụ đối tượng cấu hình danh mục trò chơi c1688 cục bộ
const localGameConfig = {
brand: "c1688",
country: "vn",
supportedPlatform: "android",
games: [
{ id: "091", name: "Candy Superwin", category: "Trò chơi Slot" },
{ id: "125", name: "Alchemy Gold", category: "Trò chơi Slot" },
{ id: "003", name: "Fortune Gods", category: "Trò chơi Slot" }
],
defaultLanguage: "Tiếng Việt"
};
function getGameById(id) {
return localGameConfig.games.find(item => item.id === id) || null;
}
JSON
{
"brand": "c1688",
"country": "vn",
"supportedPlatform": "android",
"games": [
{
"id": "091",
"name": "Candy Superwin",
"category": "Trò chơi Slot"
},
{
"id": "125",
"name": "Alchemy Gold",
"category": "Trò chơi Slot"
},
{
"id": "003",
"name": "Fortune Gods",
"category": "Trò chơi Slot"
}
],
"defaultLanguage": "Tiếng Việt"
}