Mô phỏng cấu trúc danh mục trò chơi cục bộ bằng JavaScript và JSON.
{ } example.js{ } example.json
Sao chép mã
JavaScript
// Cấu hình tham chiếu danh mục trò chơi mẫu tại 789bet4game
const localPlatformConfig = {
brand: '789bet4game' ,
region: 'vn' ,
defaultLanguage: 'Tiếng Việt' ,
catalog: [
{ id: '083' , name: 'Fortune Ox' , category: 'Nổ hũ' , enabled: true },
{ id: '159' , name: 'Shark Bounty' , category: 'Bắn cá' , enabled: true },
{ id: '120' , name: 'Legend Perseus' , category: 'Nổ hũ' , enabled: true },
{ id: '070' , name: 'Genies Wishes' , category: 'Nổ hũ' , enabled: true },
{ id: '098' , name: 'Mermaid Riches' , category: 'Nổ hũ' , enabled: true }
],
filterCategory(categoryName) {
return this.catalog.filter(item => item.category === categoryName && item.enabled);
}
};
// Kiểm tra lọc danh sách sảnh Nổ hũ cục bộ
const slotsList = localPlatformConfig.filterCategory('Nổ hũ' );
console.log('Tổng số trò chơi nổ hũ khả dụng:' , slotsList.length); JSON
{
"brand" : "789bet4game" ,
"region" : "vn" ,
"defaultLanguage" : "Tiếng Việt" ,
"catalog" : [
{
"id" : "083" ,
"name" : "Fortune Ox" ,
"category" : "Nổ hũ" ,
"enabled" : true
},
{
"id" : "159" ,
"name" : "Shark Bounty" ,
"category" : "Bắn cá" ,
"enabled" : true
},
{
"id" : "120" ,
"name" : "Legend Perseus" ,
"category" : "Nổ hũ" ,
"enabled" : true
},
{
"id" : "070" ,
"name" : "Genies Wishes" ,
"category" : "Nổ hũ" ,
"enabled" : true
},
{
"id" : "098" ,
"name" : "Mermaid Riches" ,
"category" : "Nổ hũ" ,
"enabled" : true
}
]
}