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AC;QAChB,CAAC;QAED,aAAa;QACN,eAAe,CAAC,KAAa,EAAE,OAAe,EAAE,KAAa,EAAE,QAAyB;YAC3F,IAAI,QAAQ,GAAG,cAAc,CAAC;YAC9B,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,QAAQ,CAAC,CAAC;QACtG,CAAC;QAED,cAAc;QACP,kBAAkB;YACrB,IAAI,QAAQ,GAAG,iBAAiB,CAAC;YACjC,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,EAAE,QAAQ,CAAC,CAAC;QACrC,CAAC;;IA9DuB,2BAAS,GAAsB,IAAI,iBAAiB,EAAE,CAAC;IAgEnF,wBAAC;KAAA;kBAjEoB,iBAAiB","file":"","sourceRoot":"/","sourcesContent":["import CooperationDataCenter, { SubGameLocation } from \"./CooperationDataCenter\";\nimport { CryptoJS } from \"../script/CryptoJS\";\n\ninterface BaseDotElements {\n mainGameId: string;\n mainAppId: string;\n dotTime: string;\n channel: string;\n}\nconst SALT = \"d0dd883ae80667d27b924d1e52b78b59\";\n/**打点服务 */\nconst DOT_SERVER = \"/client/v1/event/log/put\";\n/**测试服打点地址 */\nconst DOT_URL_DEBUG = \"https://eventstat-test.icesimba.com\";\n/**正式服打点地址 */\nconst DOT_URL_RELEASE = \"https://eventstat.icesimba.com\";\n/**是否打点到测试服,否则打点到正式服 */\nconst DOT_DEBUG = false;\n/**游戏id */\nconst GAME_ID = \"cooperation\";\nexport default class CooperationDotMgr {\n private static readonly _instance: CooperationDotMgr = new CooperationDotMgr();\n\n public static getInstance(): CooperationDotMgr {\n return CooperationDotMgr._instance;\n }\n\n /**获取打点请求服务 */\n getXHR(): XMLHttpRequest {\n let url = DOT_DEBUG ? DOT_URL_DEBUG : DOT_URL_RELEASE;\n url += DOT_SERVER;\n let xmlHttp = new XMLHttpRequest();\n xmlHttp.open('POST', url);\n xmlHttp.setRequestHeader('Content-Type', 'application/json;charset=UTF-8');\n xmlHttp.onreadystatechange = function () {\n if (xmlHttp.readyState === 4) {\n if (xmlHttp.status === 200) {\n console.log(\"dot succeed\");\n }\n }\n }\n return xmlHttp;\n }\n\n private async dot(eventKey: string, gameData: any, category?: string) {\n let channel: string = CooperationDataCenter.getInstance().getCurGameChannel();\n if (\"dummy\" === channel || \"\" === channel) return;\n let data = this.getBaseElements();\n data[\"category\"] = category ? category : \"cooperation_event\";\n data[\"id\"] = eventKey ? eventKey : \"event\";\n data[\"game_data\"] = gameData ? gameData : {};\n data[\"game_id\"] = GAME_ID;\n let xhr = this.getXHR();\n let stringfyData = JSON.stringify(data);\n let upLoadData = {\n event_type: category,\n data: stringfyData,\n sign: CryptoJS.MD5(stringfyData + SALT).toString()\n };\n let upLoadStringfy = JSON.stringify(upLoadData);\n await xhr.send(upLoadStringfy);\n }\n\n private getBaseElements(): BaseDotElements {\n let base: BaseDotElements = {\n mainGameId: CooperationDataCenter.getInstance().getCurGameID(),\n mainAppId: CooperationDataCenter.getInstance().getCurGameAppID(),\n dotTime: (new Date()).toTimeString(),\n channel: CooperationDataCenter.getInstance().getCurGameChannel()\n };\n return base;\n }\n\n /**点击子游戏打点 */ \n public dotClickSubGame(appId: string, appName: string, index: number, location: SubGameLocation) {\n let eventKey = \"clickSubGame\";\n this.dot(eventKey, { appId: appId, appName:appName, index: index, location: location }, eventKey);\n }\n\n /**点击游戏中心打点 */\n public dotClickGameCenter() {\n let eventKey = \"clickGameCenter\";\n this.dot(eventKey, {}, eventKey);\n }\n\n}"]}