{
  "code": "import { AccountManager } from \"./AccountManager\";\r\nimport { GameTools } from \"../GameUtils/GameTools\";\r\nexport class ShareUtil {\r\n    beginShare(callBack) {\r\n        ShareUtil.beginShareTime = new Date().getTime();\r\n        console.log(\"分享点击时间=\" + ShareUtil.beginShareTime);\r\n        ShareUtil.isSharing = true;\r\n        ShareUtil.callback = callBack;\r\n    }\r\n    onRegister() {\r\n        if (Laya.Browser.window.wx == null) {\r\n            return;\r\n        }\r\n        Laya.Browser.window.wx.onShow(function (option) {\r\n            console.log(\"onshow share start\");\r\n            if (ShareUtil.isSharing) {\r\n                ShareUtil.isSharing = false;\r\n                let time = new Date().getTime();\r\n                console.log(\"分享回到游戏时间\" + time);\r\n                let wait = (time - ShareUtil.beginShareTime) / 1000;\r\n                console.log(\"分享停留时间为：\" + wait);\r\n                let shareSuccess = false;\r\n                let realSuccess = false;\r\n                if (wait < 3) {\r\n                    Laya.Browser.window.wx.showToast({ title: \"请重试一次\" });\r\n                    ShareUtil.callback(false);\r\n                }\r\n                else {\r\n                    var random = Math.random();\r\n                    if (random <= 0.3) {\r\n                        var message = [\"你已分享过该群\", \"请重新换个群分享！\", \"请分享到30人大群中！\"];\r\n                        var curmes = message[GameTools.RandomANumber(0, 2)];\r\n                        Laya.Browser.window.wx.showToast({ title: curmes });\r\n                        ShareUtil.callback(false);\r\n                    }\r\n                    else {\r\n                        Laya.Browser.window.wx.showToast({ title: \"分享成功!\" });\r\n                        ShareUtil.callback(true);\r\n                    }\r\n                }\r\n            }\r\n        });\r\n    }\r\n    static ShareMessage() {\r\n        if (!Laya.Browser.onWeiXin)\r\n            return;\r\n        var t = AccountManager.Instance.ServerTime;\r\n        var _title = AccountManager.Instance.curplayerData.ShareTxt;\r\n        _title = (_title == \"\" || !_title) ? \"有人@你，快来比一比枪法\" : _title;\r\n        var _image = \"subpackage/res/share/1.jpg\";\r\n        Laya.Browser.window.wx.onShareAppMessage(() => ({\r\n            title: _title,\r\n            imageUrl: _image,\r\n            query: \"shareid=\" + AccountManager.Instance.curplayerData.userId + \"_\" + t + \"_\" + Math.floor(9999 * Math.random()).toString()\r\n        }));\r\n    }\r\n    static shareImage(channel, callback = null, shareType) {\r\n        if (Laya.Browser.window.wx == null) {\r\n            return;\r\n        }\r\n        var t = AccountManager.Instance.ServerTime;\r\n        var _title = AccountManager.Instance.curplayerData.ShareTxt;\r\n        _title = (_title == \"\" || !_title) ? \"有人@你，快来比一比枪法\" : _title;\r\n        var _image = \"subpackage/res/share/1.jpg\";\r\n        Laya.Browser.window.wx.aldShareAppMessage({\r\n            title: _title,\r\n            imageUrl: _image,\r\n            query: \"userId=\" + AccountManager.Instance.curplayerData.userId + \"_\" + shareType + \"_\" + t + \"_\" + Math.floor(9999 * Math.random()).toString()\r\n        });\r\n        if (callback) {\r\n            ShareUtil.Instance.beginShare(callback);\r\n        }\r\n    }\r\n}\r\nShareUtil.Instance = new ShareUtil();\r\nShareUtil.shareSuccessTime = 0;\r\nShareUtil.isSharing = false;\r\n//# sourceMappingURL=ShareUtil.js.map",
  "references": [
    "E:/LayaProject/RubikCube/src/NetWork/AccountManager.ts",
    "E:/LayaProject/RubikCube/src/GameUtils/GameTools.ts"
  ],
  "map": "{\"version\":3,\"file\":\"ShareUtil.js\",\"sourceRoot\":\"\",\"sources\":[\"../../../src/NetWork/ShareUtil.ts\"],\"names\":[],\"mappings\":\"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAMlD,MAAM,OAAO,SAAS;IASZ,UAAU,CAAC,QAAQ;QAEpB,SAAS,CAAC,cAAc,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC;QAClD,OAAO,CAAC,GAAG,CAAC,SAAS,GAAG,SAAS,CAAC,cAAc,CAAC,CAAC;QAChD,SAAS,CAAC,SAAS,GAAG,IAAI,CAAC;QAC3B,SAAS,CAAC,QAAQ,GAAG,QAAQ,CAAC;IACpC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