From 3938c669255551ca7f281de471e1af6c7f576a1e Mon Sep 17 00:00:00 2001 From: 宋庆平 Date: Tue, 9 Jul 2024 17:39:54 +0800 Subject: [PATCH] 玩一玩V2 --- sdk/SDKTools.ts | 14 ++++++++++++++ wxsdk/alipay/AlipayApi.ts | 39 +++++++++++++++++++++++++++++++++++++++ wxsdk/base/SDKConst.ts | 4 +++- wxsdk/http/SDKApi.ts | 1 + 4 files changed, 57 insertions(+), 1 deletion(-) diff --git a/sdk/SDKTools.ts b/sdk/SDKTools.ts index dc36e7c..4d9fa6c 100644 --- a/sdk/SDKTools.ts +++ b/sdk/SDKTools.ts @@ -351,6 +351,20 @@ export class SDKTools { } + //阿里增量任务v2 + static incrementGameactionV2(action_code, success: Function, fail: Function) { + if (this.uid) { + AlipayApi.I.incrementGameactionV2(action_code).then((res) => { + success(); + }).catch((res) => { + fail && fail(); + }); + } else { + //登录状态过期,重进登录 + fail(); + } + } + } /** diff --git a/wxsdk/alipay/AlipayApi.ts b/wxsdk/alipay/AlipayApi.ts index 98d3997..7c5b7f5 100644 --- a/wxsdk/alipay/AlipayApi.ts +++ b/wxsdk/alipay/AlipayApi.ts @@ -543,6 +543,45 @@ export default class AlipayApi { }) }) } + + /** + * 玩一玩增量行为v2 + */ + incrementGameactionV2(action_code: string) { + return new Promise((resolve, reject) => { + if (window['my'] == undefined) return reject(null); + let channel = 'other'; + let info = my.getLaunchOptionsSync(); + if (info.query.channel == undefined) { + channel = 'other'; + } else { + if (info.query.channel.length <= 0 || info.query.channel == null) { + channel = 'other'; + } else { + channel = info.query.channel; + } + } + // my.alert({ + // title: '增加量行为', + // content:`${action_code}` + // }); + let uid = DataService.I.UserId; + let token = DataService.I.Token; + let openid = DataService.I.OpenId; + let action_finish_channel = channel + let params = { + uid, + token, + openid, + action_code, + action_finish_channel + }; + return SDKApi.aliMissionV2(params).then(() => { + resolve(null) + }) + }) + } + //段位 setRankSegmentData(rankKey: string, segment: number, segmentName: string) { return new Promise((resolve, reject) => { diff --git a/wxsdk/base/SDKConst.ts b/wxsdk/base/SDKConst.ts index 6d73b25..9dff088 100644 --- a/wxsdk/base/SDKConst.ts +++ b/wxsdk/base/SDKConst.ts @@ -29,7 +29,7 @@ export const GAMEDATA = { } // sdk版本 -export const SDKVersion = 'v1.0.8'; +export const SDKVersion = 'v1.0.9'; // 是否打印 export const __LOG__ = false; // 是否mock @@ -122,6 +122,8 @@ export const HostKeys = { alipayIntergralAuth: 'api/ali/point/auth',//支付宝会员积分授权 alipayIntergralQuery: 'api/ali/point/query',//支付宝会员积分查询 isAddHomePage: 'api/ali/homepage/consult',//玩一玩小程序是否已加首咨询 + + aliMissionV2: 'api/ali/incrementgameaction/submit',//阿里玩一玩增量任务v2 }; // 本地存储keys diff --git a/wxsdk/http/SDKApi.ts b/wxsdk/http/SDKApi.ts index 1c7aecf..4a84442 100644 --- a/wxsdk/http/SDKApi.ts +++ b/wxsdk/http/SDKApi.ts @@ -89,6 +89,7 @@ export class SDKApi { //阿里增量任务 public static aliMission = (...args) => SDKHttp.httpPost(DataService.I.GameApi, HostKeys.aliMission, ...args); + public static aliMissionV2 = (...args) => SDKHttp.httpPost(DataService.I.GameApi, HostKeys.aliMissionV2, ...args); //支付宝会员授权查询 public static alipayIntergralAuth = (...args) => SDKHttp.httpPost(DataService.I.GameApi, HostKeys.alipayIntergralAuth, ...args); -- libgit2 0.21.0