diff --git a/sdk/SDKTools.ts b/sdk/SDKTools.ts index 8820aef..df43072 100644 --- a/sdk/SDKTools.ts +++ b/sdk/SDKTools.ts @@ -317,6 +317,23 @@ export class SDKTools { static pay(params: { money: number; source:string }, opts: any = {}) { return WXSDK.game.pay(params, opts) } + /** + * 检测支付是否成功 + */ + static orderQuery(source:string) { + return WXSDK.game.orderQuery(source) + } + + + /** + * 用户创角 + * @param role_name 角色名称 + * @param region 区服 + */ + static role(role_name: string,region:string) { + return WXSDK.stat.role(role_name, region) + } + } @@ -326,4 +343,9 @@ export class SDKTools { export enum OnlineKeys { isOpenInterstitialAdId = 'isOpenInterstitialAdId', shareRandom = 'shareRandom', + switch_draw = 'switch_draw', + switch_banner = 'switch_banner', + switch_grid = 'switch_grid', + calendar_level_max = 'calendar_level_max', + over_show_ad = 'over_show_ad' } \ No newline at end of file diff --git a/wxsdk/base/SDKConst.ts b/wxsdk/base/SDKConst.ts index 30b785a..442e6f8 100644 --- a/wxsdk/base/SDKConst.ts +++ b/wxsdk/base/SDKConst.ts @@ -37,7 +37,7 @@ export const GAMEDATA = { // sdk版本 export const SDKVersion = 'v1.0'; // 是否打印 -export const __LOG__ = true; +export const __LOG__ = false; //游戏基础信息 export const VersionHost = 'https://wxsdk-ver.d3games.com/version'; @@ -75,6 +75,7 @@ export const HostKeys = { dot: 'logstores/events/track', //自定义打点 jumps: 'logstores/jumps/track', //游戏跳转 level: 'logstores/level/track', //关卡打点 + role: 'logstores/role/track', //创建角色 //登录 Login: 'api/login', //登录 @@ -94,7 +95,8 @@ export const HostKeys = { adList: 'api/adplan/list', //广告计划列表 //订单 - orderReport: 'api/order/report' //订单信息上报 + orderReport: 'api/order/report', //订单信息上报 + orderQuery: 'api/order/query' //订单信息查询 }; // 本地存储keys diff --git a/wxsdk/http/SDKApi.ts b/wxsdk/http/SDKApi.ts index 95c0ec3..642ff42 100644 --- a/wxsdk/http/SDKApi.ts +++ b/wxsdk/http/SDKApi.ts @@ -58,6 +58,10 @@ export class SDKApi { public static jumps = (...args) => SDKHttp.httpGet(`${DataService.I.DotApi}${HostKeys.jumps}`, ...args); public static level = (...args) => SDKHttp.httpGet(`${DataService.I.DotApi}${HostKeys.level}`, ...args); + + public static role = (...args) => SDKHttp.httpGet(`${DataService.I.DotApi}${HostKeys.role}`, ...args); public static pay = (...args) => SDKHttp.httpPost(`${DataService.I.OrderApi}${HostKeys.orderReport}`, ...args); + + public static orderQuery = (...args) => SDKHttp.httpPost(`${DataService.I.OrderApi}${HostKeys.orderQuery}`, ...args); } diff --git a/wxsdk/http/SDKHttp.ts b/wxsdk/http/SDKHttp.ts index a317446..8ba4968 100644 --- a/wxsdk/http/SDKHttp.ts +++ b/wxsdk/http/SDKHttp.ts @@ -25,7 +25,7 @@ export default class SDKHttp { if (data && typeof data === "object") { data = JSON.stringify(data); } - //console.error("sign", url, JSON.stringify(data)) + // console.error("sign", url, JSON.stringify(data)) data = data || ""; if (method == "GET" && data != "") { data = JSON.parse(data); diff --git a/wxsdk/service/GameService.ts b/wxsdk/service/GameService.ts index dddce51..3357651 100644 --- a/wxsdk/service/GameService.ts +++ b/wxsdk/service/GameService.ts @@ -1,6 +1,6 @@ import DataService from "./DataService"; import { SDKApi } from "../http/SDKApi"; -import { __LOG__ } from "../base/SDKConst"; +import { GAMEDATA, __LOG__ } from "../base/SDKConst"; import WxLogin from "../wx/WxLogin"; import WxApi from "../wx/WxApi"; import WxPay from "../wx/WxPay"; @@ -106,6 +106,32 @@ export default class GameService { pay(params: { money: number; source:string}, opts: any = {}) { return WxPay.I.pay(params, opts); } + /** + * 订单查询 + */ + orderQuery(source) { + return SDKApi.orderQuery({ + ...this.buildParams(), + source + }); + } + + + /** + * 构建登录/弱登录公用参数 + */ + private buildParams() { + let gameid = GAMEDATA.game_id; + let channel = DataService.I.ChannelId; + let uid = DataService.I.UserId; + let token = DataService.I.Token; + return { + gameid, + channel, + uid, + token + }; + } private static instance: GameService; static get I(): GameService { diff --git a/wxsdk/service/LogService.ts b/wxsdk/service/LogService.ts index f51960c..01df79f 100644 --- a/wxsdk/service/LogService.ts +++ b/wxsdk/service/LogService.ts @@ -423,6 +423,21 @@ export default class LogService { /** + * 用户创角 + * @param role_name 角色名称 + * @param region 区服 + */ + role(role_name: string,region:string) { + let fun = () => SDKApi.role({ + ...this.buildParams(), + role_name, + region + }) + this.checkLogin(fun); + } + + + /** * 构建登录/弱登录公用参数 */ private buildParams() { diff --git a/wxsdk/utils/SignUtils.ts b/wxsdk/utils/SignUtils.ts index aab95bf..a236b0f 100644 --- a/wxsdk/utils/SignUtils.ts +++ b/wxsdk/utils/SignUtils.ts @@ -11,7 +11,7 @@ export default class SignUtils { createSign(params: any) { let signStr = this.createQuery(params) + '' + GAMEDATA.appkey; - //console.error("signStr",signStr) + // console.error("signStr",signStr) return Md5.hashStr(signStr); } -- libgit2 0.21.0