浏览代码

最后修复版本

slambb 3 年之前
父节点
当前提交
f45ee2082a

+ 1 - 1
assets/Prefabs/UI/seed/HolyFarmlandSeedStore.prefab

@@ -994,7 +994,7 @@
     },
     "component": "",
     "_componentId": "22ed83kVv5KeZS7uv2u6vw7",
-    "handler": "onPaySNBPopView",
+    "handler": "onPayCNTPopView",
     "customEventData": ""
   },
   {

+ 2 - 2
assets/Scene/MyCityScene - 004.fire

@@ -718,7 +718,7 @@
       "__type__": "cc.Vec3",
       "x": 0,
       "y": 0,
-      "z": 368.9268220121709
+      "z": 523.079343885801
     },
     "_scale": {
       "__type__": "cc.Vec3",
@@ -862,7 +862,7 @@
       "__type__": "cc.Vec3",
       "x": 0,
       "y": 0,
-      "z": 368.9268220121709
+      "z": 523.079343885801
     },
     "_scale": {
       "__type__": "cc.Vec3",

+ 5 - 0
assets/Script/Lease/LeaseSaleInfo.js

@@ -97,6 +97,11 @@ cc.Class({
                 GlobalD.GameData.showToast(cc.find('Canvas/UICamera'), "成功售卖了!", 2, () => {
                     console.log("finish toast!");
                 });
+
+                //更新日志列表
+                 //更新日志数据
+                 cc.find("GameNode/ManageDapp").getComponent("ManageDapp").onUpdateSnbList();
+                
             } else {
                 GlobalD.GameData.showToast(cc.find('Canvas/UICamera'), value.msg, 2, () => {
                     console.log("finish toast!");

+ 17 - 21
assets/Script/UI/StoreView.js

@@ -299,33 +299,29 @@ cc.Class({
         console.log('this.snbAmount=', this.cntAmount)
         console.log('priceSnb price=', this.mySeedList[this.buySeedIndex].priceSnb)
         console.log('this.snbAmount price=', this.cntAmount * parseInt(this.mySeedList[this.buySeedIndex].priceSnb))
-
-        //购买种子也要使用轮询
-
-        let currentAmount = 0;
-
-        for (let i = 0; i < this.myWareHouseSeedList.length; i++) {
-            if (this.myWareHouseSeedList[i].id == this.mySeedList[this.buySeedIndex].id) {
-                currentAmount = this.myWareHouseSeedList[i].amount;
-            }
-        }
+        // let currentAmount = 0;
+        // for (let i = 0; i < this.myWareHouseSeedList.length; i++) {
+        //     if (this.myWareHouseSeedList[i].id == this.mySeedList[this.buySeedIndex].id) {
+        //         currentAmount = this.myWareHouseSeedList[i].amount;
+        //     }
+        // }
         //当前背包的数量
-        console.log("currentAmount:", {
-            seedId: this.mySeedList[this.buySeedIndex].id,
-            currentAmount: currentAmount //把当前背包的数据传进去
-        });
-
-        GlobalD.GameData.onBuySeedsWithSNB(this.cntAmount * parseInt(this.mySeedList[this.buySeedIndex].priceSnb), this.mySeedList[this.buySeedIndex].id, (res, value) => {
-            if (0 === value.code) 
-            {
-                // TODO 成功, 支付为链上操作,需要提供回调接口给这边服务端确认交易成功后修改购买订单结果
-                console.log('snb res =====',res) // 交易hash,唯一标识符
-                console.log('snb value =====',value) // 交易hash,唯一标识符
+        // console.log("currentAmount:", {
+        //     seedId: this.mySeedList[this.buySeedIndex].id,
+        //     currentAmount: currentAmount //把当前背包的数据传进去
+        // });
+        console.log("支付价格:"+this.cntAmount * parseInt(this.mySeedList[this.buySeedIndex].priceCnt*5));
+        GlobalD.GameData.onBuySeedsWithSNB(this.cntAmount * parseInt(this.mySeedList[this.buySeedIndex].priceCnt*5), this.mySeedList[this.buySeedIndex].id, (res, value) => {
+            console.log('snb res =====', res) // 交易hash,唯一标识符
+            console.log('snb value =====', value) // 交易hash,唯一标识符
+            if (0 === value.code) {
                 //todo 种子
                 GlobalD.GameData.showToast(cc.find("Canvas/UICamera"), "种子购买成功!", 5);
                 this.PaySNBPopView.active = false;
                 //直接重新初始化一下列表,
                 this.buildingViewScript.onUpdateList();
+            } else {
+                GlobalD.GameData.showToast(cc.find("Canvas/UICamera"), value.msg, 5);
             }
         });
     },

+ 9 - 3
assets/Script/adpp/ManageDapp.js

@@ -163,8 +163,8 @@ cc.Class({
         }, this);
         //snb数据
         GlobalD.GameData.onGetSnbInfoList(this.snbPage, this.snbLimit, (data) => {
-            // console.log("==========",data);
-            this.snbData = data.rows;
+            console.log("==========",data);
+            this.snbData = data.content;
         });
 
         this.snbShowNode.on(cc.Node.EventType.TOUCH_END, function (event) {
@@ -182,7 +182,13 @@ cc.Class({
         });
 
     },
-    
+    onUpdateSnbList(){
+        GlobalD.GameData.onGetSnbInfoList(this.snbPage, this.snbLimit, (data) => {
+            // console.log("==========",data);
+            this.snbData = data.content;
+            this.ListInfoNode.getComponent("dappListInfo").onShowList("snbList", this.snbData);
+        });
+    },
 
     start() {
         /**

+ 4 - 4
assets/Script/adpp/dappListInfo.js

@@ -111,7 +111,7 @@ cc.Class({
         this.load_recode(this.start_index);
     },
     //更新cntList
-    onCntUpdateList(list){
+    onCntUpdateList(list) {
         this.cntData = list;
     },
     //切换数据
@@ -164,8 +164,8 @@ cc.Class({
                 let _temp = {
                     listItemName: _item.tranName + _item.tranAmount + "个",
                     listItemDate: _item.createTime,
-                    remainder: _item.tranSnb,
-                    amount: _item.afterSnb,
+                    remainder: _item.afterSnb,
+                    amount: _item.isAdd == 1 ? '+' + _item.tranSnb : '-' + _item.tranSnb,
                 }
                 _infoScript.setInfo(_temp);
             } else if (this.listType == listInfoType.cnt) {
@@ -173,7 +173,7 @@ cc.Class({
                     listItemName: "兑换后的cnt数:" + Math.floor(_item.now_amount * 100) / 100,
                     listItemDate: _item.create_time,
                     remainder: Math.floor(_item.amount * 100) / 100,
-                    amount:'',
+                    amount: '',
                 }
                 _infoScript.setCntInfo(_temp);
             }

+ 10 - 5
assets/Script/public/GameData.js

@@ -1200,9 +1200,9 @@ cc.Class({
             console.warn("GlobalD.dapp未初始化,不能onSnbToCnt!");
             return;
         }
-        GlobalD.GameData.showToast(cc.find("Canvas/UICamera"), "暂不支持兑换CNT!", 2, () => {
-            console.log("finish toast!");
-        });
+        // GlobalD.GameData.showToast(cc.find("Canvas/UICamera"), "暂不支持兑换CNT!", 2, () => {
+        //     console.log("finish toast!");
+        // });
         // return;
         if (this.isPlayingSnb) {
             console.warn("同时触发支付SNB过快!");
@@ -1216,8 +1216,13 @@ cc.Class({
             return;
         }
 
+        GlobalD.GameData.showToast(cc.find("Canvas/UICamera"), "已发起兑换!", 5, () => {
+            console.log("finish toast!");
+        });
         this.isPlayingSnb = true;
         GlobalD.dapp.snbToCnt(snbAmount).then((data) => {
+            //更新日志数据
+            cc.find("GameNode/ManageDapp").getComponent("ManageDapp").onUpdateSnbList();
             const [err, tx] = data;
             this.isPlayingSnb = false;
             if (err === null) {
@@ -1233,7 +1238,7 @@ cc.Class({
                 });
 
 
-                GlobalD.GameData.showToast(cc.find("Canvas/UICamera"), "区块确认中,请耐心等待!", 2, () => {
+                GlobalD.GameData.showToast(cc.find("Canvas/UICamera"), "区块确认中,请耐心等待!", 5, () => {
                     console.log("finish toast!");
                 });
 
@@ -1333,7 +1338,7 @@ cc.Class({
     onGetSnbInfoList(page, limit, callback) {
 
         utils.get(utils.api.snbList, { page: page, limit: limit }, (res, value) => {
-            // console.log("snb操作日志", value);
+            console.log("snb操作日志", value);
             if (0 === value.code) {
                 if (callback)
                     callback(value.data);