Cấu hình mẫu JavaScript và JSON để kiểm tra tính nhất quán của danh mục trò chơi.
{ } example.js{ } example.json
Sao chép mã
JavaScript
// Ví dụ cấu hình dữ liệu trò chơi BL555 nội bộ
const bl555LocalConfig = {
brand: 'BL555' ,
platform: 'android' ,
defaultCategory: 'Nổ hũ' ,
localCatalog: [
{ id: '036' , name: 'Jungle Delight' , active: true },
{ id: '083' , name: 'Fortune Ox' , active: true },
{ id: '130' , name: 'Rave Party Fvr' , active: true },
{ id: '082' , name: 'Gdn Ice Fire' , active: true },
{ id: '081' , name: 'Galactic Gems' , active: true }
]
};
function validateGameId(id) {
return bl555LocalConfig.localCatalog.some(item => item.id === id);
}
// Kiểm tra cục bộ mã trò chơi
console.log('Mã 083 hợp lệ:' , validateGameId('083' )); JSON
{
"brand" : "BL555" ,
"platform" : "android" ,
"defaultCategory" : "Nổ hũ" ,
"localCatalog" : [
{
"id" : "036" ,
"name" : "Jungle Delight" ,
"active" : true
},
{
"id" : "083" ,
"name" : "Fortune Ox" ,
"active" : true
},
{
"id" : "130" ,
"name" : "Rave Party Fvr" ,
"active" : true
},
{
"id" : "082" ,
"name" : "Gdn Ice Fire" ,
"active" : true
},
{
"id" : "081" ,
"name" : "Galactic Gems" ,
"active" : true
}
]
}