修复充值BUG等异常。
This commit is contained in:
parent
5393ceeeb1
commit
c15ea4d981
File diff suppressed because it is too large
Load Diff
|
@ -965,7 +965,7 @@ export default class Block extends cc.Component {
|
|||
MapConroler._instance.special_Treatment(this.node);
|
||||
var self = this;
|
||||
this.removeMapBlock();
|
||||
MapConroler._instance.judgeWin(1);
|
||||
MapConroler._instance.judgeWin(0);
|
||||
let pos = this.node.getPosition();
|
||||
if (self.type == BlockType.叠加块下) {
|
||||
let scaleX = self.node.scaleX;
|
||||
|
|
|
@ -651,7 +651,7 @@ export default class JiaZai extends cc.Component {
|
|||
console.error('获取系统信息失败', e);
|
||||
}
|
||||
if (cc.fx.GameConfig.GM_INFO.allOutTradeNo.length != 0) {
|
||||
//console.log("有需要补发数据", cc.fx.GameConfig.GM_INFO.allOutTradeNo);
|
||||
console.log("有需要补发数据", cc.fx.GameConfig.GM_INFO.allOutTradeNo);
|
||||
|
||||
// 递归函数,按顺序处理每个订单
|
||||
const processOrder = (index: number) => {
|
||||
|
@ -701,8 +701,8 @@ export default class JiaZai extends cc.Component {
|
|||
} else {
|
||||
MiniGameSdk.API.showToast("网络异常,充值奖励将在登录后再次发放");
|
||||
const dataFail4 = {
|
||||
outTradeNo: Utils.outTradeNo,
|
||||
price: parseInt(order.goodsPrice),
|
||||
outTradeNo: order.outTradeNo,
|
||||
pay_amount: parseInt(order.goodsPrice) || 0,
|
||||
payment_name: productId,
|
||||
payment_num: 1,
|
||||
type: systemType,
|
||||
|
@ -716,7 +716,7 @@ export default class JiaZai extends cc.Component {
|
|||
// 处理下一个订单
|
||||
processOrder(index + 1);
|
||||
}, order.outTradeNo);
|
||||
let price = order.price || 0;
|
||||
let price = parseInt(order.goodsPrice) || 0;
|
||||
const dataSuccess = {
|
||||
outTradeNo: order.outTradeNo,
|
||||
pay_amount: price,
|
||||
|
@ -728,7 +728,7 @@ export default class JiaZai extends cc.Component {
|
|||
cc.fx.GameTool.shushu_Track("payment", dataSuccess);
|
||||
let version = cc.fx.GameTool.getWechatGameVersion();
|
||||
if (version == "正式版") {
|
||||
MiniGameSdk.API.yinli_Pay(price, Utils.outTradeNo, name);
|
||||
MiniGameSdk.API.yinli_Pay(price, order.outTradeNo, name);
|
||||
}
|
||||
|
||||
|
||||
|
@ -940,6 +940,11 @@ export default class JiaZai extends cc.Component {
|
|||
cc.fx.GameConfig.GM_INFO.otherLevel = level;
|
||||
console.log('从分享链接获取到的关卡信息:', level);
|
||||
console.log('从分享链接获取到的 UID:', uid);
|
||||
let eventData = {
|
||||
identity: "helper", //发起者为helped 帮助者为helper
|
||||
level: level //被帮助关卡等级
|
||||
}
|
||||
cc.fx.GameTool.shushu_Track("stage_help", eventData); //帮助通关
|
||||
this.openLoad();
|
||||
}
|
||||
|
||||
|
|
|
@ -1794,7 +1794,6 @@ export default class MapConroler extends cc.Component {
|
|||
//执行复活函数
|
||||
runRewiveCopy() {
|
||||
this.isreview = true;
|
||||
console.log("wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww")
|
||||
MiniGameSdk.API.showToast("继续游戏");
|
||||
this.gameOver = false;
|
||||
this.gameWin = false;
|
||||
|
@ -1912,6 +1911,14 @@ export default class MapConroler extends cc.Component {
|
|||
if (type == "boom" || type == "lock") {
|
||||
time = 2000;
|
||||
}
|
||||
if (cc.fx.GameConfig.GM_INFO.otherLevel > 0) {
|
||||
let eventData = {
|
||||
identity: "helper", //发起者为helped 帮助者为helper
|
||||
level: cc.fx.GameConfig.GM_INFO.otherLevel, //被帮助关卡等级
|
||||
success: false, //是否成功
|
||||
}
|
||||
cc.fx.GameTool.shushu_Track("stage_help", eventData); //帮助通关
|
||||
}
|
||||
setTimeout(() => {
|
||||
|
||||
this.node.parent.parent.getChildByName("Lose").active = true;
|
||||
|
@ -1925,9 +1932,14 @@ export default class MapConroler extends cc.Component {
|
|||
this.revive.getComponent(Revive).init();
|
||||
this.node.parent.parent.getChildByName("Lose").getChildByName("lose").getChildByName("Boom").active = false;
|
||||
if (cc.fx.GameConfig.GM_INFO.otherLevel > 0) {
|
||||
this.node.parent.parent.getChildByName("Lose").getChildByName("lose").getChildByName("share").active = false;
|
||||
this.node.parent.parent.getChildByName("Lose").getChildByName("share").active = false;
|
||||
}
|
||||
else {
|
||||
console.log("有分享按钮");
|
||||
setTimeout(() => {
|
||||
this.node.parent.parent.getChildByName("Lose").getChildByName("share").active = true;
|
||||
}, 350);
|
||||
}
|
||||
else this.node.parent.parent.getChildByName("Lose").getChildByName("lose").getChildByName("share").active = true;
|
||||
if (type) {
|
||||
if (type == "time") {
|
||||
this.node.parent.parent.getChildByName("Lose").getChildByName("lose").getChildByName("Time").active = true;
|
||||
|
@ -1993,7 +2005,7 @@ export default class MapConroler extends cc.Component {
|
|||
.to(0.2, { scale: 1.05 }, { easing: 'backOut' })
|
||||
.to(0.15, { scale: 1.0 }, { easing: 'sineOut' })
|
||||
.start();
|
||||
this.node.parent.parent.getChildByName("NewMode").getChildByName("newmode").getComponent("NewMode").setMode(type);
|
||||
this.node.parent.parent.getChildByName("NewMode").getComponent("NewMode").setMode(type);
|
||||
}
|
||||
|
||||
|
||||
|
@ -3144,7 +3156,13 @@ export default class MapConroler extends cc.Component {
|
|||
.delay(0.1)
|
||||
//.to(0, { position: cc.v3(0, -880, 0), scale: 0 })
|
||||
.call(() => {
|
||||
nextBtn.active = true;
|
||||
if (cc.fx.GameConfig.GM_INFO.otherLevel == 0) {
|
||||
nextBtn.active = true;
|
||||
}
|
||||
else {
|
||||
cc.fx.GameConfig.GM_INFO.otherLevel = 0;
|
||||
cc.fx.GameConfig.GM_INFO.otherUid = "";
|
||||
}
|
||||
})
|
||||
.to(0.15, { scale: 1.25 }, { easing: 'backOut' })
|
||||
.to(0.08, { scale: 0.9 }, { easing: 'quadIn' })
|
||||
|
@ -3240,8 +3258,15 @@ export default class MapConroler extends cc.Component {
|
|||
|
||||
setOtherLevel() {
|
||||
if (cc.fx.GameConfig.GM_INFO.otherLevel > 0) {
|
||||
console.log("帮助他人通关");
|
||||
let level = cc.fx.GameConfig.GM_INFO.otherLevel;
|
||||
let uid = cc.fx.GameConfig.GM_INFO.otherUid;
|
||||
let eventData = {
|
||||
identity: "helper", //发起者为helped 帮助者为helper
|
||||
level: level, //被帮助关卡等级
|
||||
success: true, //是否成功
|
||||
}
|
||||
cc.fx.GameTool.shushu_Track("stage_help", eventData); //帮助通关
|
||||
Utils.shareLevel(level, uid, (data) => {
|
||||
console.log("分享结果:", data);
|
||||
});
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
// Learn life-cycle callbacks:
|
||||
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
|
||||
|
||||
const {ccclass, property} = cc._decorator;
|
||||
const { ccclass, property } = cc._decorator;
|
||||
|
||||
@ccclass
|
||||
export default class NewClass extends cc.Component {
|
||||
|
@ -24,40 +24,40 @@ export default class NewClass extends cc.Component {
|
|||
|
||||
// onLoad () {}
|
||||
|
||||
start () {
|
||||
for(let i=0; i<cc.fx.GameConfig.NEW_LEVEL.length; i++){
|
||||
if((cc.fx.GameConfig.GM_INFO.level+1) == cc.fx.GameConfig.NEW_LEVEL[i].level){
|
||||
start() {
|
||||
for (let i = 0; i < cc.fx.GameConfig.NEW_LEVEL.length; i++) {
|
||||
if ((cc.fx.GameConfig.GM_INFO.level + 1) == cc.fx.GameConfig.NEW_LEVEL[i].level) {
|
||||
this.propName = cc.fx.GameConfig.NEW_LEVEL[i].name;
|
||||
const path = 'Window_Prop/' + this.propName;
|
||||
cc.resources.load(path, cc.SpriteFrame, (err, spriteFrame: cc.SpriteFrame) => {
|
||||
if (err) {
|
||||
console.error('动态加载背景图失败:', err);
|
||||
return;
|
||||
}
|
||||
this.node.getChildByName("icon").getComponent(cc.Sprite).spriteFrame = spriteFrame;
|
||||
}
|
||||
this.node.getChildByName("newmode").getChildByName("icon").getComponent(cc.Sprite).spriteFrame = spriteFrame;
|
||||
})
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setMode(mode:number){
|
||||
setMode(mode: number) {
|
||||
this.btnStatic = mode;
|
||||
let name = "GameScene";
|
||||
if(mode == 1){
|
||||
if (mode == 1) {
|
||||
name = "HomeScene";
|
||||
}
|
||||
cc.director.preloadScene(name, ()=>{
|
||||
cc.director.preloadScene(name, () => {
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
clickBtn(){
|
||||
cc.fx.AudioManager._instance.playEffect("anniu_Big",null);
|
||||
if(this.btnStatic == 1){
|
||||
clickBtn() {
|
||||
cc.fx.AudioManager._instance.playEffect("anniu_Big", null);
|
||||
if (this.btnStatic == 1) {
|
||||
cc.director.loadScene("HomeScene");
|
||||
}
|
||||
else if(this.btnStatic == 2){
|
||||
else if (this.btnStatic == 2) {
|
||||
cc.director.loadScene("GameScene");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,18 +45,21 @@ export default class Revive extends cc.Component {
|
|||
Utils.getIosPayInfo(iosOutTradeNo,
|
||||
(data) => {
|
||||
console.log("获得轮训结果:", data);
|
||||
const iosID = data.data?.payment_name || this.iosProductId;
|
||||
let iosAmount = data.data?.goodsPrice || this.iosPrice;
|
||||
iosAmount = parseInt(iosAmount);
|
||||
if (data.code == 1) {
|
||||
console.log("购买成功");
|
||||
const dataSuccess = {
|
||||
outTradeNo: iosOutTradeNo,
|
||||
pay_amount: this.iosPrice,
|
||||
payment_name: this.iosProductId,
|
||||
pay_amount: iosAmount,
|
||||
payment_name: iosID,
|
||||
payment_num: this.iosCount,
|
||||
type: "ios",
|
||||
}
|
||||
cc.fx.GameTool.shushu_Track("payment", dataSuccess);
|
||||
let name = "购买金币道具:" + this.iosProductId;
|
||||
MiniGameSdk.API.yinli_Pay(this.iosPrice, iosOutTradeNo, name)
|
||||
let name = "购买金币道具:" + iosID;
|
||||
MiniGameSdk.API.yinli_Pay(iosAmount, iosOutTradeNo, name)
|
||||
Utils.setPayInfo(
|
||||
(res) => {
|
||||
this.closeLoad();
|
||||
|
@ -64,9 +67,9 @@ export default class Revive extends cc.Component {
|
|||
if (res.code === 1) {
|
||||
console.log("_________正式发货");
|
||||
MiniGameSdk.API.showToast("充值成功");
|
||||
cc.fx.GameTool.shopBuy(this.iosProductId, false);
|
||||
cc.fx.GameTool.shopBuy(iosID, false);
|
||||
this.revivew()
|
||||
if (this.iosProductId == "reborn_Gift") {
|
||||
if (iosID == "reborn_Gift") {
|
||||
this.buyGift();
|
||||
}
|
||||
//console.log("充值成功获得金币");
|
||||
|
@ -75,16 +78,16 @@ export default class Revive extends cc.Component {
|
|||
MiniGameSdk.API.showToast("网络异常,充值奖励将在登录后再次发放");
|
||||
const dataFail4 = {
|
||||
outTradeNo: iosOutTradeNo,
|
||||
price: this.iosPrice,
|
||||
payment_name: this.iosProductId,
|
||||
pay_amount: iosAmount,
|
||||
payment_name: iosID,
|
||||
payment_num: this.iosCount,
|
||||
type: "ios",
|
||||
fail_reason: "成功付款,但是发货时请求服务器失败,充值成功未发货",
|
||||
}
|
||||
cc.fx.GameTool.shushu_Track("payment_fail", dataFail4);
|
||||
}
|
||||
if (this.node.parent.parent.parent.parent.getComponent("SceneManager")) {
|
||||
this.node.parent.parent.parent.parent.getComponent("SceneManager").updateCoin();
|
||||
if (this.node.parent.parent.parent.parent.parent.getComponent("SceneManager")) {
|
||||
this.node.parent.parent.parent.parent.parent.getComponent("SceneManager").updateCoin();
|
||||
}
|
||||
}, iosOutTradeNo)
|
||||
}
|
||||
|
@ -95,8 +98,8 @@ export default class Revive extends cc.Component {
|
|||
this.btn_Touch = true;
|
||||
const dataFail = {
|
||||
outTradeNo: iosOutTradeNo,
|
||||
price: this.iosPrice,
|
||||
payment_name: this.iosProductId,
|
||||
pay_amount: iosAmount,
|
||||
payment_name: iosID,
|
||||
payment_num: this.iosCount,
|
||||
type: "ios",
|
||||
fail_reason: "用户取消充值",
|
||||
|
@ -109,8 +112,8 @@ export default class Revive extends cc.Component {
|
|||
MiniGameSdk.API.showToast("订单已关闭");
|
||||
const dataFail = {
|
||||
outTradeNo: iosOutTradeNo,
|
||||
price: this.iosPrice,
|
||||
payment_name: this.iosProductId,
|
||||
pay_amount: iosAmount,
|
||||
payment_name: iosID,
|
||||
payment_num: this.iosCount,
|
||||
type: "ios",
|
||||
fail_reason: "用户充值后,轮训结果超时",
|
||||
|
@ -245,15 +248,15 @@ export default class Revive extends cc.Component {
|
|||
|
||||
this.openLoad();
|
||||
this.btn_Touch = true;
|
||||
//console.log("7.14_____________________", "调用充值接口");
|
||||
console.log("7.14_____________________", "调用充值接口");
|
||||
Utils.buyProp(id, count, price, systemType, productId, (res) => {
|
||||
//console.log("获得充值结果", res);
|
||||
console.log("获得充值结果", res);
|
||||
if (res == null) {
|
||||
MiniGameSdk.API.showToast("充值失败");
|
||||
this.btn_Touch = true;
|
||||
const dataFail = {
|
||||
outTradeNo: Utils.outTradeNo,
|
||||
price: price,
|
||||
pay_amount: price,
|
||||
payment_name: productId,
|
||||
payment_num: 1,
|
||||
type: systemType,
|
||||
|
@ -273,7 +276,7 @@ export default class Revive extends cc.Component {
|
|||
}
|
||||
const dataFail = {
|
||||
outTradeNo: Utils.outTradeNo,
|
||||
price: price,
|
||||
pay_amount: price,
|
||||
payment_name: productId,
|
||||
payment_num: 1,
|
||||
type: systemType,
|
||||
|
@ -285,15 +288,15 @@ export default class Revive extends cc.Component {
|
|||
}
|
||||
else {
|
||||
Utils.getPayInfo((data) => {
|
||||
//console.log("7.14_______________充值成功,准备轮训");
|
||||
//console.log("获得轮训结果:", data);
|
||||
console.log("7.14_______________充值成功,准备轮训");
|
||||
console.log("获得轮训结果:", data);
|
||||
this.closeLoad();
|
||||
if (data.data.pay_state == 1) {
|
||||
this.btn_Touch = true;
|
||||
MiniGameSdk.API.showToast("取消充值");
|
||||
const dataFail2 = {
|
||||
outTradeNo: Utils.outTradeNo,
|
||||
price: price,
|
||||
pay_amount: price,
|
||||
payment_name: productId,
|
||||
payment_num: 1,
|
||||
type: systemType,
|
||||
|
@ -331,7 +334,7 @@ export default class Revive extends cc.Component {
|
|||
MiniGameSdk.API.showToast("网络异常,充值奖励将在登录后再次发放");
|
||||
const dataFail4 = {
|
||||
outTradeNo: Utils.outTradeNo,
|
||||
price: price,
|
||||
pay_amount: price,
|
||||
payment_name: productId,
|
||||
payment_num: 1,
|
||||
type: systemType,
|
||||
|
@ -340,8 +343,8 @@ export default class Revive extends cc.Component {
|
|||
cc.fx.GameTool.shushu_Track("payment_fail", dataFail4);
|
||||
}
|
||||
|
||||
if (this.node.parent.parent.parent.parent.getComponent("SceneManager")) {
|
||||
this.node.parent.parent.parent.parent.getComponent("SceneManager").updateCoin();
|
||||
if (this.node.parent.parent.parent.parent.parent.getComponent("SceneManager")) {
|
||||
this.node.parent.parent.parent.parent.parent.getComponent("SceneManager").updateCoin();
|
||||
}
|
||||
}, Utils.outTradeNo)
|
||||
}
|
||||
|
@ -349,7 +352,7 @@ export default class Revive extends cc.Component {
|
|||
|
||||
const dataFail3 = {
|
||||
outTradeNo: Utils.outTradeNo,
|
||||
price: price,
|
||||
pay_amount: price,
|
||||
payment_name: productId,
|
||||
payment_num: 1,
|
||||
type: systemType,
|
||||
|
@ -357,8 +360,8 @@ export default class Revive extends cc.Component {
|
|||
}
|
||||
cc.fx.GameTool.shushu_Track("payment_fail", dataFail3);
|
||||
this.btn_Touch = true;
|
||||
if (this.node.parent.parent.parent.parent.getComponent("SceneManager")) {
|
||||
this.node.parent.parent.parent.parent.getComponent("SceneManager").updateCoin();
|
||||
if (this.node.parent.parent.parent.parent.parent.getComponent("SceneManager")) {
|
||||
this.node.parent.parent.parent.parent.parent.getComponent("SceneManager").updateCoin();
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -367,13 +370,13 @@ export default class Revive extends cc.Component {
|
|||
}
|
||||
}
|
||||
openLoad() {
|
||||
this.node.parent.parent.parent.parent.getChildByName("Loading").active = true;
|
||||
this.node.parent.parent.parent.parent.getChildByName("Loading").getChildByName("load").stopAllActions();
|
||||
this.node.parent.parent.parent.parent.getChildByName("Loading").getChildByName("load").runAction(cc.rotateTo(2, 1080).repeatForever());
|
||||
this.node.parent.parent.parent.parent.parent.getChildByName("Loading").active = true;
|
||||
this.node.parent.parent.parent.parent.parent.getChildByName("Loading").getChildByName("load").stopAllActions();
|
||||
this.node.parent.parent.parent.parent.parent.getChildByName("Loading").getChildByName("load").runAction(cc.rotateTo(2, 1080).repeatForever());
|
||||
}
|
||||
|
||||
closeLoad() {
|
||||
this.node.parent.parent.parent.parent.getChildByName("Loading").active = false;
|
||||
this.node.parent.parent.parent.parent.parent.getChildByName("Loading").active = false;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1110,7 +1110,7 @@ export namespace MiniGameSdk {
|
|||
|
||||
static shushu_Init() {
|
||||
if (typeof wx !== 'undefined' && wx !== null) {
|
||||
console.log("开始接入数数平台");
|
||||
// console.log("开始接入数数平台");
|
||||
//getWechatGameVersion
|
||||
let appId = "121591378fc1423893deb12041413eb3";
|
||||
let test = cc.fx.GameTool.getWechatGameVersion();
|
||||
|
@ -1137,24 +1137,24 @@ export namespace MiniGameSdk {
|
|||
const distinctId = MiniGameSdk.API.getShushuDistinctId();
|
||||
if (distinctId) {
|
||||
cc.fx.GameConfig.GM_INFO.shushu_DistinctId = distinctId;
|
||||
console.log('用户的 distinct_id 是:', distinctId);
|
||||
// console.log('用户的 distinct_id 是:', distinctId);
|
||||
} else {
|
||||
console.log('未获取到用户的 distinct_id');
|
||||
// console.log('未获取到用户的 distinct_id');
|
||||
}
|
||||
|
||||
const accountId = MiniGameSdk.API.getShushuAccountId();
|
||||
if (accountId) {
|
||||
cc.fx.GameConfig.GM_INFO.shushu_AccountId = accountId;
|
||||
console.log('用户的 account_id 是:', accountId);
|
||||
// console.log('用户的 account_id 是:', accountId);
|
||||
} else {
|
||||
console.log('未获取到用户的 account_id');
|
||||
// console.log('未获取到用户的 account_id');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static shushu_Login() {
|
||||
if (typeof wx !== 'undefined' && wx !== null) {
|
||||
console.log("数数登录时,获取到的openId:", cc.fx.GameConfig.GM_INFO.openid);
|
||||
// console.log("数数登录时,获取到的openId:", cc.fx.GameConfig.GM_INFO.openid);
|
||||
API._ta.login(cc.fx.GameConfig.GM_INFO.openid);
|
||||
cc.fx.GameConfig.GM_INFO.shushu_AccountId = cc.fx.GameConfig.GM_INFO.openid;
|
||||
const result = "success";
|
||||
|
@ -1165,7 +1165,7 @@ export namespace MiniGameSdk {
|
|||
|
||||
static shushu_userSet(time) {
|
||||
if (typeof wx !== 'undefined' && wx !== null) {
|
||||
console.log("设置用户注册属性");
|
||||
// console.log("设置用户注册属性");
|
||||
API._ta.userSet({ register_time: time });
|
||||
API._ta.userSet({ uid: cc.fx.GameConfig.GM_INFO.uid.toString() });
|
||||
}
|
||||
|
@ -1173,7 +1173,7 @@ export namespace MiniGameSdk {
|
|||
|
||||
static updateCoinAndLevel() {
|
||||
if (typeof wx !== 'undefined' && wx !== null) {
|
||||
console.log("上传金币和关卡信息给数数")
|
||||
// console.log("上传金币和关卡信息给数数")
|
||||
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({ uid: cc.fx.GameConfig.GM_INFO.uid.toString() });
|
||||
|
@ -1195,7 +1195,7 @@ export namespace MiniGameSdk {
|
|||
uid: cc.fx.GameConfig.GM_INFO.uid.toString() //用户id
|
||||
};
|
||||
if (register_time != null) {
|
||||
console.log("设置用户公共属性注册:————————————", register_time);
|
||||
// console.log("设置用户公共属性注册:————————————", register_time);
|
||||
superProperties = {
|
||||
current_level: (cc.fx.GameConfig.GM_INFO.level + 1), //当前关卡等级 number
|
||||
current_health: cc.fx.GameConfig.GM_INFO.hp, //当前体力值
|
||||
|
@ -1207,7 +1207,7 @@ export namespace MiniGameSdk {
|
|||
};
|
||||
}
|
||||
if (pay_user != null && pay_user != false) {
|
||||
console.log("设置用户公共属性支付:————————————", pay_user);
|
||||
// console.log("设置用户公共属性支付:————————————", pay_user);
|
||||
superProperties = {
|
||||
current_level: (cc.fx.GameConfig.GM_INFO.level + 1), //当前关卡等级 number
|
||||
current_health: cc.fx.GameConfig.GM_INFO.hp, //当前体力值
|
||||
|
@ -1218,7 +1218,7 @@ export namespace MiniGameSdk {
|
|||
}
|
||||
}
|
||||
// @ts-ignore
|
||||
console.log("设置公共属性时:————————————", superProperties.uid);
|
||||
// console.log("设置公共属性时:————————————", superProperties.uid);
|
||||
API._ta.setSuperProperties(superProperties);//设置公共事件属性
|
||||
API.updateCoinAndLevel();
|
||||
}
|
||||
|
@ -1305,10 +1305,10 @@ export namespace MiniGameSdk {
|
|||
enable_sync_attribution: false,//渠道归因
|
||||
})
|
||||
.then((res) => {
|
||||
console.log("引力引擎初始化成功", res)
|
||||
// console.log("引力引擎初始化成功", res)
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log("引力引擎初始化失败 " + err);
|
||||
// console.log("引力引擎初始化失败 " + err);
|
||||
});
|
||||
|
||||
if (cc.fx.GameConfig.GM_INFO.shushu_AccountId == "") cc.fx.GameConfig.GM_INFO.shushu_AccountId =
|
||||
|
@ -1369,6 +1369,12 @@ export namespace MiniGameSdk {
|
|||
if (cc.sys.platform === cc.sys.WECHAT_GAME) {
|
||||
//@ts-ignore
|
||||
wx.shareAppMessage(shareParams);
|
||||
let eventData = {
|
||||
identity: "helped", //发起者为helped 帮助者为helper
|
||||
level: level //被帮助关卡等级
|
||||
}
|
||||
console.log("分享给好友", eventData);
|
||||
cc.fx.GameTool.shushu_Track("stage_help", eventData); //帮助通关
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,8 +12,8 @@ export default class Utils {
|
|||
static getUserInfo(callBack) {
|
||||
wx.login({
|
||||
success(res) {
|
||||
console.log("微信login成功");
|
||||
console.log(res.code);
|
||||
//console.log("微信login成功");
|
||||
//console.log(res.code);
|
||||
if (res.code) {
|
||||
// 延迟时间数组,可按需调整
|
||||
const delays = [1000, 2000, 3000, 4000, 5000];
|
||||
|
@ -21,13 +21,13 @@ export default class Utils {
|
|||
|
||||
const poll = () => {
|
||||
if (attempt >= delays.length) {
|
||||
console.log('登录请求轮询超时');
|
||||
//console.log('登录请求轮询超时');
|
||||
callBack({ code: 0, data: { openid: "登录失败" }, message: '轮询超时' });
|
||||
return;
|
||||
}
|
||||
|
||||
Utils.POST("login", { code: res.code }, ret => {
|
||||
console.log("请求结果:", ret);
|
||||
//console.log("请求结果:", ret);
|
||||
if (ret.code === 1) { // 假设返回 code 为 1 表示成功
|
||||
Utils.openid = ret.data.openid;
|
||||
Utils.session_key = ret.data.session_key;
|
||||
|
@ -42,7 +42,7 @@ export default class Utils {
|
|||
|
||||
poll();
|
||||
} else {
|
||||
console.log('登录失败!' + res.errMsg)
|
||||
//console.log('登录失败!' + res.errMsg)
|
||||
callBack({ code: 0, data: { openid: "登录失败" }, message: res.errMsg });
|
||||
}
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ export default class Utils {
|
|||
|
||||
/**道具直购接口*/
|
||||
static buyProp(id, count, price, systemType, productId, callBack) {
|
||||
console.log("请求uid:" + Utils.uid, "请求id:" + id, "请求数量:" + count, "请求价格:" + price);
|
||||
//console.log("请求uid:" + Utils.uid, "请求id:" + id, "请求数量:" + count, "请求价格:" + price);
|
||||
|
||||
Utils.POST("wx/orderPaySig", { uid: Utils.uid, itemid: id, itemCount: count, itemPrice: price }, res => {
|
||||
if (res.code == 1) {
|
||||
|
@ -63,7 +63,7 @@ export default class Utils {
|
|||
type: systemType,
|
||||
}
|
||||
cc.fx.GameTool.shushu_Track("init_order", data);
|
||||
console.log("创建的最新订单的订单号:", Utils.outTradeNo);
|
||||
//console.log("创建的最新订单的订单号:", Utils.outTradeNo);
|
||||
// let timeoutId: number;
|
||||
// const timeoutDuration = 30000; // 30 秒超时时间
|
||||
// // 设置超时定时器
|
||||
|
@ -78,13 +78,13 @@ export default class Utils {
|
|||
signature: res.data.signature,
|
||||
success(res, errCode) {
|
||||
// clearTimeout(timeoutId); // 清除超时定时器
|
||||
console.log('成功', res, errCode);
|
||||
//console.log('成功', res, errCode);
|
||||
callBack(res);
|
||||
},
|
||||
fail({ errMsg, errCode }) {
|
||||
// clearTimeout(timeoutId); // 清除超时定时器
|
||||
console.log('失败');
|
||||
console.log(errMsg, errCode)
|
||||
//console.log('失败');
|
||||
//console.log(errMsg, errCode)
|
||||
let data = {
|
||||
errMsg: errMsg,
|
||||
errCode: errCode,
|
||||
|
@ -116,10 +116,10 @@ export default class Utils {
|
|||
return;
|
||||
}
|
||||
|
||||
console.log("请求uid:", Utils.uid);
|
||||
console.log("outTradeNo:", Utils.outTradeNo);
|
||||
//console.log("请求uid:", Utils.uid);
|
||||
//console.log("outTradeNo:", Utils.outTradeNo);
|
||||
Utils.POST("wx/getPayInfo", { uid: Utils.uid, outTradeNo: Utils.outTradeNo }, res => {
|
||||
console.log("查询字符结果:", res);
|
||||
//console.log("查询字符结果:", res);
|
||||
if (res.code === 1 && (res.data.pay_state === 1 || res.data.pay_state === 2)) {
|
||||
callBack(res);
|
||||
} else {
|
||||
|
@ -143,16 +143,16 @@ export default class Utils {
|
|||
}
|
||||
let orderTemp = Utils.outTradeNo;
|
||||
if (order) orderTemp = order;
|
||||
console.log("告知服务器发货的订单号:", orderTemp);
|
||||
//console.log("告知服务器发货的订单号:", orderTemp);
|
||||
Utils.POST("wx/getOrderReward", { outTradeNo: orderTemp }, res => {
|
||||
console.log("告知服务器发货:", res);
|
||||
//console.log("告知服务器发货:", res);
|
||||
if (res.code === 1) {
|
||||
console.log("告知服务器发货成功:", res);
|
||||
//console.log("告知服务器发货成功:", res);
|
||||
// 请求成功,调用回调并返回结果
|
||||
callBack(res);
|
||||
} else {
|
||||
// 请求失败,增加重试次数并设置下一次请求的延迟
|
||||
console.log("告知服务器发货失败:", res);
|
||||
//console.log("告知服务器发货失败:", res);
|
||||
attempt++;
|
||||
if (attempt <= delays.length) {
|
||||
setTimeout(sendRequest, delays[attempt - 1]);
|
||||
|
@ -186,7 +186,7 @@ export default class Utils {
|
|||
payment_num: iosPayInfo.payment_count,
|
||||
type: "ios",
|
||||
}
|
||||
console.log("ios创建订单信息:", data);
|
||||
//console.log("ios创建订单信息:", data);
|
||||
cc.fx.GameTool.shushu_Track("init_order", shushu_data);
|
||||
//@ts-ignore
|
||||
wx.openCustomerServiceConversation({
|
||||
|
@ -194,10 +194,10 @@ export default class Utils {
|
|||
showMessageCard: false, // 是否展示消息卡片
|
||||
success() {
|
||||
callBack("success");
|
||||
console.log('客服会话已successr');
|
||||
//console.log('客服会话已successr');
|
||||
},
|
||||
fail() {
|
||||
console.log('客服会话已over');
|
||||
//console.log('客服会话已over');
|
||||
callBack("fail");
|
||||
}
|
||||
});
|
||||
|
@ -220,11 +220,11 @@ export default class Utils {
|
|||
return;
|
||||
}
|
||||
|
||||
console.log("请求uid:" + Utils.uid);
|
||||
console.log("outTradeNo:" + iosOutTradeNo);
|
||||
//console.log("请求uid:" + Utils.uid);
|
||||
//console.log("outTradeNo:" + iosOutTradeNo);
|
||||
Utils.POST("wx/iosgetPayInfo", { outTradeNo: iosOutTradeNo }, res => {
|
||||
console.log("查询字符结果IOS");
|
||||
console.log(res);
|
||||
//console.log("查询字符结果IOS");
|
||||
//console.log(res);
|
||||
if (res.code === 1) {
|
||||
callBack(res);
|
||||
} else if (res.code === 0) {
|
||||
|
@ -258,8 +258,8 @@ export default class Utils {
|
|||
// //@ts-ignore
|
||||
// wx.login({
|
||||
// success (res) {
|
||||
// console.log("登录成功");
|
||||
// console.log(res);
|
||||
// //console.log("登录成功");
|
||||
// //console.log(res);
|
||||
// if (res.code) {
|
||||
// //@ts-ignore
|
||||
// wx.cloud.callFunction({
|
||||
|
@ -270,20 +270,20 @@ export default class Utils {
|
|||
// code:res.code,
|
||||
// },
|
||||
// success: function(ret) {
|
||||
// console.log("请求成功");
|
||||
// console.log("请求结果:");
|
||||
// console.log(ret);
|
||||
// //console.log("请求成功");
|
||||
// //console.log("请求结果:");
|
||||
// //console.log(ret);
|
||||
// Utils.openid=ret.data.openid;
|
||||
// Utils.session_key=ret.data.session_key;
|
||||
// Utils.uid=ret.data._id;
|
||||
// },
|
||||
// fail:function(res){
|
||||
// console.log("请求失败");
|
||||
// console.log(res);
|
||||
// //console.log("请求失败");
|
||||
// //console.log(res);
|
||||
// }
|
||||
// })
|
||||
// } else {
|
||||
// console.log('登录失败!' + res.errMsg)
|
||||
// //console.log('登录失败!' + res.errMsg)
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
|
@ -302,18 +302,18 @@ export default class Utils {
|
|||
// itemPrice:100
|
||||
// },
|
||||
// success: function(res) {
|
||||
// console.log("请求成功");
|
||||
// console.log(res)
|
||||
// //console.log("请求成功");
|
||||
// //console.log(res)
|
||||
// if(res.result.code==1){
|
||||
// Utils.outTradeNo=res.result.data.outTradeNo;
|
||||
// console.log("订单号:"+Utils.outTradeNo);
|
||||
// //console.log("订单号:"+Utils.outTradeNo);
|
||||
// //@ts-ignore
|
||||
// wx.requestMidasPaymentGameItem({
|
||||
// signData:res.result.data.signData,
|
||||
// paySig: res.result.data.paySig,
|
||||
// signature: res.result.data.signature,
|
||||
// success(res, errCode) {
|
||||
// console.log('成功', res, errCode);
|
||||
// //console.log('成功', res, errCode);
|
||||
// },
|
||||
// fail({errMsg,errCode}) {
|
||||
// console.error('失败');
|
||||
|
@ -324,8 +324,8 @@ export default class Utils {
|
|||
|
||||
// },
|
||||
// fail:function(res){
|
||||
// console.log("请求失败");
|
||||
// console.log(res);
|
||||
// //console.log("请求失败");
|
||||
// //console.log(res);
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
|
@ -341,13 +341,13 @@ export default class Utils {
|
|||
// outTradeNo:Utils.outTradeNo
|
||||
// },
|
||||
// success: function(res) {
|
||||
// console.log("请求成功");
|
||||
// console.log(res)
|
||||
// //console.log("请求成功");
|
||||
// //console.log(res)
|
||||
// callBack("成功");
|
||||
// },
|
||||
// fail:function(res){
|
||||
// console.log("请求失败");
|
||||
// console.log(res);
|
||||
// //console.log("请求失败");
|
||||
// //console.log(res);
|
||||
// callBack("失败");
|
||||
// }
|
||||
// })
|
||||
|
@ -364,12 +364,12 @@ export default class Utils {
|
|||
|
||||
// },
|
||||
// success: function(res) {
|
||||
// console.log("请求成功");
|
||||
// console.log(res)
|
||||
// //console.log("请求成功");
|
||||
// //console.log(res)
|
||||
// },
|
||||
// fail:function(res){
|
||||
// console.log("请求失败");
|
||||
// console.log(res);
|
||||
// //console.log("请求失败");
|
||||
// //console.log(res);
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
|
@ -397,7 +397,7 @@ export default class Utils {
|
|||
dataStr = dataStr.substr(0, dataStr.lastIndexOf('&'));
|
||||
}
|
||||
url = this.httpip + url;
|
||||
console.log("请求地址:" + url);
|
||||
//console.log("请求地址:" + url);
|
||||
xhr.open("POST", url, true);
|
||||
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||
xhr.onreadystatechange = function () {
|
||||
|
@ -447,8 +447,8 @@ export default class Utils {
|
|||
}
|
||||
//组装完整的URL
|
||||
let requestURL = extraUrl + "/" + path + encodeURI(sendtext);
|
||||
// console.log("发送请求:");
|
||||
// console.log(requestURL);
|
||||
// //console.log("发送请求:");
|
||||
// //console.log(requestURL);
|
||||
//发送请求 Get形式发送请求
|
||||
xhr.open("GET", requestURL, true);
|
||||
if (cc.sys.isNative) {//如果是手机就设置请求头
|
||||
|
@ -460,7 +460,7 @@ export default class Utils {
|
|||
//xhr.hasRetried=true;
|
||||
hasRetried = true;
|
||||
xhr.abort();
|
||||
console.log("http timeOut......");
|
||||
//console.log("http timeOut......");
|
||||
retryFun();
|
||||
}, 5000);
|
||||
//重新发送请求
|
||||
|
@ -476,7 +476,7 @@ export default class Utils {
|
|||
try {
|
||||
ret = JSON.parse(respText);
|
||||
} catch (e) {
|
||||
console.log("http error:" + e);
|
||||
//console.log("http error:" + e);
|
||||
ret = {
|
||||
code: 1,
|
||||
msg: e
|
||||
|
@ -493,7 +493,7 @@ export default class Utils {
|
|||
if (hasRetried) {
|
||||
return;
|
||||
}
|
||||
console.log('other readystate ==' + xhr.readyState + ', status:' + xhr.status);
|
||||
//console.log('other readystate ==' + xhr.readyState + ', status:' + xhr.status);
|
||||
if (xhr.readyState == 4 && xhr.status == 0) {
|
||||
handler({
|
||||
err: 1,
|
||||
|
@ -532,12 +532,12 @@ export default class Utils {
|
|||
}
|
||||
|
||||
Utils.POST("userData", data, res => {
|
||||
console.log("获得userData数据:", res);
|
||||
//console.log("获得userData数据:", res);
|
||||
if (res.code === 1) {
|
||||
console.log("服务器:获取用户数据成功", res);
|
||||
//console.log("服务器:获取用户数据成功", res);
|
||||
if (callBack) callBack(res);
|
||||
} else {
|
||||
console.log("服务器:获取用户数据失败", res);
|
||||
//console.log("服务器:获取用户数据失败", res);
|
||||
if (callBack) callBack(res);
|
||||
}
|
||||
});
|
||||
|
@ -559,12 +559,12 @@ export default class Utils {
|
|||
userData: data
|
||||
}
|
||||
Utils.POST("userData", setData, res => {
|
||||
console.log("获得userData数据:", res);
|
||||
//console.log("获得userData数据:", res);
|
||||
if (res.code === 1) {
|
||||
console.log("服务器:获取用户数据成功", res);
|
||||
//console.log("服务器:获取用户数据成功", res);
|
||||
if (callBack) callBack(res);
|
||||
} else {
|
||||
console.log("服务器:获取用户数据失败", res);
|
||||
//console.log("服务器:获取用户数据失败", res);
|
||||
if (callBack) callBack(res);
|
||||
}
|
||||
});
|
||||
|
@ -585,12 +585,12 @@ export default class Utils {
|
|||
action: 'read',
|
||||
}
|
||||
Utils.POST("userCoin", setData, res => {
|
||||
console.log("获得userCoin数据:", res);
|
||||
//console.log("获得userCoin数据:", res);
|
||||
if (res.code === 1) {
|
||||
console.log("服务器:获得金币成功", res);
|
||||
//console.log("服务器:获得金币成功", res);
|
||||
if (callBack) callBack(res);
|
||||
} else {
|
||||
console.log("服务器:获得金币失败", res);
|
||||
//console.log("服务器:获得金币失败", res);
|
||||
if (callBack) callBack(res);
|
||||
}
|
||||
});
|
||||
|
@ -611,14 +611,14 @@ export default class Utils {
|
|||
action: 'save',
|
||||
coinAmount: Math.floor(cc.fx.GameConfig.GM_INFO.coin)
|
||||
}
|
||||
console.log("服务器:上传金币", Math.floor(cc.fx.GameConfig.GM_INFO.coin));
|
||||
//console.log("服务器:上传金币", Math.floor(cc.fx.GameConfig.GM_INFO.coin));
|
||||
Utils.POST("userCoin", setData, res => {
|
||||
console.log("获得userCoin数据:", res);
|
||||
//console.log("获得userCoin数据:", res);
|
||||
if (res.code === 1) {
|
||||
console.log("服务器:上传金币成功", res);
|
||||
//console.log("服务器:上传金币成功", res);
|
||||
if (callBack) callBack(res);
|
||||
} else {
|
||||
console.log("服务器:上传金币失败", res);
|
||||
//console.log("服务器:上传金币失败", res);
|
||||
if (callBack) callBack(res);
|
||||
}
|
||||
});
|
||||
|
@ -639,12 +639,12 @@ export default class Utils {
|
|||
action: 'read',
|
||||
}
|
||||
Utils.POST("userLevel", setData, res => {
|
||||
console.log("获得userLevel数据:", res);
|
||||
//console.log("获得userLevel数据:", res);
|
||||
if (res.code === 1) {
|
||||
console.log("服务器:获得等级成功", res);
|
||||
//console.log("服务器:获得等级成功", res);
|
||||
if (callBack) callBack(res);
|
||||
} else {
|
||||
console.log("服务器:获得等级失败", res);
|
||||
//console.log("服务器:获得等级失败", res);
|
||||
if (callBack) callBack(res);
|
||||
}
|
||||
});
|
||||
|
@ -666,12 +666,12 @@ export default class Utils {
|
|||
levelAmount: parseInt(cc.fx.GameConfig.GM_INFO.level)
|
||||
}
|
||||
Utils.POST("userLevel", setData, res => {
|
||||
console.log("获得userLevel数据:", res);
|
||||
//console.log("获得userLevel数据:", res);
|
||||
if (res.code === 1) {
|
||||
console.log("服务器:上传等级成功", res);
|
||||
//console.log("服务器:上传等级成功", res);
|
||||
if (callBack) callBack(res);
|
||||
} else {
|
||||
console.log("服务器:上传等级失败", res);
|
||||
//console.log("服务器:上传等级失败", res);
|
||||
if (callBack) callBack(res);
|
||||
}
|
||||
});
|
||||
|
@ -692,12 +692,12 @@ export default class Utils {
|
|||
action: 'read',
|
||||
}
|
||||
Utils.POST("userProp", setData, res => {
|
||||
console.log("获得userProp数据:", res);
|
||||
//console.log("获得userProp数据:", res);
|
||||
if (res.code === 1) {
|
||||
console.log("服务器:获得道具成功", res);
|
||||
//console.log("服务器:获得道具成功", res);
|
||||
if (callBack) callBack(res);
|
||||
} else {
|
||||
console.log("服务器:获得道具失败", res);
|
||||
//console.log("服务器:获得道具失败", res);
|
||||
if (callBack) callBack(res);
|
||||
}
|
||||
});
|
||||
|
@ -731,14 +731,14 @@ export default class Utils {
|
|||
}
|
||||
}
|
||||
|
||||
console.log("上传道具类型", propid, "上传道具数量:", amount);
|
||||
//console.log("上传道具类型", propid, "上传道具数量:", amount);
|
||||
Utils.POST("userProp", setData, res => {
|
||||
console.log("获得userProp数据:", res);
|
||||
//console.log("获得userProp数据:", res);
|
||||
if (res.code === 1) {
|
||||
console.log("服务器:上传道具成功", res);
|
||||
//console.log("服务器:上传道具成功", res);
|
||||
if (callBack) callBack(res);
|
||||
} else {
|
||||
console.log("服务器:上传道具失败", res);
|
||||
//console.log("服务器:上传道具失败", res);
|
||||
if (callBack) callBack(res);
|
||||
}
|
||||
});
|
||||
|
@ -760,12 +760,12 @@ export default class Utils {
|
|||
action: 'read',
|
||||
}
|
||||
Utils.POST("userHealth", setData, res => {
|
||||
console.log("获得userHealth数据:", res);
|
||||
//console.log("获得userHealth数据:", res);
|
||||
if (res.code === 1) {
|
||||
console.log("服务器:获得体力成功", res);
|
||||
//console.log("服务器:获得体力成功", res);
|
||||
if (callBack) callBack(res);
|
||||
} else {
|
||||
console.log("服务器:获得体力失败", res);
|
||||
//console.log("服务器:获得体力失败", res);
|
||||
if (callBack) callBack(res);
|
||||
}
|
||||
});
|
||||
|
@ -788,12 +788,12 @@ export default class Utils {
|
|||
timestamp: timestamp
|
||||
}
|
||||
Utils.POST("userHealth", setData, res => {
|
||||
console.log("获得userHealth数据:", res);
|
||||
//console.log("获得userHealth数据:", res);
|
||||
if (res.code === 1) {
|
||||
console.log("服务器:上传体力成功", res);
|
||||
//console.log("服务器:上传体力成功", res);
|
||||
if (callBack) callBack(res);
|
||||
} else {
|
||||
console.log("服务器:上传体力失败", res);
|
||||
//console.log("服务器:上传体力失败", res);
|
||||
if (callBack) callBack(res);
|
||||
}
|
||||
});
|
||||
|
@ -814,12 +814,12 @@ export default class Utils {
|
|||
action: 'read',
|
||||
}
|
||||
Utils.POST("userPower", setData, res => {
|
||||
console.log("获得userPower数据:", res);
|
||||
//console.log("获得userPower数据:", res);
|
||||
if (res.code === 1) {
|
||||
console.log("服务器:获得无限体力成功", res);
|
||||
//console.log("服务器:获得无限体力成功", res);
|
||||
if (callBack) callBack(res);
|
||||
} else {
|
||||
console.log("服务器:获得无限体力失败", res);
|
||||
//console.log("服务器:获得无限体力失败", res);
|
||||
if (callBack) callBack(res);
|
||||
}
|
||||
});
|
||||
|
@ -842,12 +842,12 @@ export default class Utils {
|
|||
}
|
||||
|
||||
Utils.POST("userPower", setData, res => {
|
||||
console.log("获得userPower数据:", res);
|
||||
//console.log("获得userPower数据:", res);
|
||||
if (res.code === 1) {
|
||||
console.log("服务器:上传无限体力成功", res);
|
||||
//console.log("服务器:上传无限体力成功", res);
|
||||
if (callBack) callBack(res);
|
||||
} else {
|
||||
console.log("服务器:上传无限体力失败", res);
|
||||
//console.log("服务器:上传无限体力失败", res);
|
||||
if (callBack) callBack(res);
|
||||
}
|
||||
});
|
||||
|
@ -865,12 +865,12 @@ export default class Utils {
|
|||
uid: cc.fx.GameConfig.GM_INFO.uid,
|
||||
}
|
||||
Utils.POST("monthGetReward", setData, res => {
|
||||
// console.log("获得monthGetReward数据:", res);
|
||||
// //console.log("获得monthGetReward数据:", res);
|
||||
if (res.code === 1) {
|
||||
// console.log("服务器:领取获得monthGetReward成功'✅ ", res);
|
||||
// //console.log("服务器:领取获得monthGetReward成功'✅ ", res);
|
||||
if (callBack) callBack(res);
|
||||
} else {
|
||||
// console.log("服务器:获得monthGetReward失败'❌ ", res);
|
||||
// //console.log("服务器:获得monthGetReward失败'❌ ", res);
|
||||
if (callBack) callBack(res);
|
||||
}
|
||||
});
|
||||
|
@ -881,7 +881,7 @@ export default class Utils {
|
|||
static getMonthlyCard(callBack) {
|
||||
if (typeof wx !== 'undefined' && wx !== null) {
|
||||
let uid = cc.fx.StorageMessage.getStorage("uid");
|
||||
// console.log("获取monthlyCard信息:", uid, monthCardTime);
|
||||
// //console.log("获取monthlyCard信息:", uid, monthCardTime);
|
||||
//旧的读取数据设置数据方法,以强联网为主
|
||||
if (uid != undefined && uid != "" && uid != null) {
|
||||
cc.fx.GameConfig.GM_INFO.uid = uid;
|
||||
|
@ -892,12 +892,12 @@ export default class Utils {
|
|||
}
|
||||
|
||||
Utils.POST("monthlyCard", setData, res => {
|
||||
// console.log("获得monthlyCard数据:", res);
|
||||
// //console.log("获得monthlyCard数据:", res);
|
||||
if (res.code === 1) {
|
||||
// console.log("服务器:获取monthlyCard成功'✅ ", res);
|
||||
// //console.log("服务器:获取monthlyCard成功'✅ ", res);
|
||||
if (callBack) callBack(res);
|
||||
} else {
|
||||
// console.log("服务器:获取monthlyCard失败'❌ ", res);
|
||||
// //console.log("服务器:获取monthlyCard失败'❌ ", res);
|
||||
if (callBack) callBack(res);
|
||||
}
|
||||
});
|
||||
|
@ -908,7 +908,7 @@ export default class Utils {
|
|||
static setMonthlyCard(monthCardTime, callBack) {
|
||||
if (typeof wx !== 'undefined' && wx !== null) {
|
||||
let uid = cc.fx.StorageMessage.getStorage("uid");
|
||||
// console.log("上传monthlyCard信息:", uid, monthCardTime);
|
||||
// //console.log("上传monthlyCard信息:", uid, monthCardTime);
|
||||
//旧的读取数据设置数据方法,以强联网为主
|
||||
if (uid != undefined && uid != "" && uid != null) {
|
||||
cc.fx.GameConfig.GM_INFO.uid = uid;
|
||||
|
@ -920,12 +920,12 @@ export default class Utils {
|
|||
}
|
||||
|
||||
Utils.POST("monthlyCard", setData, res => {
|
||||
// console.log("获得monthlyCard数据:", res);
|
||||
// //console.log("获得monthlyCard数据:", res);
|
||||
if (res.code === 1) {
|
||||
// console.log("服务器:上传monthlyCard成功'✅ ", res);
|
||||
// //console.log("服务器:上传monthlyCard成功'✅ ", res);
|
||||
if (callBack) callBack(res);
|
||||
} else {
|
||||
// console.log("服务器:上传monthlyCard失败'❌ ", res);
|
||||
// //console.log("服务器:上传monthlyCard失败'❌ ", res);
|
||||
if (callBack) callBack(res);
|
||||
}
|
||||
});
|
||||
|
@ -946,7 +946,7 @@ export default class Utils {
|
|||
|
||||
Utils.POST("canRebonGift", setData, res => {
|
||||
if (res.code === 1) {
|
||||
console.log("服务器:canRebonGift'✅ ", res);
|
||||
//console.log("服务器:canRebonGift'✅ ", res);
|
||||
if (callBack) callBack(res);
|
||||
} else {
|
||||
if (callBack) callBack(res);
|
||||
|
@ -960,7 +960,7 @@ export default class Utils {
|
|||
static rebornGift(rebornGift, callBack) {
|
||||
if (typeof wx !== 'undefined' && wx !== null) {
|
||||
let uid = cc.fx.StorageMessage.getStorage("uid");
|
||||
// console.log("上传monthlyCard信息:", uid, monthCardTime);
|
||||
// //console.log("上传monthlyCard信息:", uid, monthCardTime);
|
||||
//旧的读取数据设置数据方法,以强联网为主
|
||||
if (uid != undefined && uid != "" && uid != null) {
|
||||
cc.fx.GameConfig.GM_INFO.uid = uid;
|
||||
|
@ -972,12 +972,12 @@ export default class Utils {
|
|||
}
|
||||
|
||||
Utils.POST("rebornGift", setData, res => {
|
||||
// console.log("获得rebornGift数据:", res);
|
||||
// //console.log("获得rebornGift数据:", res);
|
||||
if (res.code === 1) {
|
||||
console.log("服务器:上传rebornGift成功'✅ ", res);
|
||||
//console.log("服务器:上传rebornGift成功'✅ ", res);
|
||||
if (callBack) callBack(res);
|
||||
} else {
|
||||
// console.log("服务器:上传rebornGift失败'❌ ", res);
|
||||
// //console.log("服务器:上传rebornGift失败'❌ ", res);
|
||||
if (callBack) callBack(res);
|
||||
}
|
||||
});
|
||||
|
@ -1011,9 +1011,9 @@ export default class Utils {
|
|||
}
|
||||
|
||||
Utils.POST("shareLvSuccess", data, res => {
|
||||
console.log("获得shareLvSuccess数据:", res);
|
||||
//console.log("获得shareLvSuccess数据:", res);
|
||||
if (res.code === 1) {
|
||||
console.log("服务器:分享帮助通过关卡数据成功", res);
|
||||
//console.log("服务器:分享帮助通过关卡数据成功", res);
|
||||
callBack(res);
|
||||
} else {
|
||||
attempt++;
|
||||
|
@ -1033,9 +1033,9 @@ export default class Utils {
|
|||
};
|
||||
if (typeof wx !== 'undefined' && wx !== null) {
|
||||
Utils.POST("getShareLv", data, res => {
|
||||
console.log("获得shareLvSuccess数据:", res);
|
||||
//console.log("获得shareLvSuccess数据:", res);
|
||||
if (res.code === 1) {
|
||||
console.log("服务器:分享帮助通过关卡数据成功", res);
|
||||
//console.log("服务器:分享帮助通过关卡数据成功", res);
|
||||
if (callBack) callBack(res);
|
||||
} else {
|
||||
if (callBack) callBack(res);
|
||||
|
|
|
@ -1190,6 +1190,11 @@ var GameTool = {
|
|||
eventData = {
|
||||
stage_id: (cc.fx.GameConfig.GM_INFO.level + 1)
|
||||
}
|
||||
if (cc.fx.GameConfig.GM_INFO.otherLevel > 0) {
|
||||
eventData = {
|
||||
stage_id: cc.fx.GameConfig.GM_INFO.otherLevel,
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "finish_stage":
|
||||
eventData = {
|
||||
|
@ -1198,6 +1203,14 @@ var GameTool = {
|
|||
added_time: data.add_Time,
|
||||
result: data.result
|
||||
}
|
||||
if (cc.fx.GameConfig.GM_INFO.otherLevel > 0) {
|
||||
eventData = {
|
||||
stage_id: cc.fx.GameConfig.GM_INFO.otherLevel,
|
||||
stage_duration: data.time,
|
||||
added_time: data.add_Time,
|
||||
result: data.result
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "resource_get":
|
||||
eventData = {
|
||||
|
@ -1234,7 +1247,7 @@ var GameTool = {
|
|||
case "payment": //发起充值时
|
||||
eventData = {
|
||||
order_id: data.outTradeNo,
|
||||
pay_amount: data.price,
|
||||
pay_amount: data.pay_amount,
|
||||
payment_name: data.payment_name,
|
||||
payment_num: data.payment_num,
|
||||
payment_type: data.type,
|
||||
|
@ -1243,17 +1256,24 @@ var GameTool = {
|
|||
case "payment_fail": //发起充值时
|
||||
eventData = {
|
||||
order_id: data.outTradeNo,
|
||||
pay_amount: data.price,
|
||||
pay_amount: data.pay_amount,
|
||||
payment_name: data.payment_name,
|
||||
payment_num: data.payment_num,
|
||||
payment_type: data.type,
|
||||
fail_reason: data.fail_reason,
|
||||
}
|
||||
break;
|
||||
case "stage_help": //帮助通关时
|
||||
eventData = {
|
||||
identity: data.identity, //发起者为helped 帮助者为helper
|
||||
level: data.level, //被帮助关卡等级
|
||||
success: data.success || null, //被帮助关卡是否成功
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (name == "finish_stage") {
|
||||
//console.log("准备上报完成");
|
||||
//console.log(eventData);
|
||||
if (name == "stage_help") {
|
||||
console.log("准备上报完成", data);
|
||||
console.log(eventData);
|
||||
// MiniGameSdk.API.showToast("准备上报完成游戏");
|
||||
}
|
||||
// MiniGameSdk.API.shushu_Track(name,eventData);
|
||||
|
|
|
@ -52,18 +52,21 @@ export default class NewClass extends cc.Component {
|
|||
Utils.getIosPayInfo(iosOutTradeNo,
|
||||
(data) => {
|
||||
console.log("获得轮训结果:", data);
|
||||
const iosID = data.data?.payment_name || this.iosProductId;
|
||||
let iosAmount = data.data?.goodsPrice || this.iosPrice;
|
||||
iosAmount = parseInt(iosAmount);
|
||||
if (data.code == 1) {
|
||||
console.log("购买成功");
|
||||
const dataSuccess = {
|
||||
outTradeNo: iosOutTradeNo,
|
||||
pay_amount: this.iosPrice,
|
||||
payment_name: this.iosProductId,
|
||||
pay_amount: iosAmount,
|
||||
payment_name: iosID,
|
||||
payment_num: this.iosCount,
|
||||
type: "ios",
|
||||
}
|
||||
cc.fx.GameTool.shushu_Track("payment", dataSuccess);
|
||||
let name = "购买金币道具:" + this.iosProductId;
|
||||
MiniGameSdk.API.yinli_Pay(this.iosPrice, iosOutTradeNo, name)
|
||||
let name = "购买金币道具:" + iosID;
|
||||
MiniGameSdk.API.yinli_Pay(iosAmount, iosOutTradeNo, name)
|
||||
Utils.setPayInfo(
|
||||
(res) => {
|
||||
this.closeLoad();
|
||||
|
@ -72,8 +75,8 @@ export default class NewClass extends cc.Component {
|
|||
console.log("_________正式发货");
|
||||
MiniGameSdk.API.showToast("充值成功");
|
||||
|
||||
if (this.iosProductId == "month_Card") {
|
||||
this.buyMonthCard(this.iosProductId);
|
||||
if (iosID == "month_Card") {
|
||||
this.buyMonthCard(iosID);
|
||||
}
|
||||
//console.log("充值成功获得金币");
|
||||
}
|
||||
|
@ -81,8 +84,8 @@ export default class NewClass extends cc.Component {
|
|||
MiniGameSdk.API.showToast("网络异常,充值奖励将在登录后再次发放");
|
||||
const dataFail4 = {
|
||||
outTradeNo: iosOutTradeNo,
|
||||
price: this.iosPrice,
|
||||
payment_name: this.iosProductId,
|
||||
pay_amount: iosAmount,
|
||||
payment_name: iosID,
|
||||
payment_num: this.iosCount,
|
||||
type: "ios",
|
||||
fail_reason: "成功付款,但是发货时请求服务器失败,充值成功未发货",
|
||||
|
@ -103,8 +106,8 @@ export default class NewClass extends cc.Component {
|
|||
this.btn_Touch = true;
|
||||
const dataFail = {
|
||||
outTradeNo: iosOutTradeNo,
|
||||
price: this.iosPrice,
|
||||
payment_name: this.iosProductId,
|
||||
pay_amount: iosAmount,
|
||||
payment_name: iosID,
|
||||
payment_num: this.iosCount,
|
||||
type: "ios",
|
||||
fail_reason: "用户取消充值",
|
||||
|
@ -117,8 +120,8 @@ export default class NewClass extends cc.Component {
|
|||
// MiniGameSdk.API.showToast("订单已关闭");
|
||||
const dataFail = {
|
||||
outTradeNo: iosOutTradeNo,
|
||||
price: this.iosPrice,
|
||||
payment_name: this.iosProductId,
|
||||
pay_amount: iosAmount,
|
||||
payment_name: iosID,
|
||||
payment_num: this.iosCount,
|
||||
type: "ios",
|
||||
fail_reason: "用户充值后,轮训结果超时",
|
||||
|
@ -354,7 +357,7 @@ export default class NewClass extends cc.Component {
|
|||
this.btn_Touch = true;
|
||||
const dataFail = {
|
||||
outTradeNo: Utils.outTradeNo,
|
||||
price: price,
|
||||
pay_amount: price,
|
||||
payment_name: productId,
|
||||
payment_num: 1,
|
||||
type: systemType,
|
||||
|
@ -374,7 +377,7 @@ export default class NewClass extends cc.Component {
|
|||
}
|
||||
const dataFail = {
|
||||
outTradeNo: Utils.outTradeNo,
|
||||
price: price,
|
||||
pay_amount: price,
|
||||
payment_name: productId,
|
||||
payment_num: 1,
|
||||
type: systemType,
|
||||
|
@ -394,7 +397,7 @@ export default class NewClass extends cc.Component {
|
|||
MiniGameSdk.API.showToast("取消充值");
|
||||
const dataFail2 = {
|
||||
outTradeNo: Utils.outTradeNo,
|
||||
price: price,
|
||||
pay_amount: price,
|
||||
payment_name: productId,
|
||||
payment_num: 1,
|
||||
type: systemType,
|
||||
|
@ -431,7 +434,7 @@ export default class NewClass extends cc.Component {
|
|||
MiniGameSdk.API.showToast("网络异常,充值奖励将在登录后再次发放");
|
||||
const dataFail4 = {
|
||||
outTradeNo: Utils.outTradeNo,
|
||||
price: price,
|
||||
pay_amount: price,
|
||||
payment_name: productId,
|
||||
payment_num: 1,
|
||||
type: systemType,
|
||||
|
@ -451,7 +454,7 @@ export default class NewClass extends cc.Component {
|
|||
|
||||
const dataFail3 = {
|
||||
outTradeNo: Utils.outTradeNo,
|
||||
price: price,
|
||||
pay_amount: price,
|
||||
payment_name: productId,
|
||||
payment_num: 1,
|
||||
type: systemType,
|
||||
|
|
|
@ -206,22 +206,24 @@ export default class NewClass extends cc.Component {
|
|||
Utils.getIosPayInfo(iosOutTradeNo,
|
||||
(data) => {
|
||||
console.log("获得轮训结果:", data);
|
||||
const iosID = data.data?.payment_name || this.iosProductId;
|
||||
let iosAmount = data.data?.goodsPrice || this.iosPrice;
|
||||
iosAmount = parseInt(iosAmount);
|
||||
if (data.code == 1) {
|
||||
console.log("购买成功");
|
||||
const iosID = data.data.payment_name;
|
||||
console.log("商品id:", iosID);
|
||||
const dataSuccess = {
|
||||
outTradeNo: iosOutTradeNo,
|
||||
pay_amount: this.iosPrice,
|
||||
pay_amount: iosAmount,
|
||||
payment_name: iosID,
|
||||
payment_num: this.iosCount,
|
||||
type: "ios",
|
||||
}
|
||||
cc.fx.GameTool.shushu_Track("payment", dataSuccess);
|
||||
let name = "购买金币道具:" + this.iosProductId;
|
||||
let name = "购买金币道具:" + iosID;
|
||||
let version = cc.fx.GameTool.getWechatGameVersion();
|
||||
if (version == "正式版") {
|
||||
MiniGameSdk.API.yinli_Pay(this.iosPrice, iosOutTradeNo, name)
|
||||
MiniGameSdk.API.yinli_Pay(iosAmount, iosOutTradeNo, name)
|
||||
}
|
||||
|
||||
Utils.setPayInfo(
|
||||
|
@ -244,7 +246,7 @@ export default class NewClass extends cc.Component {
|
|||
MiniGameSdk.API.showToast("网络异常,充值奖励将在登录后再次发放");
|
||||
const dataFail4 = {
|
||||
outTradeNo: iosOutTradeNo,
|
||||
price: this.iosPrice,
|
||||
pay_amount: iosAmount,
|
||||
payment_name: iosID,
|
||||
payment_num: this.iosCount,
|
||||
type: "ios",
|
||||
|
@ -267,8 +269,8 @@ export default class NewClass extends cc.Component {
|
|||
this.btn_Touch = true;
|
||||
const dataFail = {
|
||||
outTradeNo: iosOutTradeNo,
|
||||
price: this.iosPrice,
|
||||
payment_name: this.iosProductId,
|
||||
pay_amount: iosAmount,
|
||||
payment_name: iosID,
|
||||
payment_num: this.iosCount,
|
||||
type: "ios",
|
||||
fail_reason: "用户取消充值",
|
||||
|
@ -281,8 +283,8 @@ export default class NewClass extends cc.Component {
|
|||
MiniGameSdk.API.showToast("订单已关闭");
|
||||
const dataFail = {
|
||||
outTradeNo: iosOutTradeNo,
|
||||
price: this.iosPrice,
|
||||
payment_name: this.iosProductId,
|
||||
pay_amount: iosAmount,
|
||||
payment_name: iosID,
|
||||
payment_num: this.iosCount,
|
||||
type: "ios",
|
||||
fail_reason: "用户充值后,轮训结果超时",
|
||||
|
@ -483,7 +485,7 @@ export default class NewClass extends cc.Component {
|
|||
this.btn_Touch = true;
|
||||
const dataFail = {
|
||||
outTradeNo: Utils.outTradeNo,
|
||||
price: price,
|
||||
pay_amount: price,
|
||||
payment_name: productId,
|
||||
payment_num: 1,
|
||||
type: systemType,
|
||||
|
@ -503,7 +505,7 @@ export default class NewClass extends cc.Component {
|
|||
}
|
||||
const dataFail = {
|
||||
outTradeNo: Utils.outTradeNo,
|
||||
price: price,
|
||||
pay_amount: price,
|
||||
payment_name: productId,
|
||||
payment_num: 1,
|
||||
type: systemType,
|
||||
|
@ -516,7 +518,7 @@ export default class NewClass extends cc.Component {
|
|||
else {
|
||||
Utils.getPayInfo((data) => {
|
||||
// MiniGameSdk.API.showToast("充值成功");
|
||||
console.log("7.28_______________充值成功,准备轮训");
|
||||
console.log("7.28_______________充值成功,准备轮训", data);
|
||||
//console.log("获得轮训结果:", data);
|
||||
this.closeLoad();
|
||||
if (data.data.pay_state == 1) {
|
||||
|
@ -524,7 +526,7 @@ export default class NewClass extends cc.Component {
|
|||
MiniGameSdk.API.showToast("取消充值");
|
||||
const dataFail2 = {
|
||||
outTradeNo: Utils.outTradeNo,
|
||||
price: price,
|
||||
pay_amount: price,
|
||||
payment_name: productId,
|
||||
payment_num: 1,
|
||||
type: systemType,
|
||||
|
@ -568,7 +570,7 @@ export default class NewClass extends cc.Component {
|
|||
MiniGameSdk.API.showToast("网络异常,充值奖励将在登录后再次发放");
|
||||
const dataFail4 = {
|
||||
outTradeNo: Utils.outTradeNo,
|
||||
price: price,
|
||||
pay_amount: price,
|
||||
payment_name: productId,
|
||||
payment_num: 1,
|
||||
type: systemType,
|
||||
|
@ -588,7 +590,7 @@ export default class NewClass extends cc.Component {
|
|||
NumberToImage.numberToImageNodes(cc.fx.GameConfig.GM_INFO.coin, 30, 15, "coin_", this.coin, true);
|
||||
const dataFail3 = {
|
||||
outTradeNo: Utils.outTradeNo,
|
||||
price: price,
|
||||
pay_amount: price,
|
||||
payment_name: productId,
|
||||
payment_num: 1,
|
||||
type: systemType,
|
||||
|
|
Loading…
Reference in New Issue
Block a user