|
|
@@ -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);
|
|
|
}
|
|
|
});
|
|
|
},
|