更新支付配置
This commit is contained in:
parent
86a184926b
commit
9e627d3b69
File diff suppressed because it is too large
Load Diff
|
@ -39,6 +39,7 @@ export default class GameManager extends cc.Component {
|
||||||
load3: boolean = false;
|
load3: boolean = false;
|
||||||
load4: boolean = false;
|
load4: boolean = false;
|
||||||
load5: boolean = false;
|
load5: boolean = false;
|
||||||
|
load6: boolean = false;
|
||||||
scheduleCallback: any;
|
scheduleCallback: any;
|
||||||
timeNumber: number;
|
timeNumber: number;
|
||||||
|
|
||||||
|
@ -55,7 +56,7 @@ export default class GameManager extends cc.Component {
|
||||||
this.readMusicConfig();
|
this.readMusicConfig();
|
||||||
|
|
||||||
|
|
||||||
this.load1 = this.load2 = this.load3 = this.load4 = this.load5 = false;
|
this.load1 = this.load2 = this.load3 = this.load4 = this.load5 = this.load6 = false;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.readUserData();
|
this.readUserData();
|
||||||
}, 200);
|
}, 200);
|
||||||
|
@ -214,6 +215,11 @@ export default class GameManager extends cc.Component {
|
||||||
MiniGameSdk.API.shushu_Init();
|
MiniGameSdk.API.shushu_Init();
|
||||||
Utils.getUserInfo((data) => {
|
Utils.getUserInfo((data) => {
|
||||||
console.log("登陆成功", data);
|
console.log("登陆成功", data);
|
||||||
|
if (data.outTradeNo.length > 0) {
|
||||||
|
console.log("______________________________有未发放奖励");
|
||||||
|
cc.fx.GameConfig.GM_INFO.allOutTradeNo = data.outTradeNo;
|
||||||
|
}
|
||||||
|
this.load6 = true;
|
||||||
});
|
});
|
||||||
let levelInfo = cc.fx.StorageMessage.getStorage("level");
|
let levelInfo = cc.fx.StorageMessage.getStorage("level");
|
||||||
//旧的读取数据设置数据方法,以强联网为主
|
//旧的读取数据设置数据方法,以强联网为主
|
||||||
|
@ -235,6 +241,7 @@ export default class GameManager extends cc.Component {
|
||||||
this.load3 = true;
|
this.load3 = true;
|
||||||
this.load4 = true;
|
this.load4 = true;
|
||||||
this.load5 = true;
|
this.load5 = true;
|
||||||
|
this.load6 = true;
|
||||||
cc.fx.GameTool.getHealth(null);
|
cc.fx.GameTool.getHealth(null);
|
||||||
}
|
}
|
||||||
// 存储用户数据
|
// 存储用户数据
|
||||||
|
@ -682,7 +689,7 @@ export default class GameManager extends cc.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
update(dt) {
|
update(dt) {
|
||||||
if (this.load1 && this.load2 && this.load3 && this.load4 && this.load5 && this.timeNumber <= 0) {
|
if (this.load1 && this.load2 && this.load3 && this.load4 && this.load5 && this.load6 == true && this.timeNumber <= 0) {
|
||||||
this.load1 = this.load2 = false;
|
this.load1 = this.load2 = false;
|
||||||
MiniGameSdk.API.shushu_Login();
|
MiniGameSdk.API.shushu_Login();
|
||||||
MiniGameSdk.API.yinli_Init();
|
MiniGameSdk.API.yinli_Init();
|
||||||
|
|
|
@ -247,7 +247,7 @@ export default class MapConroler extends cc.Component {
|
||||||
this.add_Time = 0;
|
this.add_Time = 0;
|
||||||
NumberToImage.getTimeMargin(this.timeNumber, 50, "time_", this.timeLabel)
|
NumberToImage.getTimeMargin(this.timeNumber, 50, "time_", this.timeLabel)
|
||||||
|
|
||||||
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true);
|
this.updateCoin();
|
||||||
// var timeTemp = cc.fx.GameTool.getTimeMargin(this.timeNumber);
|
// var timeTemp = cc.fx.GameTool.getTimeMargin(this.timeNumber);
|
||||||
// this.timeLabel.string = timeTemp.toString();
|
// this.timeLabel.string = timeTemp.toString();
|
||||||
NumberToImage.numberToImageNodes((cc.fx.GameConfig.GM_INFO.level + 1), 50, 20, "level_", this.levelLabel, true)
|
NumberToImage.numberToImageNodes((cc.fx.GameConfig.GM_INFO.level + 1), 50, 20, "level_", this.levelLabel, true)
|
||||||
|
@ -1520,7 +1520,8 @@ export default class MapConroler extends cc.Component {
|
||||||
}
|
}
|
||||||
cc.fx.GameTool.shushu_Track("resource_cost", dataTemp);
|
cc.fx.GameTool.shushu_Track("resource_cost", dataTemp);
|
||||||
MiniGameSdk.API.showToast("继续游戏");
|
MiniGameSdk.API.showToast("继续游戏");
|
||||||
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true);
|
this.updateCoin();
|
||||||
|
// NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true);
|
||||||
if (data.type == "time") {
|
if (data.type == "time") {
|
||||||
if (cc.fx.GameConfig.GM_INFO.review < 2)
|
if (cc.fx.GameConfig.GM_INFO.review < 2)
|
||||||
cc.fx.GameConfig.GM_INFO.review += 1;
|
cc.fx.GameConfig.GM_INFO.review += 1;
|
||||||
|
@ -1791,7 +1792,8 @@ export default class MapConroler extends cc.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
handleBuySuccess(data) {
|
handleBuySuccess(data) {
|
||||||
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true);
|
this.node.parent.parent.parent.getComponent("SceneManager").resetBtn();
|
||||||
|
this.updateCoin();
|
||||||
this.pause = false;
|
this.pause = false;
|
||||||
this.startBoom();
|
this.startBoom();
|
||||||
const timestamp = Date.now();
|
const timestamp = Date.now();
|
||||||
|
@ -1850,6 +1852,10 @@ export default class MapConroler extends cc.Component {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateCoin() {
|
||||||
|
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true);
|
||||||
|
}
|
||||||
|
|
||||||
//使用锤子道具
|
//使用锤子道具
|
||||||
useHammer() {
|
useHammer() {
|
||||||
if (this.node.parent.getChildByName("Ice").active == true || this.hammer == true
|
if (this.node.parent.getChildByName("Ice").active == true || this.hammer == true
|
||||||
|
@ -1899,6 +1905,7 @@ export default class MapConroler extends cc.Component {
|
||||||
buyMagic() {
|
buyMagic() {
|
||||||
if (cc.fx.GameConfig.GM_INFO.coin < 1500) {
|
if (cc.fx.GameConfig.GM_INFO.coin < 1500) {
|
||||||
MiniGameSdk.API.showToast("金币不足,无法购买道具");
|
MiniGameSdk.API.showToast("金币不足,无法购买道具");
|
||||||
|
this.node.parent.parent.parent.getComponent("SceneManager").resetBtn();
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.openShop();
|
this.openShop();
|
||||||
}, 500);
|
}, 500);
|
||||||
|
@ -1910,6 +1917,7 @@ export default class MapConroler extends cc.Component {
|
||||||
buyHammer() {
|
buyHammer() {
|
||||||
if (cc.fx.GameConfig.GM_INFO.coin < 1000) {
|
if (cc.fx.GameConfig.GM_INFO.coin < 1000) {
|
||||||
MiniGameSdk.API.showToast("金币不足,无法购买道具");
|
MiniGameSdk.API.showToast("金币不足,无法购买道具");
|
||||||
|
this.node.parent.parent.parent.getComponent("SceneManager").resetBtn();
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.openShop();
|
this.openShop();
|
||||||
}, 500);
|
}, 500);
|
||||||
|
@ -1921,6 +1929,7 @@ export default class MapConroler extends cc.Component {
|
||||||
buyFreeze() {
|
buyFreeze() {
|
||||||
if (cc.fx.GameConfig.GM_INFO.coin < 1500) {
|
if (cc.fx.GameConfig.GM_INFO.coin < 1500) {
|
||||||
MiniGameSdk.API.showToast("金币不足,无法购买道具");
|
MiniGameSdk.API.showToast("金币不足,无法购买道具");
|
||||||
|
this.node.parent.parent.parent.getComponent("SceneManager").resetBtn();
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.openShop();
|
this.openShop();
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|
|
@ -96,10 +96,10 @@ export default class SceneManager extends cc.Component {
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
}
|
}
|
||||||
//更新关卡获得金币
|
//更新关卡获得金币
|
||||||
updateWinCoin() {
|
updateWinCoin() {
|
||||||
console.log("更新关卡获得金币");
|
console.log("更新关卡获得金币");
|
||||||
let winCoin = 40;
|
let winCoin = 40;
|
||||||
if (winCoin > 0) {
|
if (winCoin > 0) {
|
||||||
NumberToImage.numberToImageNodes(winCoin, 50, 8, "time_", this.winCoin, false);
|
NumberToImage.numberToImageNodes(winCoin, 50, 8, "time_", this.winCoin, false);
|
||||||
} else {
|
} else {
|
||||||
|
@ -118,7 +118,7 @@ export default class SceneManager extends cc.Component {
|
||||||
this.node.getChildByName("Game").getChildByName("bg").getComponent(cc.Sprite).spriteFrame = spriteFrame;
|
this.node.getChildByName("Game").getChildByName("bg").getComponent(cc.Sprite).spriteFrame = spriteFrame;
|
||||||
})
|
})
|
||||||
|
|
||||||
NumberToImage.numberToImageNodes((cc.fx.GameConfig.GM_INFO.level+1), 43, 15, "level_", this.level, true);
|
NumberToImage.numberToImageNodes((cc.fx.GameConfig.GM_INFO.level + 1), 43, 15, "level_", this.level, true);
|
||||||
//time金币数量
|
//time金币数量
|
||||||
NumberToImage.numberToImageNodes(1000, 25, 15, "button_", this.timeCoin, false);
|
NumberToImage.numberToImageNodes(1000, 25, 15, "button_", this.timeCoin, false);
|
||||||
}
|
}
|
||||||
|
@ -189,7 +189,7 @@ export default class SceneManager extends cc.Component {
|
||||||
|
|
||||||
returnHome() {
|
returnHome() {
|
||||||
if (this.node.getChildByName("Pause").getChildByName("btn").getComponent("btnControl")._touch) {
|
if (this.node.getChildByName("Pause").getChildByName("btn").getComponent("btnControl")._touch) {
|
||||||
this.closePause();
|
this.closePause();
|
||||||
if (MapConroler._instance.gameStart == true) {
|
if (MapConroler._instance.gameStart == true) {
|
||||||
MiniGameSdk.API.showToast("体力值减少");
|
MiniGameSdk.API.showToast("体力值减少");
|
||||||
// cc.fx.GameTool.setUserHealth(-1, (data) => {
|
// cc.fx.GameTool.setUserHealth(-1, (data) => {
|
||||||
|
@ -269,7 +269,7 @@ export default class SceneManager extends cc.Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
closeShop(){
|
closeShop() {
|
||||||
if (this.shopNode) {
|
if (this.shopNode) {
|
||||||
this.shopNode.active = false;
|
this.shopNode.active = false;
|
||||||
}
|
}
|
||||||
|
@ -320,6 +320,12 @@ export default class SceneManager extends cc.Component {
|
||||||
MapConroler._instance.buyMagic();
|
MapConroler._instance.buyMagic();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resetBtn() {
|
||||||
|
let propWindow = this.node.getChildByName("Game").getChildByName("propWindow");
|
||||||
|
propWindow.getChildByName("buy_Btn").getComponent("btnControl").setTouch(true);
|
||||||
|
}
|
||||||
|
|
||||||
//打开商店
|
//打开商店
|
||||||
openShop() {
|
openShop() {
|
||||||
if (!SceneManager.cachedShopPrefab) {
|
if (!SceneManager.cachedShopPrefab) {
|
||||||
|
@ -338,6 +344,10 @@ export default class SceneManager extends cc.Component {
|
||||||
// console.log("shopNode parent:", this.shopNode.parent);
|
// console.log("shopNode parent:", this.shopNode.parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateCoin() {
|
||||||
|
MapConroler._instance.updateCoin();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
closePropBuy() {
|
closePropBuy() {
|
||||||
MapConroler._instance.pause = false;
|
MapConroler._instance.pause = false;
|
||||||
|
|
|
@ -1127,7 +1127,7 @@ export namespace MiniGameSdk {
|
||||||
},
|
},
|
||||||
// 根据环境变量设置 debug 模式
|
// 根据环境变量设置 debug 模式
|
||||||
debug: !isProduction,
|
debug: !isProduction,
|
||||||
enableLog: true
|
enableLog: false
|
||||||
};
|
};
|
||||||
// 创建 TA 实例
|
// 创建 TA 实例
|
||||||
API._ta = new ThinkingAnalyticsAPI(config);
|
API._ta = new ThinkingAnalyticsAPI(config);
|
||||||
|
@ -1173,7 +1173,7 @@ export namespace MiniGameSdk {
|
||||||
static updateCoinAndLevel() {
|
static updateCoinAndLevel() {
|
||||||
if (typeof wx !== 'undefined' && wx !== null) {
|
if (typeof wx !== 'undefined' && wx !== null) {
|
||||||
console.log("上传金币和关卡信息给数数")
|
console.log("上传金币和关卡信息给数数")
|
||||||
API._ta.userSet({ current_level: cc.fx.GameConfig.GM_INFO.level });
|
API._ta.userSet({ current_level: (cc.fx.GameConfig.GM_INFO.level + 1) });
|
||||||
API._ta.userSet({ current_coin: cc.fx.GameConfig.GM_INFO.coin });
|
API._ta.userSet({ current_coin: cc.fx.GameConfig.GM_INFO.coin });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,6 +84,7 @@ export class GameConfig {
|
||||||
score: number; //总得分
|
score: number; //总得分
|
||||||
scale: number; //玩家总计成功点火数
|
scale: number; //玩家总计成功点火数
|
||||||
iosOutTradeNo: string; //ios订单号
|
iosOutTradeNo: string; //ios订单号
|
||||||
|
allOutTradeNo: any[]; //订单号数组
|
||||||
min_Time: number; //体力恢复的剩余时间
|
min_Time: number; //体力恢复的剩余时间
|
||||||
freezeAmount: number; //冻结道具次数
|
freezeAmount: number; //冻结道具次数
|
||||||
hammerAmount: number; //锤子道具次数
|
hammerAmount: number; //锤子道具次数
|
||||||
|
@ -99,6 +100,7 @@ export class GameConfig {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//游戏内信息
|
//游戏内信息
|
||||||
|
|
||||||
static get Instance() {
|
static get Instance() {
|
||||||
|
@ -221,6 +223,7 @@ export class GameConfig {
|
||||||
score: 0, //总得分
|
score: 0, //总得分
|
||||||
scale: 1, //玩家总计成功点火数
|
scale: 1, //玩家总计成功点火数
|
||||||
iosOutTradeNo: "", //ios订单号
|
iosOutTradeNo: "", //ios订单号
|
||||||
|
allOutTradeNo: [], //订单号数组
|
||||||
min_Time: 0, //体力恢复的剩余时间
|
min_Time: 0, //体力恢复的剩余时间
|
||||||
freezeAmount: 0, //冻结道具次数
|
freezeAmount: 0, //冻结道具次数
|
||||||
hammerAmount: 0, //锤子道具次数
|
hammerAmount: 0, //锤子道具次数
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import { MiniGameSdk } from "../../Sdk/MiniGameSdk";
|
||||||
|
|
||||||
export default class Utils {
|
export default class Utils {
|
||||||
static uid: string = "";
|
static uid: string = "";
|
||||||
static session_key = "";
|
static session_key = "";
|
||||||
|
@ -19,7 +21,7 @@ export default class Utils {
|
||||||
Utils.openid = ret.data.openid;
|
Utils.openid = ret.data.openid;
|
||||||
Utils.session_key = ret.data.session_key;
|
Utils.session_key = ret.data.session_key;
|
||||||
Utils.uid = ret.data._id;
|
Utils.uid = ret.data._id;
|
||||||
callBack(Utils.uid);
|
callBack(ret);
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
console.log('登录失败!' + res.errMsg)
|
console.log('登录失败!' + res.errMsg)
|
||||||
|
@ -35,19 +37,33 @@ export default class Utils {
|
||||||
Utils.POST("wx/orderPaySig", { uid: Utils.uid, itemid: id, itemCount: count, itemPrice: price }, res => {
|
Utils.POST("wx/orderPaySig", { uid: Utils.uid, itemid: id, itemCount: count, itemPrice: price }, res => {
|
||||||
if (res.code == 1) {
|
if (res.code == 1) {
|
||||||
Utils.outTradeNo = res.data.outTradeNo;
|
Utils.outTradeNo = res.data.outTradeNo;
|
||||||
|
// let timeoutId: number;
|
||||||
|
// const timeoutDuration = 30000; // 30 秒超时时间
|
||||||
|
// // 设置超时定时器
|
||||||
|
// timeoutId = setTimeout(() => {
|
||||||
|
// console.error('支付请求超时');
|
||||||
|
// callBack("请求支付超时");
|
||||||
|
// }, timeoutDuration);
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
wx.requestMidasPaymentGameItem({
|
wx.requestMidasPaymentGameItem({
|
||||||
signData: res.data.signData,
|
signData: res.data.signData,
|
||||||
paySig: res.data.paySig,
|
paySig: res.data.paySig,
|
||||||
signature: res.data.signature,
|
signature: res.data.signature,
|
||||||
success(res, errCode) {
|
success(res, errCode) {
|
||||||
|
// clearTimeout(timeoutId); // 清除超时定时器
|
||||||
console.log('成功', res, errCode);
|
console.log('成功', res, errCode);
|
||||||
callBack(res);
|
callBack(res);
|
||||||
},
|
},
|
||||||
fail({ errMsg, errCode }) {
|
fail({ errMsg, errCode }) {
|
||||||
console.error('失败');
|
// clearTimeout(timeoutId); // 清除超时定时器
|
||||||
console.error(errMsg, errCode)
|
console.log('失败');
|
||||||
callBack(null);
|
console.log(errMsg, errCode)
|
||||||
|
let data = {
|
||||||
|
errMsg: errMsg,
|
||||||
|
errCode: errCode,
|
||||||
|
err: "请求支付失败",
|
||||||
|
}
|
||||||
|
callBack(data);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -57,11 +73,12 @@ export default class Utils {
|
||||||
|
|
||||||
}
|
}
|
||||||
static getPayInfo(callBack) {
|
static getPayInfo(callBack) {
|
||||||
const delays = [1000, 10000, 30000, 60000, 60000]; // 延迟时间数组
|
const delays = [1000, 3000, 3000, 3000, 3000]; // 延迟时间数组
|
||||||
let attempt = 0; // 轮询次数
|
let attempt = 0; // 轮询次数
|
||||||
|
|
||||||
const poll = () => {
|
const poll = () => {
|
||||||
if (attempt >= delays.length) {
|
if (attempt >= delays.length) {
|
||||||
|
MiniGameSdk.API.showToast("网络异常,如充值成功,重进游戏可领取奖励");
|
||||||
callBack({ code: 0, data: { pay_state: -1 }, message: '轮询超时' });
|
callBack({ code: 0, data: { pay_state: -1 }, message: '轮询超时' });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -83,7 +100,7 @@ export default class Utils {
|
||||||
}
|
}
|
||||||
|
|
||||||
static setPayInfo(callBack) {
|
static setPayInfo(callBack) {
|
||||||
const delays = [1000, 5000, 10000, 20000, 30000]; // 延迟时间数组
|
const delays = [1000, 3000, 3000, 3000, 3000];// 延迟时间数组
|
||||||
let attempt = 0; // 重试次数
|
let attempt = 0; // 重试次数
|
||||||
const sendRequest = () => {
|
const sendRequest = () => {
|
||||||
if (attempt > delays.length) {
|
if (attempt > delays.length) {
|
||||||
|
@ -134,11 +151,12 @@ export default class Utils {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
static getIosPayInfo(callBack) {
|
static getIosPayInfo(callBack) {
|
||||||
const delays = [1000, 10000, 30000, 60000, 60000]; // 延迟时间数组
|
const delays = [1000, 3000, 3000, 3000, 3000]; // 延迟时间数组
|
||||||
let attempt = 0; // 轮询次数
|
let attempt = 0; // 轮询次数
|
||||||
|
|
||||||
const poll = () => {
|
const poll = () => {
|
||||||
if (attempt >= delays.length) {
|
if (attempt >= delays.length) {
|
||||||
|
MiniGameSdk.API.showToast("网络异常,如充值成功,重进游戏可领取奖励");
|
||||||
callBack({ code: 0, data: null, message: '轮询超时' });
|
callBack({ code: 0, data: null, message: '轮询超时' });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
"premultiplyAlpha": false,
|
"premultiplyAlpha": false,
|
||||||
"genMipmaps": false,
|
"genMipmaps": false,
|
||||||
"packable": true,
|
"packable": true,
|
||||||
"width": 2042,
|
"width": 2025,
|
||||||
"height": 1680,
|
"height": 1420,
|
||||||
"platformSettings": {},
|
"platformSettings": {},
|
||||||
"subMetas": {}
|
"subMetas": {}
|
||||||
}
|
}
|
|
@ -139,7 +139,7 @@ export default class NewClass extends cc.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
onShow() {
|
onShow() {
|
||||||
if (cc.fx.GameConfig.GM_INFO.iosOutTradeNo != null) {
|
if (cc.fx.GameConfig.GM_INFO.iosOutTradeNo != null && cc.fx.GameConfig.GM_INFO.iosOutTradeNo != "") {
|
||||||
console.log("有苹果订单号,开始轮训");
|
console.log("有苹果订单号,开始轮训");
|
||||||
Utils.getIosPayInfo((data) => {
|
Utils.getIosPayInfo((data) => {
|
||||||
console.log("获得轮训结果:", data);
|
console.log("获得轮训结果:", data);
|
||||||
|
@ -254,9 +254,9 @@ export default class NewClass extends cc.Component {
|
||||||
|
|
||||||
// Utils.GoKEFu();
|
// Utils.GoKEFu();
|
||||||
if (systemType == "ios") {
|
if (systemType == "ios") {
|
||||||
MiniGameSdk.API.showToast("IOS系统暂不支持支付");
|
// MiniGameSdk.API.showToast("IOS系统暂不支持支付");
|
||||||
this.btn_Touch = true;
|
// this.btn_Touch = true;
|
||||||
// Utils.GoKEFu();
|
Utils.GoKEFu();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const data = {
|
const data = {
|
||||||
|
@ -267,11 +267,11 @@ export default class NewClass extends cc.Component {
|
||||||
type: systemType,
|
type: systemType,
|
||||||
}
|
}
|
||||||
cc.fx.GameTool.shushu_Track("init_order", data);
|
cc.fx.GameTool.shushu_Track("init_order", data);
|
||||||
|
console.log("7.14_____________________", "调用充值接口");
|
||||||
Utils.buyProp(id, count, price, (res) => {
|
Utils.buyProp(id, count, price, (res) => {
|
||||||
console.log("获得充值结果", res);
|
console.log("获得充值结果", res);
|
||||||
if (res == null) {
|
if (res == null) {
|
||||||
MiniGameSdk.API.showToast("网络异常,充值失败请稍后再试");
|
MiniGameSdk.API.showToast("充值失败");
|
||||||
this.btn_Touch = true;
|
this.btn_Touch = true;
|
||||||
const dataFail = {
|
const dataFail = {
|
||||||
outTradeNo: Utils.outTradeNo,
|
outTradeNo: Utils.outTradeNo,
|
||||||
|
@ -284,13 +284,32 @@ export default class NewClass extends cc.Component {
|
||||||
cc.fx.GameTool.shushu_Track("payment_fail", dataFail);
|
cc.fx.GameTool.shushu_Track("payment_fail", dataFail);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else if (res.err) {
|
||||||
|
MiniGameSdk.API.showToast("充值失败");
|
||||||
|
console.log(res);
|
||||||
|
this.btn_Touch = true;
|
||||||
|
let name = "支付拉起失败";
|
||||||
|
if (res.errCode == -2) {
|
||||||
|
name = "用户取消充值";
|
||||||
|
}
|
||||||
|
const dataFail = {
|
||||||
|
outTradeNo: Utils.outTradeNo,
|
||||||
|
price: price,
|
||||||
|
payment_name: productId,
|
||||||
|
payment_num: 1,
|
||||||
|
type: systemType,
|
||||||
|
fail_reason: name,
|
||||||
|
}
|
||||||
|
cc.fx.GameTool.shushu_Track("payment_fail", dataFail);
|
||||||
|
return;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
Utils.getPayInfo((data) => {
|
Utils.getPayInfo((data) => {
|
||||||
|
console.log("7.14_______________充值成功,准备轮训");
|
||||||
console.log("获得轮训结果:", data);
|
console.log("获得轮训结果:", data);
|
||||||
if (data.data.pay_state == 1) {
|
if (data.data.pay_state == 1) {
|
||||||
this.btn_Touch = true;
|
this.btn_Touch = true;
|
||||||
MiniGameSdk.API.showToast("取消充值");
|
MiniGameSdk.API.showToast("取消充值");
|
||||||
|
|
||||||
const dataFail2 = {
|
const dataFail2 = {
|
||||||
outTradeNo: Utils.outTradeNo,
|
outTradeNo: Utils.outTradeNo,
|
||||||
price: price,
|
price: price,
|
||||||
|
@ -303,9 +322,11 @@ export default class NewClass extends cc.Component {
|
||||||
}
|
}
|
||||||
else if (data.data.pay_state == 2) {
|
else if (data.data.pay_state == 2) {
|
||||||
this.btn_Touch = true;
|
this.btn_Touch = true;
|
||||||
|
console.log("7.14_______________充值成功,轮训成功,准备发货");
|
||||||
Utils.setPayInfo((data) => {
|
Utils.setPayInfo((data) => {
|
||||||
console.log("设置轮训结果:", data);
|
console.log("设置轮训结果:", data);
|
||||||
if (data.code === 1) {
|
if (data.code === 1) {
|
||||||
|
console.log("7.14_________正式发货");
|
||||||
MiniGameSdk.API.showToast("充值成功");
|
MiniGameSdk.API.showToast("充值成功");
|
||||||
cc.fx.GameTool.shopBuy(productId);
|
cc.fx.GameTool.shopBuy(productId);
|
||||||
console.log("充值成功获得金币");
|
console.log("充值成功获得金币");
|
||||||
|
@ -333,12 +354,16 @@ export default class NewClass extends cc.Component {
|
||||||
cc.fx.GameTool.shushu_Track("payment_fail", dataFail4);
|
cc.fx.GameTool.shushu_Track("payment_fail", dataFail4);
|
||||||
}
|
}
|
||||||
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true);
|
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true);
|
||||||
this.node.parent.getComponent("JiaZai").updateCoin();
|
if (this.node.parent.getComponent("JiaZai"))
|
||||||
|
this.node.parent.getComponent("JiaZai").updateCoin();
|
||||||
|
else if (this.node.parent.getComponent("SceneManager")) {
|
||||||
|
this.node.parent.getComponent("SceneManager").updateCoin();
|
||||||
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true);
|
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true);
|
||||||
this.node.parent.getComponent("JiaZai").updateCoin();
|
|
||||||
const dataFail3 = {
|
const dataFail3 = {
|
||||||
outTradeNo: Utils.outTradeNo,
|
outTradeNo: Utils.outTradeNo,
|
||||||
price: price,
|
price: price,
|
||||||
|
@ -348,6 +373,12 @@ export default class NewClass extends cc.Component {
|
||||||
fail_reason: "拉起支付后,付款时网络异常付款失败",
|
fail_reason: "拉起支付后,付款时网络异常付款失败",
|
||||||
}
|
}
|
||||||
cc.fx.GameTool.shushu_Track("payment_fail", dataFail3);
|
cc.fx.GameTool.shushu_Track("payment_fail", dataFail3);
|
||||||
|
this.btn_Touch = true;
|
||||||
|
if (this.node.parent.getComponent("JiaZai"))
|
||||||
|
this.node.parent.getComponent("JiaZai").updateCoin();
|
||||||
|
else if (this.node.parent.getComponent("SceneManager")) {
|
||||||
|
this.node.parent.getComponent("SceneManager").updateCoin();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"last-module-event-record-time": 1751876016726,
|
"last-module-event-record-time": 1752481846169,
|
||||||
"group-list": [
|
"group-list": [
|
||||||
"default",
|
"default",
|
||||||
"Map"
|
"Map"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user