const Api = require('./Api'); class HomeApi { /** * 获取我的小程序礼包 */ static getUserBuildings(success, fail) { let url = "/room/getAllRooms.do"; Api.httpGet(this.setRequestBody(url, {}, success, fail)); } /** * 上报接口 * @param {*} reportFormInfo {"grossIncome":1000,"grossRate":10000,"stars":1} * @param {*} success * @param {*} fail */ static userReportGross(reportFormInfo, success, fail) { let url = "/room/reportGold.do"; let data = { reportFormInfo: reportFormInfo, }; Api.httpPost(this.setRequestBody(url, data, success, fail)); } //上报楼层等级接口 static userReportRooms(reportFormInfo, success, fail) { let url = "/room/reportRooms.do"; let data = { reportFormInfo: reportFormInfo, }; Api.httpPost(this.setRequestBody(url, data, success, fail)); } /** * 举报艺人 * @param {*} formmInfoJson * @param {*} success * @param {*} fail */ static getAppletAward(success, fail) { let url = "/user/appletAward.do"; Api.httpGet(this.setRequestBody(url, {}, success, fail)); } //领取房间里程碑奖励 static getRoomAward(roomId, level, success, fail) { let url = "/room/award.do"; let data = { roomId: roomId, level: level }; Api.httpPost(this.setRequestBody(url, data, success, fail)); } // 退出游戏 static exitGame(success, fail) { let url = "/user/exitGame.do"; Api.httpGet(this.setRequestBody(url, {}, success, fail)); } static getInformation(success, fail) { let url = '/information/getInformation'; Api.httpGet(this.setRequestBody(url, {}, success, fail)); } /// 上报免费看广告升级的次数 /// 上报类型1升级总部大楼,2升级房间等级,3购买明星 static reportInformation(type, success, fail) { let url = '/information/report'; let data = { 'type': type } Api.httpPost(this.setRequestBody(url, data, success, fail)); } // //// 获取用户商品信息 // static getUserShopData() { // let url = '/shop/getUserShops'; // Api.httpGet(this.setRequestBody(url, {}, success, fail)); // } // 生成一个 RequestBody, 总是要写重复代码, 太恶心了 static setRequestBody(url, data, success, fail) { let requestBody = { url: url, data: data, success: success, fail: fail, complete: () => { } }; return requestBody; } } module.exports = HomeApi;