const axios = require('axios'); async function mobapay(uid, zone) { try { const { data } = await axios.get('https://api.mobapay.com/api/app_shop', { headers: { 'content-type': 'application/json' }, params: { app_id: 100000, game_user_key: uid, game_server_key: zone, country: 'ID', language: 'en', shop_id: 1001 } }); const first_recharge = data.data.shop_info.good_list.filter(item => item.label && item.label.caption === '首充商品角标').map(item => ({ title: item.title, available: !item.goods_limit.reached_limit })); const first_recharge2 = data.data.shop_info.shelf_location[0].goods.filter(item => item.label && item.label.caption === '首充商品角标').map(item => ({ title: item.title, available: !item.goods_limit.reached_limit })); return { username: data.data.user_info.user_name, uid: uid, zone: zone, first_recharge: [...first_recharge, ...first_recharge2] }; } catch (error) { throw new Error(error.message); } } // Usage: const resp = await mobapay('1422073161', '15910'); console.log(resp);