Commit 7a097db21e4c305ce35419efd633a857b8bad949

Authored by 宋庆平
1 parent c0c82ab4

X

sdk/shareTools.ts
1   -import { WxHelper } from "../Base/WxHelper";
2 1 import WXSDK from "../wxsdk/WXSDK";
3   -import { OnlineKeys, SDKTools } from "./SDKTools";
4   -
5 2 /*
6 3 * 分享与视频工具类;
7 4 */
8 5 export class ShareTools {
9   - private static isFail: boolean = false;
10 6 /**
11 7 * 是否进入分享 onShow有插屏的话用这个判断
12 8 */
... ... @@ -29,24 +25,6 @@ export class ShareTools {
29 25 this.onShowAd = false;
30 26 params && params.success && params.success(res);
31 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 28 this.onShowAd = false;
51 29 if (!params || !params.fail) {
52 30 wx.showToast({
... ...
wxsdk/base/SDKConst.ts
... ... @@ -4,7 +4,7 @@ export const GAMEDATA = {
4 4 game_id: '10001',//游戏id
5 5 channel_id: '10001',//渠道id 暂时和游戏id一致
6 6 version: '1.0.1', //版本号 中台控制正式还是测试服,尽量保持和小游戏版本一致
7   - appkey: 'd959274a83ea3b95bd1d9b765683eff6',//中台appkey
  7 + appkey: 'd959274a83ea3b95bd1d9b765683e777',//中台appkey
8 8 interstitialAdId: 'adunit-4bd19de3c351233e',//插屏ID
9 9 bannerId: 'adunit-25341fff11681315',//banner
10 10 customId: 'adunit-193590de82ede6a4',//原生模板单个
... ... @@ -33,8 +33,9 @@ export const GAMEDATA = {
33 33 }
34 34  
35 35  
  36 +
36 37 // sdk版本
37   -export const SDKVersion = 'v1.0.5';
  38 +export const SDKVersion = 'v1.0.6';
38 39 // 是否打印
39 40 export const __LOG__ = false;
40 41 // 是否mock
... ... @@ -88,6 +89,7 @@ export const HostKeys = {
88 89 role: 'logstores/role/track', //创建角色
89 90 client_log: 'logstores/client_log/track', //客户端日志
90 91 consume: 'logstores/consume/track', //资源上报
  92 + daystay: 'logstores/daystay/track', //300s停留上报
91 93  
92 94 //登录
93 95 Login: 'api/login', //登录
... ...
wxsdk/http/SDKApi.ts
... ... @@ -67,6 +67,8 @@ export class SDKApi {
67 67 public static client_log = (...args) => SDKHttp.httpGet(DataService.I.DotApi, HostKeys.client_log, ...args);
68 68  
69 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 74 // OrderApi
... ...
wxsdk/service/DataService.ts
... ... @@ -4,6 +4,7 @@ import StorageUtils from "../utils/StorageUtils";
4 4 import { StorageKeys, GAMEDATA, LoginHost, GameHost, DotHost, OrderHost, GMHost } from "../base/SDKConst";
5 5 import { Gender, NetworkType } from "../base/SDKEnum";
6 6 import WxLaunch from "../wx/WxLaunch";
  7 +import LogService from "./LogService";
7 8  
8 9 /**
9 10 * SDK数据管理类
... ... @@ -539,6 +540,7 @@ export default class DataService {
539 540 if (time >= 300 && dot == 0) {
540 541 StorageUtils.I.set("pcsdk_today_online_time_300", 1, expiration);
541 542 this.setPtm(1)
  543 + LogService.I.daystay();
542 544 clearInterval(this.timeInterval);
543 545 // 定时重启
544 546 setTimeout(() => {
... ...
wxsdk/service/LogService.ts
... ... @@ -501,6 +501,15 @@ export default class LogService {
501 501 })
502 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 /**
... ...