From 59916a0eb28604bc62efe14b414e26b23d20123d Mon Sep 17 00:00:00 2001 From: zhl Date: Fri, 19 Apr 2019 15:55:04 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=B8=B8=E6=88=8F=E5=AD=98?= =?UTF-8?q?=E6=B4=BB=E4=B8=8A=E6=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fc/index.html | 5 +++-- fc/js/jcfw/jcgamelog.js | 15 +++++++++++++++ fc/js/jcmatchvs.js | 35 +++++++++++++---------------------- fc/js/logger.js | 31 +++++++++++++++++++++++++++++++ gba/index.html | 7 +++++++ gba2/index.html | 8 +++++++- gulpfile.js | 5 ++--- 7 files changed, 78 insertions(+), 28 deletions(-) create mode 100644 fc/js/logger.js diff --git a/fc/index.html b/fc/index.html index bc224e8..62399a6 100644 --- a/fc/index.html +++ b/fc/index.html @@ -7,12 +7,13 @@ - - + + + diff --git a/fc/js/jcfw/jcgamelog.js b/fc/js/jcfw/jcgamelog.js index 8f8c986..fb33352 100644 --- a/fc/js/jcfw/jcgamelog.js +++ b/fc/js/jcfw/jcgamelog.js @@ -624,6 +624,21 @@ const jcgamelog = { this._report(JC_LOG_T.restartgame, data); }, + // 上报游戏还活着 + logGameAlive(param){ + //this._tempuuid = this.generateUUID(); + this._starttime = new Date().getTime(); + let data = { + str1: this.fromid, + str2: this._tempuuid, + str3: param? param: '', + str4: this.nickname, + str5: this.localid, + num1: 3 + } + this._report(JC_LOG_T.restartgame, data); + }, + // 游戏结束---------本局游戏结束时上报【使用jcfw.gameOver的话此函数无需手动调用】 logGameover(param, score, endflag){ let nowtime = new Date().getTime(); diff --git a/fc/js/jcmatchvs.js b/fc/js/jcmatchvs.js index bfd015b..3cf499e 100644 --- a/fc/js/jcmatchvs.js +++ b/fc/js/jcmatchvs.js @@ -1,5 +1,4 @@ -var log = require('jsgamelog') JCMsgHandler = function(){ @@ -559,14 +558,6 @@ JCMatchVS = function(){ this.initMsgHandler(this.msgIDs.c2sMsg(), this.msgIDs.s2cMsg()); }.bind(this)); this.msgctrl.init(response); - var env = getParameter('version'); - var isTest = (!env || env==='test') ? '-test' : ''; - var url = 'https://gamelog'+isTest+'.kingsome.cn/webapp/index.php' - this._log = log; - this._log.init(channel, gameid, false, '', url); - var accountId = getParameter('account_id'); - var sessionId = getParameter('session_id') - this._log.setAccountID(accountId, sessionId); } this.downloadFile=function(fileName, registrationHandler) { var ajax = new XMLHttpRequest(); @@ -869,7 +860,7 @@ JCMatchVS = function(){ user_profile: userdesc }; this.msgManager.sendMsg(this.msgIDs.c2sMsg()._CMJoinRoom, param); - this._log && this._log.logVS_joinRoom(roomid, userdesc, false); + window.log && window.log.logVS_joinRoom(roomid, userdesc, false); return 0; } @@ -893,7 +884,7 @@ JCMatchVS = function(){ user_profile: userdesc }; this.msgManager.sendMsg(this.msgIDs.c2sMsg()._CMJoinRandomRoom, param); - this._log && this._log.logVS_joinRoom('', userdesc, true); + window.log && window.log.logVS_joinRoom('', userdesc, true); return 0; } @@ -916,7 +907,7 @@ JCMatchVS = function(){ custom_data: content }; this.msgManager.sendMsg(this.msgIDs.c2sMsg()._CMLeaveRoom, param); - this._log && this._log.logVS_leaveRoom(this.userinfo.roomID, content); + window.log && window.log.logVS_leaveRoom(this.userinfo.roomID, content); return 0; } @@ -938,7 +929,7 @@ JCMatchVS = function(){ custom_data: content }; this.msgManager.sendMsg(this.msgIDs.c2sMsg()._CMJoinOver, param); - this._log && this._log.logVS_gameReady(this.userinfo.roomID, content, true); + window.log && window.log.logVS_gameReady(this.userinfo.roomID, content, true); return 0; } @@ -960,7 +951,7 @@ JCMatchVS = function(){ custom_data: content }; this.msgManager.sendMsg(this.msgIDs.c2sMsg()._CMJoinOpen, param); - this._log && this._log.logVS_gameReady(this.userinfo.roomID, content, false); + window.log && window.log.logVS_gameReady(this.userinfo.roomID, content, false); return 0; } @@ -982,7 +973,7 @@ JCMatchVS = function(){ custom_data: content }; this.msgManager.sendMsg(this.msgIDs.c2sMsg()._CMGameStart, param); - this._log && this._log.logVS_gameStart(this.userinfo.roomID, content); + window.log && window.log.logVS_gameStart(this.userinfo.roomID, content); return 0; } @@ -1150,7 +1141,7 @@ JCMatchVS = function(){ err = msg.result.error_code; errstr = msg.result.error_msg; this.userinfo.room_state = state_enum.none; - this._log && this._log.logButtonClick('matchvs', msg.result, 'onCreateRoomRsp'); + window.log && window.log.logButtonClick('matchvs', msg.result, 'onCreateRoomRsp'); } var param = { status: err, @@ -1180,7 +1171,7 @@ JCMatchVS = function(){ err = msg.result.error_code; errstr = msg.result.error_msg; this.userinfo.room_state = state_enum.none; - this._log && this._log.logButtonClick('matchvs', msg.result, 'onJoinRoomRsp'); + window.log && window.log.logButtonClick('matchvs', msg.result, 'onJoinRoomRsp'); } var lst = []; @@ -1221,7 +1212,7 @@ JCMatchVS = function(){ if(msg.result != null && msg.result.error_code != 0){ err = msg.result.error_code; errstr = msg.result.error_msg; - this._log && this._log.logButtonClick('matchvs', msg.result, 'onJoinOverRsp'); + window.log && window.log.logButtonClick('matchvs', msg.result, 'onJoinOverRsp'); } var param = { status: err, @@ -1238,7 +1229,7 @@ JCMatchVS = function(){ if(msg.result != null && msg.result.error_code != 0){ err = msg.result.error_code; errstr = msg.result.error_msg; - this._log && this._log.logButtonClick('matchvs', msg.result, 'onJoinOpenRsp'); + window.log && window.log.logButtonClick('matchvs', msg.result, 'onJoinOpenRsp'); } var param = { status: err, @@ -1255,7 +1246,7 @@ JCMatchVS = function(){ if(msg.result != null && msg.result.error_code != 0){ err = msg.result.error_code; errstr = msg.result.error_msg; - this._log && this._log.logButtonClick('matchvs', msg.result, 'onGameStartRsp'); + window.log && window.log.logButtonClick('matchvs', msg.result, 'onGameStartRsp'); } var param = { status: err, @@ -1276,7 +1267,7 @@ JCMatchVS = function(){ err = msg.result.error_code; errstr = msg.result.error_msg; this.userinfo.room_state = state_enum.joined; - this._log && this._log.logButtonClick('matchvs', msg.result, 'onLeaveRoomRsp'); + window.log && window.log.logButtonClick('matchvs', msg.result, 'onLeaveRoomRsp'); } var param = { status: err, @@ -1365,7 +1356,7 @@ JCMatchVS = function(){ err = msg.result.error_code; errstr = msg.result.error_msg; this._cleanState(); - this._log && this._log.logButtonClick('matchvs', msg.result, 'onReConnectRsp'); + window.log && window.log.logButtonClick('matchvs', msg.result, 'onReConnectRsp'); }else{ this.userinfo.roomID = msg.room_info? msg.room_info.room_id: ""; } diff --git a/fc/js/logger.js b/fc/js/logger.js new file mode 100644 index 0000000..20c26c0 --- /dev/null +++ b/fc/js/logger.js @@ -0,0 +1,31 @@ + +var log = require('jsgamelog') + +function getParameter (t) { + var e = window.location.search, + i = new RegExp(t + "=([^&?]*)", "ig"); + return e.match(i) ? e.match(i)[0].substr(t.length + 1) : null +} + +window.log = log; +var env = getParameter('version'); +var isTest = (!env || env==='test') ? '-test' : ''; +var url = 'https://gamelog'+isTest+'.kingsome.cn/webapp/index.php' + +window.log.init(6001, 8004, false, '', url); +var accountId = getParameter('account_id'); +var sessionId = getParameter('session_id') +window.log.setAccountID(accountId, sessionId); + +var id = getParameter('id'); +var netmode = getParameter("roomId")?1:0; + +var logObj = { + gid: id, + m: netmode +} +window.log.logStartGame(logObj); + +setInterval(function () { + window.log.logGameAlive(logObj); +}, 60000) diff --git a/gba/index.html b/gba/index.html index 9deb140..daf82d7 100755 --- a/gba/index.html +++ b/gba/index.html @@ -6,6 +6,13 @@ + + + + + + + diff --git a/gba2/index.html b/gba2/index.html index 61fe9e1..56f9deb 100755 --- a/gba2/index.html +++ b/gba2/index.html @@ -51,7 +51,7 @@ - + @@ -67,6 +67,12 @@ + + + + + + diff --git a/gulpfile.js b/gulpfile.js index e5559f8..8e4befd 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -11,9 +11,8 @@ const javascriptObfuscator = require('gulp-javascript-obfuscator'); const obfuscatorOptions = { compact:true, sourceMap: false, - debugProtection: true, - disableConsoleOutput: true, - domainLock: ['.kingsome.cn', '.zhl.com'] + debugProtection: false, + disableConsoleOutput: false }; //检查js的语法错误 gulp.task('jslint', function () {