提交 8f4996e6 作者: wangjin

同步多喜玩版本

上级 8b3353b9
/** /**
* 鲸鱼游戏微信小游戏接入库 * 鲸鱼游戏微信小游戏接入库
* @author 推广技术部 * @author 推广技术部
* @time: 2022-10-21 * @time: 2023-02-17
* *
* 登录接口新增朋友圈按钮开关 * SDK增加右上角分享开关
* *
*/ */
class WechatSDK { class WechatSDK {
private sdkVersion: string = "3.2"; private sdkVersion: string = "3.3.1";
public LaunchOptions: Object; // 启动参数对象 public LaunchOptions: Object; // 启动参数对象
public SystemInfo: Object; // 设备信息 public SystemInfo: Object; // 设备信息
...@@ -18,6 +18,7 @@ class WechatSDK { ...@@ -18,6 +18,7 @@ class WechatSDK {
private clickCounter = 0; // 当前用户点击次数 private clickCounter = 0; // 当前用户点击次数
private GameRecorder: any = null; // 录屏对象 private GameRecorder: any = null; // 录屏对象
private recorderBtn: any = null; // 对局回放分享按钮对象 private recorderBtn: any = null; // 对局回放分享按钮对象
private contrlShareMenu:number = 0; // 右上角分享开关
constructor() { constructor() {
console.log("当前加载SDK版本号为:", this.sdkVersion); console.log("当前加载SDK版本号为:", this.sdkVersion);
this.sdkInit(); this.sdkInit();
...@@ -78,6 +79,7 @@ class WechatSDK { ...@@ -78,6 +79,7 @@ class WechatSDK {
this.LoginData["pay_channel"] = data.default_pay_channel; this.LoginData["pay_channel"] = data.default_pay_channel;
this.LoginData["ad_unit_id"] = data.ad_unit_id; this.LoginData["ad_unit_id"] = data.ad_unit_id;
this.LoginData["game_club"] = data.game_club; this.LoginData["game_club"] = data.game_club;
this.contrlShareMenu = data.share;
this.ActiReport(); // 上报激活 this.ActiReport(); // 上报激活
return this.sdkLogin(); return this.sdkLogin();
}; };
...@@ -116,7 +118,14 @@ class WechatSDK { ...@@ -116,7 +118,14 @@ class WechatSDK {
// 支付前先获取用户订单状态,如果没有未完成订单则继续支付 // 支付前先获取用户订单状态,如果没有未完成订单则继续支付
const { code, data, msg } = await this.fetchUri( const { code, data, msg } = await this.fetchUri(
Links.order, Links.order,
this.md5_sign({ ...this.SDKCOMMDATA, ...Params, token: this.LoginData["token"], pay_channel: this.LoginData["pay_channel"] }), this.md5_sign({
...this.SDKCOMMDATA,
...Params,
token: this.LoginData["token"],
equipmentname: this.SystemInfo["model"] || '',
equipmentos: this.SystemInfo["system"] || '',
pay_channel: this.LoginData["pay_channel"]
}),
"GET" "GET"
); );
this.hideLoading(); this.hideLoading();
...@@ -480,6 +489,7 @@ class WechatSDK { ...@@ -480,6 +489,7 @@ class WechatSDK {
}); });
} }
public addShareEvent = (shareInfo: shareInfo, callback?) => { public addShareEvent = (shareInfo: shareInfo, callback?) => {
if(!this.contrlShareMenu) return;
(wx as any).onShareAppMessage(() => { (wx as any).onShareAppMessage(() => {
if (callback) callback(); if (callback) callback();
const ShareParams = { const ShareParams = {
...@@ -503,7 +513,7 @@ class WechatSDK { ...@@ -503,7 +513,7 @@ class WechatSDK {
}; };
return this.share(ShareParams); return this.share(ShareParams);
} }
public ShareGameInfo = (shareInfo?) => { public ShareGameInfo = (shareInfo?:shareInfo) => {
// 参数,记录分享的用户openid // 参数,记录分享的用户openid
const ShareParams = { const ShareParams = {
title: shareInfo && shareInfo.title ? shareInfo.title : SDKConfig.shareTitle, title: shareInfo && shareInfo.title ? shareInfo.title : SDKConfig.shareTitle,
...@@ -822,9 +832,10 @@ declare interface shareInfo { ...@@ -822,9 +832,10 @@ declare interface shareInfo {
image?: string; image?: string;
imageId?: string; imageId?: string;
query?: string; query?: string;
success: any; success?: any;
fail: any; fail?: any;
complete?: any; complete?: any;
extraData?: any
} }
declare interface RecorderInfo { declare interface RecorderInfo {
duration: number; duration: number;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论