Ver código fonte

解锁界面用接口上报

SunnyLinSD 6 anos atrás
pai
commit
d1c238f1fa

+ 9 - 3
assets/scripts/levelHome/LevelHomeItem.js

@@ -798,9 +798,15 @@ cc.Class({
             // 当前楼层未解锁
             this.unlockBuildingRecord[this.buildingInfo.buildingId - 1] = 1;
             GameModule.userInfo.grossIncome -= this.buildingInfo.unlockScore;
-            GameModule.userInfo.recordUnlockModify.push(buildModel);
-            // 成功解锁后立刻调用上报,提交ub
-            GameModule.userInfo.doReport()
+
+            HomeApi.buildingUnlock(this.buildingInfo.buildingId, () => {
+
+            }, (err) => {
+                console.log(`============> ${this.buildingInfo.buildingId}解锁失败!!!! <============`)
+            })
+            // GameModule.userInfo.recordUnlockModify.push(buildModel);
+            // // 成功解锁后立刻调用上报,提交ub
+            // GameModule.userInfo.doReport()
         }
 
         GameModule.userInfo.stars += 1;

+ 11 - 0
assets/scripts/net/HomeApi.js

@@ -218,6 +218,17 @@ class HomeApi {
         Api.httpPost(this.setRequestBody('/item/collect.do', {'buildingId':buildingId}, success, fail))
     }
 
+
+    /**
+     * 解锁建筑接口
+     * @param {*} buildingId 
+     * @param {*} success 
+     * @param {*} fail 
+     */
+    static buildingUnlock(buildingId, success, fail) {
+        Api.httpPost(this.setRequestBody('/building/unlock.do', {'buildingId':buildingId}, success, fail))
+    }
+
     // 生成一个 RequestBody, 总是要写重复代码, 太恶心了
     static setRequestBody(url, data, success, fail) {
         let requestBody = {