Commit f4900f893ff79f5cf914b20affe2cea8fde6d50a
1 parent
297137b2
Exists in
master
and in
3 other branches
X
Showing
9 changed files
with
54 additions
and
10 deletions
Show diff stats
sdk/Analytics.ts
1 | +import { LogLevel } from "../wxsdk/service/LogService"; | ||
1 | import WXSDK from "../wxsdk/WXSDK"; | 2 | import WXSDK from "../wxsdk/WXSDK"; |
2 | 3 | ||
3 | 4 | ||
@@ -77,11 +78,19 @@ export class Analytics { | @@ -77,11 +78,19 @@ export class Analytics { | ||
77 | return WXSDK.stat.levelEnd(stageid, stagename, pattern, event, times, perc) | 78 | return WXSDK.stat.levelEnd(stageid, stagename, pattern, event, times, perc) |
78 | } | 79 | } |
79 | 80 | ||
81 | + | ||
82 | + | ||
83 | + /** | ||
84 | + * 客户端日志 | ||
85 | + * @param content 内容 | ||
86 | + * @param level 日志等级 | ||
87 | + * @returns | ||
88 | + */ | ||
89 | + clientLog(content, level = LogLevel.debug) { | ||
90 | + return WXSDK.stat.clientLog(content, level) | ||
91 | + } | ||
92 | + | ||
93 | + | ||
80 | } | 94 | } |
81 | export enum EventKey { | 95 | export enum EventKey { |
82 | - toggleScene = 'toggleScene', | ||
83 | - recoverGame = 'recoverGame', | ||
84 | - replayGame = 'replayGame', | ||
85 | - settingClose = 'settingClose', | ||
86 | - updateLvUI = 'updateLvUI', | ||
87 | -} | ||
88 | \ No newline at end of file | 96 | \ No newline at end of file |
97 | +} |
wxsdk/base/SDKConst.ts
@@ -76,6 +76,7 @@ export const HostKeys = { | @@ -76,6 +76,7 @@ export const HostKeys = { | ||
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 | role: 'logstores/role/track', //创建角色 |
79 | + client_log: 'logstores/client_log/track', //客户端日志 | ||
79 | 80 | ||
80 | //登录 | 81 | //登录 |
81 | Login: 'api/login', //登录 | 82 | Login: 'api/login', //登录 |
wxsdk/http/SDKApi.ts
@@ -60,6 +60,8 @@ export class SDKApi { | @@ -60,6 +60,8 @@ export class SDKApi { | ||
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 | 61 | ||
62 | public static role = (...args) => SDKHttp.httpGet(`${DataService.I.DotApi}${HostKeys.role}`, ...args); | 62 | public static role = (...args) => SDKHttp.httpGet(`${DataService.I.DotApi}${HostKeys.role}`, ...args); |
63 | + | ||
64 | + public static client_log = (...args) => SDKHttp.httpGet(`${DataService.I.DotApi}${HostKeys.client_log}`, ...args); | ||
63 | 65 | ||
64 | public static pay = (...args) => SDKHttp.httpPost(`${DataService.I.OrderApi}${HostKeys.orderReport}`, ...args); | 66 | public static pay = (...args) => SDKHttp.httpPost(`${DataService.I.OrderApi}${HostKeys.orderReport}`, ...args); |
65 | 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/lib/sdk.d.ts
wxsdk/service/DataService.ts
@@ -146,6 +146,7 @@ export default class DataService { | @@ -146,6 +146,7 @@ export default class DataService { | ||
146 | 146 | ||
147 | setUserId(val: any) { | 147 | setUserId(val: any) { |
148 | this.setValue('userId', val); | 148 | this.setValue('userId', val); |
149 | + StorageUtils.I.set("userId",val); | ||
149 | return this; | 150 | return this; |
150 | } | 151 | } |
151 | 152 |
wxsdk/service/LogService.ts
@@ -443,6 +443,19 @@ export default class LogService { | @@ -443,6 +443,19 @@ export default class LogService { | ||
443 | }) | 443 | }) |
444 | this.checkLogin(fun); | 444 | this.checkLogin(fun); |
445 | } | 445 | } |
446 | + /** | ||
447 | + * 客户端日志 | ||
448 | + */ | ||
449 | + clientLog(content, level = LogLevel.debug) { | ||
450 | + SDKApi.client_log({ | ||
451 | + APIVersion: '0.6.0', | ||
452 | + gameid: GAMEDATA.game_id, | ||
453 | + cacheUserId: StorageUtils.I.get("userId") || "0", | ||
454 | + level: LogLevel[level], | ||
455 | + content | ||
456 | + // level: | ||
457 | + }) | ||
458 | + } | ||
446 | 459 | ||
447 | 460 | ||
448 | /** | 461 | /** |
@@ -483,4 +496,22 @@ export default class LogService { | @@ -483,4 +496,22 @@ export default class LogService { | ||
483 | static get I(): LogService { | 496 | static get I(): LogService { |
484 | return this.instance || (this.instance = new LogService()); | 497 | return this.instance || (this.instance = new LogService()); |
485 | } | 498 | } |
499 | +} | ||
500 | + | ||
501 | + | ||
502 | + | ||
503 | +/** | ||
504 | + * 日志等级 | ||
505 | + * debug:详细的信息,通常只出现在诊断问题上 | ||
506 | + info:确认一切按预期运行 | ||
507 | + warning:一个迹象表明,一些意想不到的事情发生了 | ||
508 | + error:更严重的问题,软件没能执行一些功能 | ||
509 | + critical:一个严重的错误,这表明程序本身可能无法继续运行 | ||
510 | + */ | ||
511 | +export enum LogLevel { | ||
512 | + debug, | ||
513 | + info, | ||
514 | + warning, | ||
515 | + error, | ||
516 | + critical | ||
486 | } | 517 | } |
487 | \ No newline at end of file | 518 | \ No newline at end of file |
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 |
wxsdk/wx/WxInterstitial.ts
@@ -38,8 +38,8 @@ export default class WxInterstitial { | @@ -38,8 +38,8 @@ export default class WxInterstitial { | ||
38 | WxInterstitial.interstitialSuccell = true; | 38 | WxInterstitial.interstitialSuccell = true; |
39 | LogService.I.adStat('InterstitialAd', this.interstitialAdId, DOT_AD_TYPE.interstitial, DOT_AD_STATUS.rt) | 39 | LogService.I.adStat('InterstitialAd', this.interstitialAdId, DOT_AD_TYPE.interstitial, DOT_AD_STATUS.rt) |
40 | if (isShow) { | 40 | if (isShow) { |
41 | - this.interstitialAd.show() | ||
42 | LogService.I.adStat('InterstitialAd', this.interstitialAdId, DOT_AD_TYPE.interstitial, DOT_AD_STATUS.show) | 41 | LogService.I.adStat('InterstitialAd', this.interstitialAdId, DOT_AD_TYPE.interstitial, DOT_AD_STATUS.show) |
42 | + this.interstitialAd.show() | ||
43 | } | 43 | } |
44 | }) | 44 | }) |
45 | this.interstitialAd.onError(err => { | 45 | this.interstitialAd.onError(err => { |