增加腾讯sdk 和活动ID收集
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
|
||||
import { SDK } from './index.js';
|
||||
import Utils from "../module/Pay/Utils";
|
||||
import { getProvinceName } from "../module/Position/GetPosition";
|
||||
// import { getProvinceName } from "../module/Position/ProvinceLocator";
|
||||
@@ -972,6 +974,7 @@ export namespace MiniGameSdk {
|
||||
private static _userInfo: any = null;
|
||||
private static _ta: any = null;
|
||||
private static _ge: any = null;
|
||||
static _tencent: any;
|
||||
/**
|
||||
* 分享app给朋友,微信小游戏分享是没有onSuccess回调的。
|
||||
* @param title 标题
|
||||
@@ -1525,6 +1528,42 @@ export namespace MiniGameSdk {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//#region 腾讯平台SDK
|
||||
/*
|
||||
* 腾讯平台SDK初始化以及登录
|
||||
*/
|
||||
static tencent_Init() {
|
||||
//@ts-ignore
|
||||
if ((typeof wx !== 'undefined' && wx !== null) || (typeof tt !== 'undefined' && tt !== null)) {
|
||||
// console.log("开始接入腾讯平台");
|
||||
//getWechatGameVersion
|
||||
// 初始化SDK
|
||||
try {
|
||||
API._tencent = new SDK({
|
||||
user_action_set_id: 1221926061,
|
||||
secret_key: "932fed3776ad7c390b16b54317b856de",
|
||||
appid: "wx30f74367b3d3e7a6",
|
||||
auto_track: true,
|
||||
});
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static tencent_Purchase(payAmount: number) {
|
||||
if (API._tencent) API._tencent.onPurchase(payAmount);
|
||||
}
|
||||
|
||||
static tencent_SetOpenId(openId: string) {
|
||||
if (API._tencent) API._tencent.setOpenId(cc.fx.GameConfig.GM_INFO.openid);
|
||||
}
|
||||
|
||||
static tencent_OnRegister() {
|
||||
if (API._tencent) API._tencent.onRegister();
|
||||
}
|
||||
|
||||
//#region 数数平台
|
||||
/*
|
||||
* 数数平台初始化以及登录
|
||||
@@ -1573,6 +1612,18 @@ export namespace MiniGameSdk {
|
||||
} else {
|
||||
// console.log('未获取到用户的 account_id');
|
||||
}
|
||||
|
||||
// 设置广告属性
|
||||
if (cc.fx.GameConfig.GM_INFO.ge_ad_id != "") {
|
||||
console.log("___________上报ge_ad_id", cc.fx.GameConfig.GM_INFO.ge_ad_id);
|
||||
API._ta.userSet({ ge_ad_id: cc.fx.GameConfig.GM_INFO.ge_ad_id });
|
||||
}
|
||||
|
||||
if (cc.fx.GameConfig.GM_INFO.ge_creative_id != "") {
|
||||
console.log("___________上报ge_creative_id", cc.fx.GameConfig.GM_INFO.ge_creative_id);
|
||||
API._ta.userSet({ ge_creative_id: cc.fx.GameConfig.GM_INFO.ge_creative_id });
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1594,6 +1645,7 @@ export namespace MiniGameSdk {
|
||||
console.log("_______________设置用户注册属性", time);
|
||||
API._ta.userSet({ register_time: time });
|
||||
API._ta.userSetOnce({ uid: cc.fx.GameConfig.GM_INFO.userId.toString() });
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1624,6 +1676,7 @@ export namespace MiniGameSdk {
|
||||
magic_amount: cc.fx.GameConfig.GM_INFO.magicAmount,//当前道具
|
||||
version: cc.fx.GameConfig.GM_INFO.version.toString(),//当前版本号
|
||||
user_id: cc.fx.GameConfig.GM_INFO.userId //用户id
|
||||
|
||||
};
|
||||
if (register_time != null) {
|
||||
// console.log("设置用户公共属性注册:————————————", register_time);
|
||||
@@ -1786,6 +1839,7 @@ export namespace MiniGameSdk {
|
||||
if (version == "开发版" || version == "体验版") {
|
||||
}
|
||||
else {
|
||||
if (API._tencent) API._tencent.onPurchase(payAmount);
|
||||
API._ge.payEvent(payAmount, "CNY", orderId, payReason, "微信");
|
||||
}
|
||||
console.log("版本:", version);
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "0aee96c9-7352-4339-8934-b47cf019070b",
|
||||
"importer": "javascript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
||||
Reference in New Issue
Block a user