Pārlūkot izejas kodu

更新最大产品到服务器发送数据修改

kaka 4 gadi atpakaļ
vecāks
revīzija
1f54e79af9
1 mainītis faili ar 9 papildinājumiem un 11 dzēšanām
  1. 9 11
      assets/script/game/data/GameData.ts

+ 9 - 11
assets/script/game/data/GameData.ts

@@ -752,8 +752,7 @@ export class GameData {
             }
         }
 
-        if(!isAddMaxProduct)
-        {
+        if (!isAddMaxProduct) {
             mk.event.emit("refreshFarmMapUI");
         }
         this.setProp(GameProp.productMakeTimes, this._productMakeTimesData);
@@ -1030,7 +1029,7 @@ export class GameData {
         }
 
         if (!has && unlock) {
-            data = { tab: config.tab, productID: id };
+            data = { tab: config.tab, productID: id, id: config.id };
             this._maxProduct.push(data);
         }
 
@@ -1171,14 +1170,13 @@ export class GameData {
     /** 更新最大可种植产品到服务器 */
     async updateMaxProduct() {
         if (this.maxProductToServer) {
-            let data = {"unLockProductList": []};      
-            for(let i = 0; i != this._maxProduct.length; ++i)
-            {
-                let dataE = this._maxProduct[i];
-                let d = {id: dataE.productID, tab: dataE.tab};
-                data.unLockProductList.push(d);
-            }
-            let respone =await mk.http.sendData('orderTask/updateUnlockProduct', data);
+            let data = { "unLockProductList": this._maxProduct };
+            // for (let i = 0; i != this._maxProduct.length; ++i) {
+            //     let dataE = this._maxProduct[i];
+            //     let d = { id: dataE.productID, tab: dataE.tab };
+            //     data.unLockProductList.push(d);
+            // }
+            let respone = await mk.http.sendData('orderTask/updateUnlockProduct', data);
             console.log("------");
         }
     }