Commit 29791e8e 29791e8e56bc94b8862aa825b992893d87399678 by 金学艇

添加探针

修改福建服务器地址
1 parent a8be5b38
......@@ -207,7 +207,7 @@
"array": [
0,
0,
247.68325805664062,
186.19546508789062,
0,
0,
0,
......@@ -1167,7 +1167,7 @@
"__id__": 2
},
"_children": [],
"_active": true,
"_active": false,
"_components": [
{
"__id__": 27
......
var Common = require('Common');
var Common = require('Common');
var Network = require('Network');
//var ListView = require('ListView');
cc.Class({
......@@ -6,212 +6,213 @@ cc.Class({
properties: {
//键值由具体场景决定
_aSceneContext:{default:[]},
_aSceneParameter:{default:[]},
_bBackStatus:false,
_iDefaultCollectionId:-1,
_oScene : null,
_strSceneName : "",
_aSceneContext: { default: [] },
_aSceneParameter: { default: [] },
_bBackStatus: false,
_iDefaultCollectionId: -1,
_oScene: null,
_strSceneName: "",
},
// use this for initialization
onLoad: function () {
this._aSceneContext=[];
this._aSceneParameter=[];
this._aSceneContext = [];
this._aSceneParameter = [];
//探针相关
this._oProbe = this.initProbe();
},
setScene : function(oScene){
setScene: function (oScene) {
this._strSceneName = cc.director.getScene().name;
this._oScene = oScene;
},
getScene : function(){
getScene: function () {
return this._oScene;
},
getSceneContext:function(){
getSceneContext: function () {
return this._aSceneContext;
},
popSceneContext:function(){
popSceneContext: function () {
return this._aSceneContext.pop();
},
getTopSceneContext:function(){
return this._aSceneContext[this._aSceneContext.length-1];
getTopSceneContext: function () {
return this._aSceneContext[this._aSceneContext.length - 1];
},
setSceneContext:function(aSceneContext){
this._aSceneContext=aSceneContext;
setSceneContext: function (aSceneContext) {
this._aSceneContext = aSceneContext;
},
getSceneParameter:function(){
getSceneParameter: function () {
return this._aSceneParameter;
},
popSceneParameter:function(){
popSceneParameter: function () {
return this._aSceneParameter.pop();
},
getTopSceneParameter:function(){
if(this._aSceneParameter.length){
return this._aSceneParameter[this._aSceneParameter.length-1];
}else{
getTopSceneParameter: function () {
if (this._aSceneParameter.length) {
return this._aSceneParameter[this._aSceneParameter.length - 1];
} else {
return null;
}
},
setSceneParameter:function(aSceneParameter){
this._aSceneParameter=aSceneParameter;
setSceneParameter: function (aSceneParameter) {
this._aSceneParameter = aSceneParameter;
},
getBackStatus:function(){
getBackStatus: function () {
return this._bBackStatus;
},
setBackStatus:function(bBackStatus){
this._bBackStatus=bBackStatus;
setBackStatus: function (bBackStatus) {
this._bBackStatus = bBackStatus;
},
getDefaultCollectionId:function(){
getDefaultCollectionId: function () {
return this._iDefaultCollectionId;
},
setDefaultCollectionId:function(iCollectionId){
this._iDefaultCollectionId=iCollectionId;
setDefaultCollectionId: function (iCollectionId) {
this._iDefaultCollectionId = iCollectionId;
},
initProbe : function(){
try{
initProbe: function () {
try {
let _this = this;
//对于ajax进行拦截
let fnTempAjax = Network.ajax;
Network.ajax = function (strMethod, strURL, astrContentType, oDataOrPostBody, onSuccess, onError, oScope, oAdditionalData) {
if(_this._oScene&&_this._oScene._bIsFocusInit){
cc.log("strURL==>"+strURL);
if(-1!=strURL.indexOf("User/AddMedia2Collection")){
if (_this._oScene && _this._oScene._bIsFocusInit) {
cc.log("strURL==>" + strURL);
if (-1 != strURL.indexOf("User/AddMedia2Collection")) {
console.log(strURL);
console.log(oDataOrPostBody);
_this._oProbe.requestProbe("MediaCollect",{
"mediaId" : oDataOrPostBody.mediaId,
"mediaCode" : oAdditionalData.code
_this._oProbe.requestProbe("MediaCollect", {
"mediaId": oDataOrPostBody.mediaId,
"mediaCode": oAdditionalData.code
});
}
if(-1!=strURL.indexOf("User/RemoveMediaFromCollection")){
if (-1 != strURL.indexOf("User/RemoveMediaFromCollection")) {
console.log(strURL);
console.log(oDataOrPostBody);
_this._oProbe.requestProbe("MediaUncollect",{
"mediaId" : oDataOrPostBody.mediaId,
"mediaCode" : oAdditionalData.code
_this._oProbe.requestProbe("MediaUncollect", {
"mediaId": oDataOrPostBody.mediaId,
"mediaCode": oAdditionalData.code
});
}
}
fnTempAjax.call(Network,strMethod, strURL, astrContentType, oDataOrPostBody, onSuccess, onError, oScope, oAdditionalData);
fnTempAjax.call(Network, strMethod, strURL, astrContentType, oDataOrPostBody, onSuccess, onError, oScope, oAdditionalData);
}
return {
oSceneUIMap : {
"sceneMain" : "index"
oSceneUIMap: {
"sceneMain": "index"
},
oCommonParam : {
product :"Melody",
sessionId : "",
version : Common.VERSION,
userId : Common.USER_ID,
action : "",
oCommonParam: {
product: "ForFun",
sessionId: "",
version: Common.VERSION,
userId: Common.USER_ID,
action: "",
},
loginEntrance : "",
lastActiveTime : "",
uuid : "",
inited : false,
jumpCode : "",
productId : "",
productPrice : "",
aInterActive : [],
aCollectActive : [],
oActionEvoker : null,
oActionList : null,
aDataShowScene : ["sceneAudioPlayer","sceneCategoryList","sceneCollectionList","sceneFreeList","sceneHistoryList","sceneHotCategoryWithScreen",
"sceneKTVPlayer","sceneRankList","sceneSearch","sceneShop","sceneSongLibraryInPlayer","sceneStarPersonalSection","sceneSubIndex","sceneSubjectList","sceneTagList"],
init : function(){
try{
loginEntrance: "",
lastActiveTime: "",
uuid: "",
inited: false,
jumpCode: "",
productId: "",
productPrice: "",
aInterActive: [],
aCollectActive: [],
oActionEvoker: null,
oActionList: null,
aDataShowScene: ["sceneAudioPlayer", "sceneCategoryList", "sceneCollectionList", "sceneFreeList", "sceneHistoryList", "sceneHotCategoryWithScreen",
"sceneKTVPlayer", "sceneRankList", "sceneSearch", "sceneShop", "sceneSongLibraryInPlayer", "sceneStarPersonalSection", "sceneSubIndex", "sceneSubjectList", "sceneTagList"],
init: function () {
try {
this.lastActiveTime = this.lastActiveTime || 0;
this.updateActive();
this.uuid = this.uuid || Common.uuid(32,16);
this.sessionId = this.uuid || Common.uuid(32,16);
this.uuid = this.uuid || Common.uuid(32, 16);
this.sessionId = this.uuid || Common.uuid(32, 16);
this.inited = true;
}catch(err){
jsb.reflection.callStaticMethod("org/cocos2dx/javascript/AppActivity", "logInSceneI", "(Ljava/lang/String;)V","init in Application Error==>"+err);
} catch (err) {
jsb.reflection.callStaticMethod("org/cocos2dx/javascript/AppActivity", "logInSceneI", "(Ljava/lang/String;)V", "init in Application Error==>" + err);
}
},
updateActive : function (){//更新active,每次动作更新lastActiveTime
try{
let iCurrentTime=new Date().getTime();
if( iCurrentTime - this.lastActiveTime >= 20*60*1000 ){//超过20分钟时 2分钟用来测试来着 todo:
updateActive: function () {//更新active,每次动作更新lastActiveTime
try {
let iCurrentTime = new Date().getTime();
if (iCurrentTime - this.lastActiveTime >= 20 * 60 * 1000) {//超过20分钟时 2分钟用来测试来着 todo:
this.lastActiveTime = iCurrentTime;//更新lastActiveTime时间
this.uuid = Common.uuid(32,16);//更新uuid
this.uuid = Common.uuid(32, 16);//更新uuid
this.oCommonParam.sessionId = this.uuid;
}
this.lastActiveTime=iCurrentTime;//更新动作时间
}catch(err){
jsb.reflection.callStaticMethod("org/cocos2dx/javascript/AppActivity", "logInSceneI", "(Ljava/lang/String;)V","updateActive in Application Error==>"+err);
this.lastActiveTime = iCurrentTime;//更新动作时间
} catch (err) {
jsb.reflection.callStaticMethod("org/cocos2dx/javascript/AppActivity", "logInSceneI", "(Ljava/lang/String;)V", "updateActive in Application Error==>" + err);
}
},
requestProbe : function(strType,oExtra){
try{
requestProbe: function (strType, oExtra) {
try {
this.updateActive();
let oParam = Common.assign({},this.oCommonParam);
let oParam = Common.assign({}, this.oCommonParam);
oParam.action = strType;
let obj = {};
switch(strType){
switch (strType) {
case "Login"://登录
obj = {
"productId":Common.AUTH_PRODUCT,//鉴权成功的产品Id
"productId": Common.AUTH_PRODUCT,//鉴权成功的产品Id
}
break;
case "UIEnter"://页面进入
if(!this.inited){
cc.log("UIEnter...");
if (!this.inited) {
this.init();
//对按键进行拦截
let self = this;
let fnKeyDown = _this._oScene.onKeyDown;
_this._oScene.onKeyDown = function(event){
self.updateActive();
fnKeyDown.call(_this._oScene,event);
_this._oScene.onKeyDown = function (event) {
self.updateActive();
fnKeyDown.call(_this._oScene, event);
}
}
obj = {
"parameters":_this.getTopSceneParameter(),
"ui" : this.oSceneUIMap[_this._strSceneName] || _this._strSceneName,
"jumpCode":this.jumpCode || "-"
"parameters": _this.getTopSceneParameter(),
"ui": this.oSceneUIMap[_this._strSceneName] || _this._strSceneName,
"jumpCode": this.jumpCode || "-"
}
break;
case "UILeave"://页面离开
this.jumpCode = Common.uuid(32,16);
this.jumpCode = Common.uuid(32, 16);
obj = {
"context" : _this._oScene._oSceneContext,
"ui" : this.oSceneUIMap[_this._strSceneName] || _this._strSceneName,
"jumpCode" : this.jumpCode,//页面离开进来jumpcode对应
"context": _this._oScene._oSceneContext,
"ui": this.oSceneUIMap[_this._strSceneName] || _this._strSceneName,
"jumpCode": this.jumpCode,//页面离开进来jumpcode对应
}
Common.assign(obj,_this._oScene._fiCurrentFocus&&_this._oScene._fiCurrentFocus.getFocusProbeInfo() || {});
Common.assign(obj, _this._oScene._fiCurrentFocus && _this._oScene._fiCurrentFocus.getFocusProbeInfo() || {});
break;
case "interActive"://页面交互
obj = {
"ui" : this.oSceneUIMap[_this._strSceneName] || _this._strSceneName,
"context":this.oActionContext||_this._oScene._oSceneContext,
"actionTime":this.lastActiveTime
"ui": this.oSceneUIMap[_this._strSceneName] || _this._strSceneName,
"context": this.oActionContext || _this._oScene._oSceneContext,
"actionTime": this.lastActiveTime
}
break;
case "MediaPlay":
case "MediaPause":
case "MediaStop":
case "MediaPlay":
case "MediaPause":
case "MediaStop":
case "MediaPlayAvailable":
case "MediaSeek"://播控相关
obj={
"mediaId":parseInt(_this._oScene._strRequestMediaId),
"mediaCode":_this._oScene._strRequestMediaCode,
"appId":_this._oScene._strAppId,
"actionTime":new Date().getTime()
obj = {
"mediaId": parseInt(_this._oScene._strRequestMediaId),
"mediaCode": _this._oScene._strRequestMediaCode,
"appId": _this._oScene._strAppId,
"actionTime": new Date().getTime()
}
break
case "MediaCollect"://收藏
case "MediaUncollect"://取消收藏
obj = {
"ui" : this.oSceneUIMap[_this._strSceneName] || _this._strSceneName,
"mediaId":parseInt(_this._oScene._strRequestMediaId),
"mediaCode":_this._oScene._strRequestMediaCode,
"appId":_this._oScene._strAppId
"ui": this.oSceneUIMap[_this._strSceneName] || _this._strSceneName,
"mediaId": parseInt(_this._oScene._strRequestMediaId),
"mediaCode": _this._oScene._strRequestMediaCode,
"appId": _this._oScene._strAppId
}
break;
case "Subscribing"://订购发起
......@@ -219,141 +220,155 @@ cc.Class({
case "Unsubscribing"://退订发起
case "Unsubscribed"://退订结果
obj = {
"productId" : Common.AUTH_PRODUCT,
"transactionId" : "",
"actionTime":new Date().getTime()
"productId": Common.AUTH_PRODUCT,
"transactionId": "",
"actionTime": new Date().getTime()
}
break;
case "mediaSearch"://搜索行为
obj = {
"ui" : this.oSceneUIMap[_this._strSceneName] || _this._strSceneName,
"ui": this.oSceneUIMap[_this._strSceneName] || _this._strSceneName,
}
break;
case "mediaSearchAccept"://搜索采纳
let olink = _this._oScene._fiCurrentFocus&&_this._oScene._fiCurrentFocus.getFocusProbeInfo() || {};
let olink = _this._oScene._fiCurrentFocus && _this._oScene._fiCurrentFocus.getFocusProbeInfo() || {};
let oLinkPoint = olink.linkPoint;
obj = {
"ui" : this.oSceneUIMap[_this._strSceneName] || _this._strSceneName,
"keyword" : _this._oScene._oSceneContext.currentKeyword
"ui": this.oSceneUIMap[_this._strSceneName] || _this._strSceneName,
"keyword": _this._oScene._oSceneContext.currentKeyword
}
obj[oLinkPoint.type + "Id"] = oLinkPoint.id;
obj[oLinkPoint.type + "Code"] = oLinkPoint.code;
break;
case "playOBiGame"://页面报错了
obj = {
"ui": this.oSceneUIMap[_this._strSceneName] || _this._strSceneName,
"context": _this._oScene._oSceneContext,
}
break;
case "playGame"://页面报错了
obj = {
"ui": this.oSceneUIMap[_this._strSceneName] || _this._strSceneName,
"context": _this._oScene._oSceneContext,
}
obj[oLinkPoint.type+"Id"] = oLinkPoint.id;
obj[oLinkPoint.type+"Code"] = oLinkPoint.code;
break;
case "error"://页面报错了
obj = {
"ui" : this.oSceneUIMap[_this._strSceneName] || _this._strSceneName,
"context":_this._oScene._oSceneContext,
"ui": this.oSceneUIMap[_this._strSceneName] || _this._strSceneName,
"context": _this._oScene._oSceneContext,
}
break;
}
if(oExtra){
Common.assign(obj,oExtra);
if (oExtra) {
Common.assign(obj, oExtra);
}
Common.assign(oParam,obj);
Common.assign(oParam, obj);
var aProbeArray = [];
if(strType == "UILeave"&&this.aInterActive.length){
if (strType == "UILeave" && this.aInterActive.length) {
aProbeArray.push(oParam);
// fnTempAjax('GET',BI_BASE_PATH,null,this.aInterActive,function(responseText){
// // Log.info("probe Business::");
// },function(responseText){
// // Log.info("probe Communication::");
// });
// fnTempAjax('GET',BI_BASE_PATH,null,this.aCollectActive,function(responseText){
// // Log.info("probe Business::");
// },function(responseText){
// // Log.info("probe Communication::");
// });
this.aInterActive = [];
this.aCollectActive = [];
}else if( strType == "interActive"){
if(_this._oScene&&_this._oScene._bIsFocusInit){
} else if (strType == "interActive") {
if (_this._oScene && _this._oScene._bIsFocusInit) {
this.aInterActive.push([oParam]);
if(this.aInterActive.length < 3){
if (this.aInterActive.length < 3) {
return;
}
aProbeArray = this.aInterActive;
this.aInterActive = [];
}
}else if( strType == "MediaCollect" || strType == "MediaUncollect"){
} else if (strType == "MediaCollect" || strType == "MediaUncollect") {
this.aCollectActive.push([oParam]);
if(this.aCollectActive.length < 4){
if (this.aCollectActive.length < 4) {
return;
}
aProbeArray = this.aCollectActive;
this.aCollectActive = [];
}else{
} else {
aProbeArray.push(oParam);
}
console.log("============================");
console.log(aProbeArray);
var oArgs={
'ray': encodeURIComponent(JSON.stringify([aProbeArray]))//数组作为参数值传到ray参数里边
var oArgs = {
'ray': encodeURIComponent(JSON.stringify(aProbeArray))//数组作为参数值传到ray参数里边
}
// fnTempAjax('GET',BI_BASE_PATH,null,oArgs,function(responseText){
// // Log.info("probe Business::");
// },function(responseText){
// // Log.info("probe Communication::");
// });
}catch(err){
jsb.reflection.callStaticMethod("org/cocos2dx/javascript/AppActivity", "logInSceneI", "(Ljava/lang/String;)V","requestProbe in Application Error==>"+err);
fnTempAjax('GET', Common.BI_BASE_PATH, null, oArgs, function (responseText) { //打开发送探针
// Log.info("probe Business::");
cc.log("UIEnter success..." + responseText);
}, function (responseText) {
// Log.info("probe Communication::");
});
} catch (err) {
jsb.reflection.callStaticMethod("org/cocos2dx/javascript/AppActivity", "logInSceneI", "(Ljava/lang/String;)V", "requestProbe in Application Error==>" + err);
}
}
}
}catch(err){
jsb.reflection.callStaticMethod("org/cocos2dx/javascript/AppActivity", "logInSceneI", "(Ljava/lang/String;)V","initProbe in Application Error==>"+err);
} catch (err) {
jsb.reflection.callStaticMethod("org/cocos2dx/javascript/AppActivity", "logInSceneI", "(Ljava/lang/String;)V", "initProbe in Application Error==>" + err);
}
},
probeInterceptScrollStart : function(oList){
try{
probeInterceptScrollStart: function (oList) {
try {
let _this = this;
let fnTemp = this._oScene.onListScrollStart;
this._oScene.onListScrollStart = function(){
if(_this._oScene&&_this._oScene._bIsFocusInit){
this._oScene.onListScrollStart = function () {
if (_this._oScene && _this._oScene._bIsFocusInit) {
_this.oActionEvoker = _this._oScene._fiCurrentFocus;
_this.oActionList = oList;
cc.log("=====================================");
cc.log(oList);
cc.log(_this.oActionEvoker.node.name);
}
fnTemp.call(_this._oScene);
}
}catch(err){
jsb.reflection.callStaticMethod("org/cocos2dx/javascript/AppActivity", "logInSceneI", "(Ljava/lang/String;)V","probeInterceptScrollStart in Application Error==>"+err);
} catch (err) {
jsb.reflection.callStaticMethod("org/cocos2dx/javascript/AppActivity", "logInSceneI", "(Ljava/lang/String;)V", "probeInterceptScrollStart in Application Error==>" + err);
}
},
probeInterceptScrollEnd : function(oList){
try{
probeInterceptScrollEnd: function (oList) {
try {
let _this = this;
let fnTemp = this._oScene.onListScrollEnd;
this._oScene.onListScrollEnd = function(){
if(_this._oScene&&_this._oScene._bIsFocusInit){
this._oScene.onListScrollEnd = function () {
if (_this._oScene && _this._oScene._bIsFocusInit) {
let strModuleName = oList.node.name;
let strEvoke = "UIButton";
if(_this.oActionEvoker&&-1!=Common.getNodePath(_this.oActionEvoker.node).indexOf(oList.node.name)){
if (_this.oActionEvoker && -1 != Common.getNodePath(_this.oActionEvoker.node).indexOf(oList.node.name)) {
}
if(_this.oActionEvoker&&_this.oActionEvoker.node&&_this.oActionEvoker.node.name == "ScrollBarBlock"){
if (_this.oActionEvoker && _this.oActionEvoker.node && _this.oActionEvoker.node.name == "ScrollBarBlock") {
strEvoke = "ScrollBar";
}
this._oProbe.requestProbe("interActive",{
"action" : "DataShow",
"module" : strModuleName,
"context" : {
"pageIndex" :Math.ceil((oList._iRecordIndexOfFirstCellInPage+oList._iCellCountEachRow*oList._iShowCellRows)/oList._iCellCountEachRow/oList._iShowCellRows),
"evoke" : strEvoke
this._oProbe.requestProbe("interActive", {
"action": "DataShow",
"module": strModuleName,
"context": {
"pageIndex": Math.ceil((oList._iRecordIndexOfFirstCellInPage + oList._iCellCountEachRow * oList._iShowCellRows) / oList._iCellCountEachRow / oList._iShowCellRows),
"evoke": strEvoke
}
});
}
fnTemp.call(_this._oScene);
}
}catch(err){
jsb.reflection.callStaticMethod("org/cocos2dx/javascript/AppActivity", "logInSceneI", "(Ljava/lang/String;)V","probeInterceptScrollEnd in Application Error==>"+err);
} catch (err) {
jsb.reflection.callStaticMethod("org/cocos2dx/javascript/AppActivity", "logInSceneI", "(Ljava/lang/String;)V", "probeInterceptScrollEnd in Application Error==>" + err);
}
},
});
......
......@@ -9,7 +9,7 @@ cc.Class({
},
statics: {
VERSION: "3.1.06",
VERSION: "1.1.0",
SCREEN_WIDTH: 1280.0,
SCREEN_HEIGHT: 720.0,
......@@ -52,13 +52,13 @@ cc.Class({
OFFICIAL_PLATFORM_IP: 'http://139.196.192.33/',
TEST_PLATFORM_IP: 'http://139.196.192.242:8081/',
TOPDRAW_API_SERVER: 'http://demo.cloud.api.findfun.topdraw.cn:38081/findfun/',
TOPDRAW_IMAGE_SERVER: 'http://demo.cloud.api.findfun.topdraw.cn:38081/findfun/',
TOPDRAW_API_SERVER: 'http://forfun.fj.a183.ottcn.com:8082/clutch/apps/forfun/',
TOPDRAW_IMAGE_SERVER: 'http://forfun.fj.a183.ottcn.com:8082/clutch/apps/forfun/',
TOPDRAW_LOG_SERVER: 'http://139.196.37.202/sparrow.resource/',
// BI_BASE_PATH : 'http://139.196.192.242:81/1.gif',
BI_BASE_PATH: 'http://melody.hi.a170.ottcn.com:80/1.gif',
BI_BASE_PATH_NEW: 'http://melody.hi.a170.ottcn.com:80/2.gif',
BI_BASE_PATH: 'http://112.47.3.214:9092/taohaowan.gif',
BI_BASE_PATH_NEW: 'http://112.47.3.214:9092/taohaowan.gif',
TV_LINK_ACTION_CLICK: 100,
TV_LINK_ACTION_HOVER: 101,
......
......@@ -498,12 +498,14 @@ cc.Class({
}
if (this._bIsExistApk == "true") {
if (this._oSceneContext._downloadUrl && this._oSceneContext._downloadUrl != "undefined") { //如果有下载地址就启动奥比游戏
this._oProbe.requestProbe("playOBiGame");
jsb.reflection.callStaticMethod("org/cocos2dx/javascript/common/TopdrawSDKWrapper", "startOBiGame", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V", Common.TOPDRAW_API_SERVER + this._oSceneContext._downloadUrl, this._oSceneContext._packageName, this._oSceneContext._className, "");
} else {
//这里应该转圈圈等待加载游戏
// cc.find("LoadingLabel", this.node).opacity = 255;
// cc.find("Loading/LoadingIcon", this.node).opacity = 255;
// cc.find("Loading/LoadingIcon", this.node).getComponent(cc.Animation).play();
this._oProbe.requestProbe("playGame");
jsb.reflection.callStaticMethod("org/cocos2dx/javascript/common/TopdrawSDKWrapper", "startGame", "(Ljava/lang/String;Ljava/lang/String;)V", this._oSceneContext._packageName, "");
}
} else {
......