const Api = require('./Api'); class StoreApi { /** * 根据类型获取商品列表 * type 商品类型(1推荐,2砖石,3金币,4礼包) */ static getShopsByType(typeId, success, fail) { let url = "/shop/getShopsByType"; Api.httpGet(this.setRequestBody(url, {'type': typeId}, success, fail)); } /** * 上报商品弹窗 */ static reportShop(shopId, success, fail) { let url = "/shop/report"; Api.httpPost(this.setRequestBody(url, {'shopId': shopId}, success, fail)); } //// 根据商品id 购买商品 static buyShop(shopId, success, fail) { let url = "/shop/buyShop"; Api.httpPost(this.setRequestBody(url, {'shopId': shopId}, success, fail)); } static setRequestBody(url, data, success, fail) { let requestBody = { url: url, data: data, success: success, fail: fail, complete: () => { } }; return requestBody; } } module.exports = StoreApi;