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 | 2 | import WXSDK from "../wxsdk/WXSDK"; |
2 | 3 | |
3 | 4 | |
... | ... | @@ -77,11 +78,19 @@ export class Analytics { |
77 | 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 | 95 | export enum EventKey { |
82 | - toggleScene = 'toggleScene', | |
83 | - recoverGame = 'recoverGame', | |
84 | - replayGame = 'replayGame', | |
85 | - settingClose = 'settingClose', | |
86 | - updateLvUI = 'updateLvUI', | |
87 | -} | |
88 | 96 | \ No newline at end of file |
97 | +} | ... | ... |
wxsdk/base/SDKConst.ts
wxsdk/http/SDKApi.ts
... | ... | @@ -60,6 +60,8 @@ export class SDKApi { |
60 | 60 | public static level = (...args) => SDKHttp.httpGet(`${DataService.I.DotApi}${HostKeys.level}`, ...args); |
61 | 61 | |
62 | 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 | 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 | 25 | if (data && typeof data === "object") { |
26 | 26 | data = JSON.stringify(data); |
27 | 27 | } |
28 | - // console.error("sign", url, JSON.stringify(data)) | |
28 | + //console.error("sign", url, JSON.stringify(data)) | |
29 | 29 | data = data || ""; |
30 | 30 | if (method == "GET" && data != "") { |
31 | 31 | data = JSON.parse(data); | ... | ... |
wxsdk/lib/sdk.d.ts
wxsdk/service/DataService.ts
wxsdk/service/LogService.ts
... | ... | @@ -443,6 +443,19 @@ export default class LogService { |
443 | 443 | }) |
444 | 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 | 496 | static get I(): LogService { |
484 | 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 | 518 | \ No newline at end of file | ... | ... |
wxsdk/utils/SignUtils.ts
... | ... | @@ -11,7 +11,7 @@ export default class SignUtils { |
11 | 11 | |
12 | 12 | createSign(params: any) { |
13 | 13 | let signStr = this.createQuery(params) + '' + GAMEDATA.appkey; |
14 | - // console.error("signStr",signStr) | |
14 | + //console.error("signStr",signStr) | |
15 | 15 | return Md5.hashStr(signStr); |
16 | 16 | } |
17 | 17 | ... | ... |
wxsdk/wx/WxInterstitial.ts
... | ... | @@ -38,8 +38,8 @@ export default class WxInterstitial { |
38 | 38 | WxInterstitial.interstitialSuccell = true; |
39 | 39 | LogService.I.adStat('InterstitialAd', this.interstitialAdId, DOT_AD_TYPE.interstitial, DOT_AD_STATUS.rt) |
40 | 40 | if (isShow) { |
41 | - this.interstitialAd.show() | |
42 | 41 | LogService.I.adStat('InterstitialAd', this.interstitialAdId, DOT_AD_TYPE.interstitial, DOT_AD_STATUS.show) |
42 | + this.interstitialAd.show() | |
43 | 43 | } |
44 | 44 | }) |
45 | 45 | this.interstitialAd.onError(err => { | ... | ... |