Commit b9a9b8993afb19021adbd2e8940b485c3ce403c9

Authored by 宋庆平
1 parent ff2edf11

X

sdk/SDKTools.ts
@@ -317,6 +317,23 @@ export class SDKTools { @@ -317,6 +317,23 @@ export class SDKTools {
317 static pay(params: { money: number; source:string }, opts: any = {}) { 317 static pay(params: { money: number; source:string }, opts: any = {}) {
318 return WXSDK.game.pay(params, opts) 318 return WXSDK.game.pay(params, opts)
319 } 319 }
  320 + /**
  321 + * 检测支付是否成功
  322 + */
  323 + static orderQuery(source:string) {
  324 + return WXSDK.game.orderQuery(source)
  325 + }
  326 +
  327 +
  328 + /**
  329 + * 用户创角
  330 + * @param role_name 角色名称
  331 + * @param region 区服
  332 + */
  333 + static role(role_name: string,region:string) {
  334 + return WXSDK.stat.role(role_name, region)
  335 + }
  336 +
320 337
321 } 338 }
322 339
@@ -326,4 +343,9 @@ export class SDKTools { @@ -326,4 +343,9 @@ export class SDKTools {
326 export enum OnlineKeys { 343 export enum OnlineKeys {
327 isOpenInterstitialAdId = 'isOpenInterstitialAdId', 344 isOpenInterstitialAdId = 'isOpenInterstitialAdId',
328 shareRandom = 'shareRandom', 345 shareRandom = 'shareRandom',
  346 + switch_draw = 'switch_draw',
  347 + switch_banner = 'switch_banner',
  348 + switch_grid = 'switch_grid',
  349 + calendar_level_max = 'calendar_level_max',
  350 + over_show_ad = 'over_show_ad'
329 } 351 }
330 \ No newline at end of file 352 \ No newline at end of file
wxsdk/base/SDKConst.ts
@@ -37,7 +37,7 @@ export const GAMEDATA = { @@ -37,7 +37,7 @@ export const GAMEDATA = {
37 // sdk版本 37 // sdk版本
38 export const SDKVersion = 'v1.0'; 38 export const SDKVersion = 'v1.0';
39 // 是否打印 39 // 是否打印
40 -export const __LOG__ = true; 40 +export const __LOG__ = false;
41 41
42 //游戏基础信息 42 //游戏基础信息
43 export const VersionHost = 'https://wxsdk-ver.d3games.com/version'; 43 export const VersionHost = 'https://wxsdk-ver.d3games.com/version';
@@ -75,6 +75,7 @@ export const HostKeys = { @@ -75,6 +75,7 @@ export const HostKeys = {
75 dot: 'logstores/events/track', //自定义打点 75 dot: 'logstores/events/track', //自定义打点
76 jumps: 'logstores/jumps/track', //游戏跳转 76 jumps: 'logstores/jumps/track', //游戏跳转
77 level: 'logstores/level/track', //关卡打点 77 level: 'logstores/level/track', //关卡打点
  78 + role: 'logstores/role/track', //创建角色
78 79
79 //登录 80 //登录
80 Login: 'api/login', //登录 81 Login: 'api/login', //登录
@@ -94,7 +95,8 @@ export const HostKeys = { @@ -94,7 +95,8 @@ export const HostKeys = {
94 adList: 'api/adplan/list', //广告计划列表 95 adList: 'api/adplan/list', //广告计划列表
95 96
96 //订单 97 //订单
97 - orderReport: 'api/order/report' //订单信息上报 98 + orderReport: 'api/order/report', //订单信息上报
  99 + orderQuery: 'api/order/query' //订单信息查询
98 }; 100 };
99 101
100 // 本地存储keys 102 // 本地存储keys
wxsdk/http/SDKApi.ts
@@ -58,6 +58,10 @@ export class SDKApi { @@ -58,6 +58,10 @@ export class SDKApi {
58 public static jumps = (...args) => SDKHttp.httpGet(`${DataService.I.DotApi}${HostKeys.jumps}`, ...args); 58 public static jumps = (...args) => SDKHttp.httpGet(`${DataService.I.DotApi}${HostKeys.jumps}`, ...args);
59 59
60 public static level = (...args) => SDKHttp.httpGet(`${DataService.I.DotApi}${HostKeys.level}`, ...args); 60 public static level = (...args) => SDKHttp.httpGet(`${DataService.I.DotApi}${HostKeys.level}`, ...args);
  61 +
  62 + public static role = (...args) => SDKHttp.httpGet(`${DataService.I.DotApi}${HostKeys.role}`, ...args);
61 63
62 public static pay = (...args) => SDKHttp.httpPost(`${DataService.I.OrderApi}${HostKeys.orderReport}`, ...args); 64 public static pay = (...args) => SDKHttp.httpPost(`${DataService.I.OrderApi}${HostKeys.orderReport}`, ...args);
  65 +
  66 + public static orderQuery = (...args) => SDKHttp.httpPost(`${DataService.I.OrderApi}${HostKeys.orderQuery}`, ...args);
63 } 67 }
wxsdk/http/SDKHttp.ts
@@ -25,7 +25,7 @@ export default class SDKHttp { @@ -25,7 +25,7 @@ export default class SDKHttp {
25 if (data && typeof data === "object") { 25 if (data && typeof data === "object") {
26 data = JSON.stringify(data); 26 data = JSON.stringify(data);
27 } 27 }
28 - //console.error("sign", url, JSON.stringify(data)) 28 + // console.error("sign", url, JSON.stringify(data))
29 data = data || ""; 29 data = data || "";
30 if (method == "GET" && data != "") { 30 if (method == "GET" && data != "") {
31 data = JSON.parse(data); 31 data = JSON.parse(data);
wxsdk/service/GameService.ts
1 import DataService from "./DataService"; 1 import DataService from "./DataService";
2 import { SDKApi } from "../http/SDKApi"; 2 import { SDKApi } from "../http/SDKApi";
3 -import { __LOG__ } from "../base/SDKConst"; 3 +import { GAMEDATA, __LOG__ } from "../base/SDKConst";
4 import WxLogin from "../wx/WxLogin"; 4 import WxLogin from "../wx/WxLogin";
5 import WxApi from "../wx/WxApi"; 5 import WxApi from "../wx/WxApi";
6 import WxPay from "../wx/WxPay"; 6 import WxPay from "../wx/WxPay";
@@ -106,6 +106,32 @@ export default class GameService { @@ -106,6 +106,32 @@ export default class GameService {
106 pay(params: { money: number; source:string}, opts: any = {}) { 106 pay(params: { money: number; source:string}, opts: any = {}) {
107 return WxPay.I.pay(params, opts); 107 return WxPay.I.pay(params, opts);
108 } 108 }
  109 + /**
  110 + * 订单查询
  111 + */
  112 + orderQuery(source) {
  113 + return SDKApi.orderQuery({
  114 + ...this.buildParams(),
  115 + source
  116 + });
  117 + }
  118 +
  119 +
  120 + /**
  121 + * 构建登录/弱登录公用参数
  122 + */
  123 + private buildParams() {
  124 + let gameid = GAMEDATA.game_id;
  125 + let channel = DataService.I.ChannelId;
  126 + let uid = DataService.I.UserId;
  127 + let token = DataService.I.Token;
  128 + return {
  129 + gameid,
  130 + channel,
  131 + uid,
  132 + token
  133 + };
  134 + }
109 135
110 private static instance: GameService; 136 private static instance: GameService;
111 static get I(): GameService { 137 static get I(): GameService {
wxsdk/service/LogService.ts
@@ -423,6 +423,21 @@ export default class LogService { @@ -423,6 +423,21 @@ export default class LogService {
423 423
424 424
425 /** 425 /**
  426 + * 用户创角
  427 + * @param role_name 角色名称
  428 + * @param region 区服
  429 + */
  430 + role(role_name: string,region:string) {
  431 + let fun = () => SDKApi.role({
  432 + ...this.buildParams(),
  433 + role_name,
  434 + region
  435 + })
  436 + this.checkLogin(fun);
  437 + }
  438 +
  439 +
  440 + /**
426 * 构建登录/弱登录公用参数 441 * 构建登录/弱登录公用参数
427 */ 442 */
428 private buildParams() { 443 private buildParams() {
wxsdk/utils/SignUtils.ts
@@ -11,7 +11,7 @@ export default class SignUtils { @@ -11,7 +11,7 @@ export default class SignUtils {
11 11
12 createSign(params: any) { 12 createSign(params: any) {
13 let signStr = this.createQuery(params) + '' + GAMEDATA.appkey; 13 let signStr = this.createQuery(params) + '' + GAMEDATA.appkey;
14 - //console.error("signStr",signStr) 14 + // console.error("signStr",signStr)
15 return Md5.hashStr(signStr); 15 return Md5.hashStr(signStr);
16 } 16 }
17 17