123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- const Api = require('../net/Api');
- class SkillApi {
- /**
- * 获取所有技能信息
- */
- static getAllSkills(success, fail) {
- let url = "/skill/getAllSkills";
- Api.httpGet(this.setRequestBody(url, {}, success, fail));
- }
- /// 根据skillId 购买技能 就最后三个技能需要购买
- static buySkill(skillId, success, fail) {
- let url = "/skill/buySkill";
- Api.httpPost(this.setRequestBody(url, {"skillId": skillId}, success, fail));
- }
- //// 升级楼层
- static upBuildingLevel(upLevel, success, fail) {
- let url = "/user/upBuildingLevel";
- Api.httpPost(this.setRequestBody(url, {'level': upLevel}, success, fail));
- }
- /**
- * 升级某个技能
- * skillId 技能id
- * level 当前技能等级
- */
- static upSkill(skillId, success, fail) {
- let url = "/skill/upSkill";
- let body = {
- "skillId" : skillId,
- };
- Api.httpPost(this.setRequestBody(url, body, success, fail));
- }
- /// 使用某个技能
- static useSkill(skillId, success, fail) {
- let url = "/skill/useSkill";
- let body = {
- "skillId": skillId,
- };
- Api.httpPost(this.setRequestBody(url, body, success, fail));
- }
- /// 重置技能
- static resetSkill(success, fail) {
- let url = "/skill/resetSkill";
- Api.httpGet(this.setRequestBody(url, {}, success, fail));
- }
- static resetSkill1(success, fail) {
- let url = '/skill/resetSkill1';
- Api.httpGet(this.setRequestBody(url, {}, success, fail));
- }
- /**
- * 上报数据
- * type 1看广告,2是分享,3是领取里程碑
- *
- */
- static report(type, success, fail) {
- let url = "/statistic/report";
- let body = {
- "type": type
- };
- Api.httpGet(this.setRequestBody(url, body, success, fail));
- }
-
- static setRequestBody(url, data, success, fail) {
- let requestBody = {
- url: url,
- data: data,
- success: success,
- fail: fail,
- complete: () => {
- }
- };
- return requestBody;
- }
- }
- module.exports = SkillApi;
|