Commit 7a097db21e4c305ce35419efd633a857b8bad949
1 parent
c0c82ab4
Exists in
master
and in
3 other branches
X
Showing
5 changed files
with
17 additions
and
24 deletions
Show diff stats
sdk/shareTools.ts
1 | -import { WxHelper } from "../Base/WxHelper"; | ||
2 | import WXSDK from "../wxsdk/WXSDK"; | 1 | import WXSDK from "../wxsdk/WXSDK"; |
3 | -import { OnlineKeys, SDKTools } from "./SDKTools"; | ||
4 | - | ||
5 | /* | 2 | /* |
6 | * 分享与视频工具类; | 3 | * 分享与视频工具类; |
7 | */ | 4 | */ |
8 | export class ShareTools { | 5 | export class ShareTools { |
9 | - private static isFail: boolean = false; | ||
10 | /** | 6 | /** |
11 | * 是否进入分享 onShow有插屏的话用这个判断 | 7 | * 是否进入分享 onShow有插屏的话用这个判断 |
12 | */ | 8 | */ |
@@ -29,24 +25,6 @@ export class ShareTools { | @@ -29,24 +25,6 @@ export class ShareTools { | ||
29 | this.onShowAd = false; | 25 | this.onShowAd = false; |
30 | params && params.success && params.success(res); | 26 | params && params.success && params.success(res); |
31 | }).catch(async err => { | 27 | }).catch(async err => { |
32 | - console.log("err", err) | ||
33 | - if (err && err.code && err.code === 1006) { | ||
34 | - if (Math.random() > SDKTools.getParamsInt(OnlineKeys.shareRandom, 1) && !this.isFail) { | ||
35 | - this.isFail = true; | ||
36 | - let modalRes = await WxHelper.showModal({ | ||
37 | - title: '分享失败', | ||
38 | - content: `${Math.random() > 0.5 ? '分享失败,请重新分享!' : '请分享其它群试试!'}`, | ||
39 | - showCancel: true, | ||
40 | - confirmText: '去分享' | ||
41 | - }) | ||
42 | - if (modalRes) { | ||
43 | - ShareTools.share(shareKey, params, opts); | ||
44 | - return | ||
45 | - } | ||
46 | - } else { | ||
47 | - this.isFail = false; | ||
48 | - } | ||
49 | - } | ||
50 | this.onShowAd = false; | 28 | this.onShowAd = false; |
51 | if (!params || !params.fail) { | 29 | if (!params || !params.fail) { |
52 | wx.showToast({ | 30 | wx.showToast({ |
wxsdk/base/SDKConst.ts
@@ -4,7 +4,7 @@ export const GAMEDATA = { | @@ -4,7 +4,7 @@ export const GAMEDATA = { | ||
4 | game_id: '10001',//游戏id | 4 | game_id: '10001',//游戏id |
5 | channel_id: '10001',//渠道id 暂时和游戏id一致 | 5 | channel_id: '10001',//渠道id 暂时和游戏id一致 |
6 | version: '1.0.1', //版本号 中台控制正式还是测试服,尽量保持和小游戏版本一致 | 6 | version: '1.0.1', //版本号 中台控制正式还是测试服,尽量保持和小游戏版本一致 |
7 | - appkey: 'd959274a83ea3b95bd1d9b765683eff6',//中台appkey | 7 | + appkey: 'd959274a83ea3b95bd1d9b765683e777',//中台appkey |
8 | interstitialAdId: 'adunit-4bd19de3c351233e',//插屏ID | 8 | interstitialAdId: 'adunit-4bd19de3c351233e',//插屏ID |
9 | bannerId: 'adunit-25341fff11681315',//banner | 9 | bannerId: 'adunit-25341fff11681315',//banner |
10 | customId: 'adunit-193590de82ede6a4',//原生模板单个 | 10 | customId: 'adunit-193590de82ede6a4',//原生模板单个 |
@@ -33,8 +33,9 @@ export const GAMEDATA = { | @@ -33,8 +33,9 @@ export const GAMEDATA = { | ||
33 | } | 33 | } |
34 | 34 | ||
35 | 35 | ||
36 | + | ||
36 | // sdk版本 | 37 | // sdk版本 |
37 | -export const SDKVersion = 'v1.0.5'; | 38 | +export const SDKVersion = 'v1.0.6'; |
38 | // 是否打印 | 39 | // 是否打印 |
39 | export const __LOG__ = false; | 40 | export const __LOG__ = false; |
40 | // 是否mock | 41 | // 是否mock |
@@ -88,6 +89,7 @@ export const HostKeys = { | @@ -88,6 +89,7 @@ export const HostKeys = { | ||
88 | role: 'logstores/role/track', //创建角色 | 89 | role: 'logstores/role/track', //创建角色 |
89 | client_log: 'logstores/client_log/track', //客户端日志 | 90 | client_log: 'logstores/client_log/track', //客户端日志 |
90 | consume: 'logstores/consume/track', //资源上报 | 91 | consume: 'logstores/consume/track', //资源上报 |
92 | + daystay: 'logstores/daystay/track', //300s停留上报 | ||
91 | 93 | ||
92 | //登录 | 94 | //登录 |
93 | Login: 'api/login', //登录 | 95 | Login: 'api/login', //登录 |
wxsdk/http/SDKApi.ts
@@ -67,6 +67,8 @@ export class SDKApi { | @@ -67,6 +67,8 @@ export class SDKApi { | ||
67 | public static client_log = (...args) => SDKHttp.httpGet(DataService.I.DotApi, HostKeys.client_log, ...args); | 67 | public static client_log = (...args) => SDKHttp.httpGet(DataService.I.DotApi, HostKeys.client_log, ...args); |
68 | 68 | ||
69 | public static consume = (...args) => SDKHttp.httpGet(DataService.I.DotApi, HostKeys.consume, ...args); | 69 | public static consume = (...args) => SDKHttp.httpGet(DataService.I.DotApi, HostKeys.consume, ...args); |
70 | + | ||
71 | + public static daystay = (...args) => SDKHttp.httpGet(DataService.I.DotApi, HostKeys.daystay, ...args); | ||
70 | 72 | ||
71 | 73 | ||
72 | // OrderApi | 74 | // OrderApi |
wxsdk/service/DataService.ts
@@ -4,6 +4,7 @@ import StorageUtils from "../utils/StorageUtils"; | @@ -4,6 +4,7 @@ import StorageUtils from "../utils/StorageUtils"; | ||
4 | import { StorageKeys, GAMEDATA, LoginHost, GameHost, DotHost, OrderHost, GMHost } from "../base/SDKConst"; | 4 | import { StorageKeys, GAMEDATA, LoginHost, GameHost, DotHost, OrderHost, GMHost } from "../base/SDKConst"; |
5 | import { Gender, NetworkType } from "../base/SDKEnum"; | 5 | import { Gender, NetworkType } from "../base/SDKEnum"; |
6 | import WxLaunch from "../wx/WxLaunch"; | 6 | import WxLaunch from "../wx/WxLaunch"; |
7 | +import LogService from "./LogService"; | ||
7 | 8 | ||
8 | /** | 9 | /** |
9 | * SDK数据管理类 | 10 | * SDK数据管理类 |
@@ -539,6 +540,7 @@ export default class DataService { | @@ -539,6 +540,7 @@ export default class DataService { | ||
539 | if (time >= 300 && dot == 0) { | 540 | if (time >= 300 && dot == 0) { |
540 | StorageUtils.I.set("pcsdk_today_online_time_300", 1, expiration); | 541 | StorageUtils.I.set("pcsdk_today_online_time_300", 1, expiration); |
541 | this.setPtm(1) | 542 | this.setPtm(1) |
543 | + LogService.I.daystay(); | ||
542 | clearInterval(this.timeInterval); | 544 | clearInterval(this.timeInterval); |
543 | // 定时重启 | 545 | // 定时重启 |
544 | setTimeout(() => { | 546 | setTimeout(() => { |
wxsdk/service/LogService.ts
@@ -501,6 +501,15 @@ export default class LogService { | @@ -501,6 +501,15 @@ export default class LogService { | ||
501 | }) | 501 | }) |
502 | this.checkLogin(fun); | 502 | this.checkLogin(fun); |
503 | } | 503 | } |
504 | + /** | ||
505 | + * 300s停留上报 | ||
506 | + */ | ||
507 | + daystay() { | ||
508 | + let fun = () => SDKApi.daystay({ | ||
509 | + ...this.buildParams(), | ||
510 | + }) | ||
511 | + this.checkLogin(fun); | ||
512 | + } | ||
504 | 513 | ||
505 | 514 | ||
506 | /** | 515 | /** |