diff --git a/lib/webfunny.mp.min.js b/lib/webfunny.mp.min.js index 1f6658ae..ccc0a3cd 100644 --- a/lib/webfunny.mp.min.js +++ b/lib/webfunny.mp.min.js @@ -1 +1 @@ -!function(e){var t={};function r(a){if(t[a])return t[a].exports;var n=t[a]={i:a,l:!1,exports:{}};return e[a].call(n.exports,n,n.exports,r),n.l=!0,n.exports}r.m=e,r.c=t,r.d=function(e,t,a){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(a,n,function(t){return e[t]}.bind(null,n));return a},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t){let r=wx;var a,n;n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",(a=r).btoa=a.btoa||function(e){for(var t,r,a,o,i="",s=0,c=(e=String(e)).length%3;s255||(a=e.charCodeAt(s++))>255||(o=e.charCodeAt(s++))>255)throw new TypeError("Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range.");i+=n.charAt((t=r<<16|a<<8|o)>>18&63)+n.charAt(t>>12&63)+n.charAt(t>>6&63)+n.charAt(63&t)}return c?i.slice(0,c-3)+"===".substring(c):i};var o=r.getStorageSync("WF_CONFIG"),i=o||{s:!0,ia:[""],wc:40,pv:{s:"webfunny-pageview-switch",ia:[""]},je:{s:"webfunny-jserror-switch",ia:[""]},hl:{s:"webfunny-http-switch",ia:[""],uh:!1,rl:500,sl:500},rl:{s:"webfunny-resource-switch",ia:[""]},bl:{s:"webfunny-behavior-switch"},lc:{s:"webfunny-location-switch"}},s="webfunnyVersionFlag",c="&&&www.webfunny.cn&&&",u="http://"+c,l=u+"/server/upMog",f="CUSTOMER_PV",g="CUS_LEAVE",h="HTTP_LOG",d="JS_ERROR",p="LAST_BROWSE_DATE",v="WM_PAGE_ENTRY_TIME",y="WM_VISIT_PAGE_COUNT",m="WEBFUNNY_COOKIE",w=[d,f,h],T=function(e){var t=new C("reload",0,"o","");t.simpleUrl=e,t.completeUrl=e,t.handleLogInfo(f,t)};class b{static getCurrentPages(){var e="";try{e=getCurrentPages().length?getCurrentPages()[0].route:""}catch(t){e=""}return e}static getUuid(){var e=b.formatDate((new Date).getTime(),"yMdhms");return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)})+"-"+e}static getCustomerKey(){var e=b.getUuid(),t=r.getStorageSync("monitorCustomerKey");return t||(r.setStorage({key:"monitorCustomerKey",data:e}),t=e),t}static isTodayBrowse(e){var t=r.getStorageSync(e),a=(new Date).getFullYear()+"-"+((new Date).getMonth()+1)+"-"+(new Date).getDate();return t&&a==t?!(!t||a!=t):(r.setStorageSync(e,a),!1)}static formatDate(e,t){var r=new Date(e).getFullYear(),a=new Date(e).getMonth()+1,n=new Date(e).getDate(),o=new Date(e).getHours(),i=new Date(e).getMinutes(),s=new Date(e).getSeconds();return a=a>9?a:"0"+a,n=n>9?n:"0"+n,o=o>9?o:"0"+o,i=i>9?i:"0"+i,s=s>9?s:"0"+s,t.replace("y",r).replace("M",a).replace("d",n).replace("h",o).replace("m",i).replace("s",s)}static getPageKey(){var e=r.getStorageSync("monitorPageKey"),t=b.getUuid();return e&&/^[0-9a-z]{8}(-[0-9a-z]{4}){3}-[0-9a-z]{12}-\d{13}$/.test(e)||(e=t),e}static setPageKey(){r.setStorage({key:"monitorPageKey",data:b.getUuid()})}static ajax(e,t,a,n,o){r.request({method:e,url:t,data:a,header:{"Content-Type":"application/json"},success:e=>{"function"==typeof n&&n(e)},fail:e=>{"function"==typeof o&&o(e)}})}static uploadCusBehavior(e,t,a){var n={webMonitorId:b.getWebMonitorId(),userId:b.getCusInfo("userId"),uploadType:"CUSTOMIZE_BEHAVIOR",happenTime:(new Date).getTime(),behaviorType:b.b64EncodeUnicode(e),behaviorResult:b.b64EncodeUnicode(t),description:b.b64EncodeUnicode(a)};r.request({method:"POST",url:u+"/server/upMyLog",data:{logs:[n]},header:{"Content-Type":"application/json"}})}static checkReqResLen(e="",t="",r){var a=e?JSON.stringify(e):"no param",n=t?JSON.stringify(t):"no result",o=parseInt(r.rl)||500,i=parseInt(r.sl)||500;return a&&a.length>o&&(a="too long"),n&&n.length>i&&(n="too long"),{requestText:a,responseText:n}}static encryptObj(e){if(e instanceof Array){for(var t=[],r=0;r50&&(e=e.substring(0,10)+"****"+e.substring(e.length-9,e.length)),e}static getDevice(){return r.getSystemInfoSync()}static b64EncodeUnicode(e){var t=encodeURIComponent(e);try{return r.btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,function(e,t){return String.fromCharCode("0x"+t)}))}catch(e){return t}}static utf8_encode(e){if(!e)return"";var t="";e=e.replace(/\r\n/g,"\n");for(var r=0;r127&&a<2048?(t+=String.fromCharCode(a>>6|192),t+=String.fromCharCode(63&a|128)):(t+=String.fromCharCode(a>>12|224),t+=String.fromCharCode(a>>6&63|128),t+=String.fromCharCode(63&a|128))}return t}static setWfCookie(e,t,a){var n={data:t,expires:a},o=r.getStorageSync(m);if(o)o[e]=n,r.setStorage(m,o);else{var i={};i[e]=n,r.setStorage(m,i)}}static getWfCookie(e){var t=r.getStorageSync(m);if(t){var a=t[e];if(!a)return"";var n=parseInt(a.expires,10);return(new Date).getTime()>n?(delete t[e],r.setStorage(m,t),""):a.data}return""}static getCusInfo(e){if(!e)return"";var t=r.getStorageSync("wmUserInfo"),a=(t?JSON.parse(t):{})[e];return a||""}static getWebMonitorId(){var e="jeffery_webmonitor";if(-1!==e.indexOf("_pro")){var t=b.getCusInfo("env");t&&(e=e.replace("_pro","_"+t))}return e}static checkIgnore(e,t){if(!t)return!0;for(var r=t.replace(/ /g,""),a=i[e].ia||[],n=!0,o=0;o0){var T=w[0].match(/\d{2}/g),S=T[0]+T[1]+"-"+T[2]+"-"+T[3]+" "+T[4]+":"+T[5]+":"+T[6],O=new Date(S).getTime();m=(new Date).getTime()-O>300?0==t?"o_uv":"o":"n_uv"}}else m="n_uv",b.getCustomerKey();var I=new C("reload",0,m,"");if("n_uv"===m||"o_uv"===m){var P=[I,n];b.ajax("POST",l,P)}else I.handleLogInfo(f,I)}}(),P=e)}}function D(e,t,r,a,n,o){_();var i=t||"",s=o||"",c="",u="";(i.length>=1e3&&(i=i.substring(0,999)),s.length>=3e3&&(s=s.substring(0,2999)),i.length>=80?u=i.substring(0,80):i.length>0&&i.length<80&&(u=i),i)&&(c="string"==typeof s?s.split(": ")[0].replace('"',""):JSON.stringify(s).split(": ")[0].replace('"',""));if(b.checkIgnore("je",i)){var l=new O(d,e,c+": "+u,c+": "+i,s);l.handleLogInfo(d,l)}}function U(){for(var e=[],t=0;t0&&b.ajax("POST",l,e,function(e){if(e&&e.data){var t=e.data;if(t&&t.data&&t.data.d){var a=t.data.c;if(a){var n=JSON.parse(a);if(r.setStorage({key:"WF_CONFIG",data:n}),i=n,0==n.s){var o=(new Date).getTime()+6e5;b.setWfCookie("webfunnyStart","p",o)}}}}},function(){})}wx.webfunny=function(e){for(var t=i.ia,a=!1,n=b.getCurrentPages(),o=0;o{arguments[0].success=function(...r){b.uploadCusBehavior("switchTab","success","Tab切换至:"+e.url),t(...r)},arguments[0].fail=function(...t){b.uploadCusBehavior("switchTab","failed","Tab切换至:"+e.url),r(...t)},m.switchTab.apply(this,arguments)});arguments[0].success=function(...r){b.uploadCusBehavior("switchTab","success","Tab切换至:"+e.url),t&&t(...r)},arguments[0].fail=function(...t){b.uploadCusBehavior("switchTab","failed","Tab切换至:"+e.url),r&&r(...t)},m.switchTab.apply(this,arguments)}}),Object.defineProperty(wx,"navigateBack",{writable:!1,value:function(e){var t=arguments[0].success,r=arguments[0].fail,a=arguments[0].complete;if(!(t||r||a))return new Promise((t,r)=>{arguments[0].success=function(...r){b.uploadCusBehavior("navigateBack","success","页面回层数:"+e.delta),t(...r)},arguments[0].fail=function(...t){b.uploadCusBehavior("navigateBack","failed","页面回层数:"+e.delta),r(...t)},m.navigateBack.apply(this,arguments)});arguments[0].success=function(...r){b.uploadCusBehavior("navigateBack","success","页面回层数:"+e.delta),t&&t(...r)},arguments[0].fail=function(...t){b.uploadCusBehavior("navigateBack","failed","页面回层数:"+e.delta),r&&r(...t)},m.navigateBack.apply(this,arguments)}}),Object.defineProperty(wx,"navigateTo",{writable:!1,value:function(e){var t=arguments[0].success,r=arguments[0].fail,a=arguments[0].complete;if(!(t||r||a))return new Promise((t,r)=>{arguments[0].success=function(...r){b.uploadCusBehavior("navigateTo","success","页面切换至:"+e.url),T(e.url),t(...r)},arguments[0].fail=function(...t){b.uploadCusBehavior("navigateTo","failed","页面切换至:"+e.url),r(...t)},m.navigateTo.apply(this,arguments)});arguments[0].success=function(...r){b.uploadCusBehavior("navigateTo","success","页面切换至:"+e.url),T(e.url),t&&t(...r)},arguments[0].fail=function(...t){b.uploadCusBehavior("navigateTo","failed","页面切换至:"+e.url),r&&r(...t)},m.navigateTo.apply(this,arguments)}}),Object.defineProperty(wx,"redirectTo",{writable:!1,value:function(e){var t=arguments[0].success,r=arguments[0].fail,a=arguments[0].complete;if(!(t||r||a))return new Promise((t,r)=>{arguments[0].success=function(...r){b.uploadCusBehavior("redirectTo","success","重定向:"+e.url),t(...r)},arguments[0].fail=function(...t){b.uploadCusBehavior("redirectTo","failed","重定向:"+e.url),r(...t)},m.redirectTo.apply(this,arguments)});arguments[0].success=function(...r){b.uploadCusBehavior("redirectTo","success","重定向:"+e.url),t&&t(...r)},arguments[0].fail=function(...t){b.uploadCusBehavior("redirectTo","failed","重定向:"+e.url),r&&r(...t)},m.redirectTo.apply(this,arguments)}}),Object.defineProperty(wx,"reLaunch",{writable:!1,value:function(e){var t=arguments[0].success,r=arguments[0].fail,a=arguments[0].complete;if(!(t||r||a))return new Promise((t,r)=>{arguments[0].success=function(...r){b.uploadCusBehavior("reLaunch","success","重启:"+e.url),t(...r)},arguments[0].fail=function(...t){b.uploadCusBehavior("reLaunch","failed","重启:"+e.url),r(...t)},m.reLaunch.apply(this,arguments)});arguments[0].success=function(...r){b.uploadCusBehavior("reLaunch","success","重启:"+e.url),t&&t(...r)},arguments[0].fail=function(...t){b.uploadCusBehavior("reLaunch","failed","重启:"+e.url),r&&r(...t)},m.reLaunch.apply(this,arguments)}}),Object.defineProperty(wx,"request",{writable:!1,value:function(e){function t(e,t,r,a,n,o,i,s,c){if(b.checkIgnore("hl",r)){var u=new I(e,t,r,a,n,o,i,s,c);u.handleLogInfo(e,u)}}if(-1==e.url.indexOf(c)){e.startTime=(new Date).getTime();var r=e.method,a=e.url;t(h,r,a,"200","OK","request","","",0)}var n=arguments[0].success,o=arguments[0].fail,i=arguments[0].complete;if(!(n||o||i))return new Promise((r,a)=>{arguments[0].success=function(...a){if(-1==e.url.indexOf(c)){var n=(new Date).getTime()-e.startTime,o=e.method,i=e.url,s=a[0],u=s.statusCode,l=b.checkReqResLen(e.data,s.data,y);t(h,o,i,u,"OK","response",l.requestText,l.responseText,n)}r(...a)},arguments[0].fail=function(...r){if(-1==e.url.indexOf(c)){var n=(new Date).getTime()-e.startTime,o=e.method,i=e.url,s=r[0],u=JSON.stringify(e.data),l=s.errMsg;t(h,o,i,555,"fail","response",u,l,n)}a(...r)},m.request.apply(this,arguments)});arguments[0].success=function(...r){if(-1==e.url.indexOf(c)){var a=(new Date).getTime()-e.startTime,o=e.method,i=e.url,s=r[0],u=s.statusCode,l=b.checkReqResLen(e.data,s.data,y);t(h,o,i,u,"OK","response",l.requestText,l.responseText,a)}n&&n(...r)},arguments[0].fail=function(...r){if(-1==e.url.indexOf(c)){var a=(new Date).getTime()-e.startTime,n=e.method,i=e.url,s=r[0],u=JSON.stringify(e.data),l=s.errMsg;t(h,n,i,555,"fail","response",u,l,a)}o&&o(...r)},m.request.apply(this,arguments)}}),v.s&&(g=console.error,console.error=function(e){var t=arguments[0]&&arguments[0].message||e,r=arguments[0]&&arguments[0].stack;if(r)D("on_error",t,0,0,0,r);else{if("object"==typeof t)try{t=JSON.stringify(t)}catch(e){t="错误无法解析"}D("console_error",t,0,0,0,"CustomizeError: "+t)}return g.apply(console,arguments)});var w=(new Date).getTime();setInterval(function(){_();let e=(new Date).getTime(),t=e-w;r.getStorageSync(h).length>10?U():t>=200*d&&(U(),w=e)},1e3);var S={onLaunch:function(){!function(e){var t=b.isTodayBrowse(p),a=r.getStorageSync("monitorCustomerKey");if(a){var n="",o=a?a.match(/\d{14}/g):[];if(o&&o.length>0){var i=o[0].match(/\d{2}/g),s=i[0]+i[1]+"-"+i[2]+"-"+i[3]+" "+i[4]+":"+i[5]+":"+i[6],c=new Date(s).getTime();n=(new Date).getTime()-c>300?0==t?"o_uv":"o":"n_uv"}}else n="n_uv",b.getCustomerKey();var u=new C("reload",0,n,"");if(u.simpleUrl=e,u.completeUrl=e,"n_uv"===n||"o_uv"===n){var g=[u];b.getCusInfo("userId")?b.ajax("POST",l,g):setTimeout(function(){b.ajax("POST",l,g)},3e3)}else u.handleLogInfo(f,u)}("onLaunch")},onError:function(e){if(v.s){var t="";"string"==typeof e?t=e:"object"==typeof e&&(t=e.stack||"");var r=t.split("\n")[2];b.getCurrentPages(),D("on_error",r,0,0,0,t)}}};for(const t in S){const r="function"==typeof e[t]&&e[t];e[t]=function(){S[t].apply(this,arguments),r&&r.apply(this,arguments)}}return e}}}]); \ No newline at end of file +!function(e){var t={};function r(a){if(t[a])return t[a].exports;var n=t[a]={i:a,l:!1,exports:{}};return e[a].call(n.exports,n,n.exports,r),n.l=!0,n.exports}r.m=e,r.c=t,r.d=function(e,t,a){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(a,n,function(t){return e[t]}.bind(null,n));return a},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t){let r=wx;var a,n;n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",(a=r).btoa=a.btoa||function(e){for(var t,r,a,o,i="",s=0,c=(e=String(e)).length%3;s255||(a=e.charCodeAt(s++))>255||(o=e.charCodeAt(s++))>255)throw new TypeError("Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range.");i+=n.charAt((t=r<<16|a<<8|o)>>18&63)+n.charAt(t>>12&63)+n.charAt(t>>6&63)+n.charAt(63&t)}return c?i.slice(0,c-3)+"===".substring(c):i};var o=r.getStorageSync("WF_CONFIG"),i=o||{s:!0,ia:[""],wc:40,pv:{s:"webfunny-pageview-switch",ia:[""]},je:{s:"webfunny-jserror-switch",ia:[""]},hl:{s:"webfunny-http-switch",ia:[""],uh:!1,rl:500,sl:500},rl:{s:"webfunny-resource-switch",ia:[""]},bl:{s:"webfunny-behavior-switch"},lc:{s:"webfunny-location-switch"}},s="webfunnyVersionFlag",c="&&&www.webfunny.cn&&&",u="http://"+c,l=u+"/server/upMog",f="CUSTOMER_PV",g="CUS_LEAVE",h="HTTP_LOG",d="JS_ERROR",p="LAST_BROWSE_DATE",v="WM_PAGE_ENTRY_TIME",y="WM_VISIT_PAGE_COUNT",m="WEBFUNNY_COOKIE",w=[d,f,h],T=function(e){var t=new C("reload",0,"o","");t.simpleUrl=e,t.completeUrl=e,t.handleLogInfo(f,t)};class b{static getCurrentPages(){var e="";try{e=getCurrentPages().length?getCurrentPages()[0].route:""}catch(t){e=""}return e}static getUuid(){var e=b.formatDate((new Date).getTime(),"yMdhms");return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)})+"-"+e}static getCustomerKey(){var e=b.getUuid(),t=r.getStorageSync("monitorCustomerKey");return t||(r.setStorage({key:"monitorCustomerKey",data:e}),t=e),t}static isTodayBrowse(e){var t=r.getStorageSync(e),a=(new Date).getFullYear()+"-"+((new Date).getMonth()+1)+"-"+(new Date).getDate();return t&&a==t?!(!t||a!=t):(r.setStorageSync(e,a),!1)}static formatDate(e,t){var r=new Date(e).getFullYear(),a=new Date(e).getMonth()+1,n=new Date(e).getDate(),o=new Date(e).getHours(),i=new Date(e).getMinutes(),s=new Date(e).getSeconds();return a=a>9?a:"0"+a,n=n>9?n:"0"+n,o=o>9?o:"0"+o,i=i>9?i:"0"+i,s=s>9?s:"0"+s,t.replace("y",r).replace("M",a).replace("d",n).replace("h",o).replace("m",i).replace("s",s)}static getPageKey(){var e=r.getStorageSync("monitorPageKey"),t=b.getUuid();return e&&/^[0-9a-z]{8}(-[0-9a-z]{4}){3}-[0-9a-z]{12}-\d{13}$/.test(e)||(e=t),e}static setPageKey(){r.setStorage({key:"monitorPageKey",data:b.getUuid()})}static ajax(e,t,a,n,o){r.request({method:e,url:t,data:a,header:{"Content-Type":"application/json"},success:e=>{"function"==typeof n&&n(e)},fail:e=>{"function"==typeof o&&o(e)}})}static uploadCusBehavior(e,t,a){var n={webMonitorId:b.getWebMonitorId(),userId:b.getCusInfo("userId"),uploadType:"CUSTOMIZE_BEHAVIOR",happenTime:(new Date).getTime(),behaviorType:b.b64EncodeUnicode(e),behaviorResult:b.b64EncodeUnicode(t),description:b.b64EncodeUnicode(a)};r.request({method:"POST",url:u+"/server/upMyLog",data:{logs:[n]},header:{"Content-Type":"application/json"}})}static checkReqResLen(e="",t="",r){var a=e?JSON.stringify(e):"no param",n=t?JSON.stringify(t):"no result",o=parseInt(r.rl)||500,i=parseInt(r.sl)||500;return a&&a.length>o&&(a="too long"),n&&n.length>i&&(n="too long"),{requestText:a,responseText:n}}static encryptObj(e){if(e instanceof Array){for(var t=[],r=0;r50&&(e=e.substring(0,10)+"****"+e.substring(e.length-9,e.length)),e}static getDevice(){return r.getSystemInfoSync()}static b64EncodeUnicode(e){var t=encodeURIComponent(e);try{return r.btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,function(e,t){return String.fromCharCode("0x"+t)}))}catch(e){return t}}static utf8_encode(e){if(!e)return"";var t="";e=e.replace(/\r\n/g,"\n");for(var r=0;r127&&a<2048?(t+=String.fromCharCode(a>>6|192),t+=String.fromCharCode(63&a|128)):(t+=String.fromCharCode(a>>12|224),t+=String.fromCharCode(a>>6&63|128),t+=String.fromCharCode(63&a|128))}return t}static setWfCookie(e,t,a){var n={data:t,expires:a},o=r.getStorageSync(m);if(o)o[e]=n,r.setStorage(m,o);else{var i={};i[e]=n,r.setStorage(m,i)}}static getWfCookie(e){var t=r.getStorageSync(m);if(t){var a=t[e];if(!a)return"";var n=parseInt(a.expires,10);return(new Date).getTime()>n?(delete t[e],r.setStorage(m,t),""):a.data}return""}static getCusInfo(e){if(!e)return"";var t=r.getStorageSync("wmUserInfo"),a=(t?JSON.parse(t):{})[e];return a||""}static getWebMonitorId(){var e="jeffery_webmonitor";if(-1!==e.indexOf("_pro")){var t=b.getCusInfo("env");t&&(e=e.replace("_pro","_"+t))}return e}static checkIgnore(e,t){if(!t)return!0;for(var r=t.replace(/ /g,""),a=i[e].ia||[],n=!0,o=0;o0){var T=w[0].match(/\d{2}/g),S=T[0]+T[1]+"-"+T[2]+"-"+T[3]+" "+T[4]+":"+T[5]+":"+T[6],O=new Date(S).getTime();m=(new Date).getTime()-O>300?0==t?"o_uv":"o":"n_uv"}}else m="n_uv",b.getCustomerKey();var I=new C("reload",0,m,"");if("n_uv"===m||"o_uv"===m){var P=[I,n];b.ajax("POST",l,P)}else I.handleLogInfo(f,I)}}(),P=e)}}function D(e,t,r,a,n,o){_();var i=t||"",s=o||"",c="",u="";(i.length>=1e3&&(i=i.substring(0,999)),s.length>=3e3&&(s=s.substring(0,2999)),i.length>=80?u=i.substring(0,80):i.length>0&&i.length<80&&(u=i),i)&&(c="string"==typeof s?s.split(": ")[0].replace('"',""):JSON.stringify(s).split(": ")[0].replace('"',""));if(b.checkIgnore("je",i)){var l=new O(d,e,c+": "+u,c+": "+i,s);l.handleLogInfo(d,l)}}function U(){for(var e=[],t=0;t0&&b.ajax("POST",l,e,function(e){if(e&&e.data){var t=e.data;if(t&&t.data&&t.data.d){var a=t.data.c;if(a){var n=JSON.parse(a);if(r.setStorage({key:"WF_CONFIG",data:n}),i=n,0==n.s){var o=(new Date).getTime()+6e5;b.setWfCookie("webfunnyStart","p",o)}}}}},function(){})}wx.webfunny=function(e){for(var t=i.ia,a=!1,n=b.getCurrentPages(),o=0;o{arguments[0].success=function(...r){b.uploadCusBehavior("switchTab","success","Tab切换至:"+e.url),t(...r)},arguments[0].fail=function(...t){b.uploadCusBehavior("switchTab","failed","Tab切换至:"+e.url),r(...t)},m.switchTab.apply(this,arguments)});arguments[0].success=function(...r){b.uploadCusBehavior("switchTab","success","Tab切换至:"+e.url),t&&t(...r)},arguments[0].fail=function(...t){b.uploadCusBehavior("switchTab","failed","Tab切换至:"+e.url),r&&r(...t)},m.switchTab.apply(this,arguments)}}),Object.defineProperty(wx,"navigateBack",{writable:!1,value:function(e){if(!arguments[0])return new Promise((t,r)=>{arguments[0]&&(arguments[0].success=function(...r){b.uploadCusBehavior("navigateBack","success","页面回层数:"+e.delta),t(...r)},arguments[0].fail=function(...t){b.uploadCusBehavior("navigateBack","failed","页面回层数:"+e.delta),r(...t)},m.navigateBack.apply(this,arguments))});var t=arguments[0].success,r=arguments[0].fail;t&&(arguments[0].success=function(...r){b.uploadCusBehavior("navigateBack","success","页面回层数:"+e.delta),t&&t(...r)}),r&&(arguments[0].fail=function(...t){b.uploadCusBehavior("navigateBack","failed","页面回层数:"+e.delta),r&&r(...t)}),m.navigateBack.apply(this,arguments)}}),Object.defineProperty(wx,"navigateTo",{writable:!1,value:function(e){if(!arguments[0])return new Promise((t,r)=>{arguments[0]&&(arguments[0].success=function(...r){b.uploadCusBehavior("navigateTo","success","页面切换至:"+e.url),T(e.url),t(...r)},arguments[0].fail=function(...t){b.uploadCusBehavior("navigateTo","failed","页面切换至:"+e.url),r(...t)},m.navigateTo.apply(this,arguments))});var t=arguments[0].success,r=arguments[0].fail;t&&(arguments[0].success=function(...r){b.uploadCusBehavior("navigateTo","success","页面切换至:"+e.url),T(e.url),t&&t(...r)}),r&&(arguments[0].fail=function(...t){b.uploadCusBehavior("navigateTo","failed","页面切换至:"+e.url),r&&r(...t)}),m.navigateTo.apply(this,arguments)}}),Object.defineProperty(wx,"redirectTo",{writable:!1,value:function(e){if(!arguments[0])return new Promise((t,r)=>{arguments[0]&&(arguments[0].success=function(...r){b.uploadCusBehavior("redirectTo","success","重定向:"+e.url),t(...r)},arguments[0].fail=function(...t){b.uploadCusBehavior("redirectTo","failed","重定向:"+e.url),r(...t)},m.redirectTo.apply(this,arguments))});var t=arguments[0].success,r=arguments[0].fail;t&&(arguments[0].success=function(...r){b.uploadCusBehavior("redirectTo","success","重定向:"+e.url),t&&t(...r)}),r&&(arguments[0].fail=function(...t){b.uploadCusBehavior("redirectTo","failed","重定向:"+e.url),r&&r(...t)}),m.redirectTo.apply(this,arguments)}}),Object.defineProperty(wx,"reLaunch",{writable:!1,value:function(e){if(!arguments[0])return new Promise((t,r)=>{arguments[0]&&(arguments[0].success=function(...r){b.uploadCusBehavior("reLaunch","success","重启:"+e.url),t(...r)},arguments[0].fail=function(...t){b.uploadCusBehavior("reLaunch","failed","重启:"+e.url),r(...t)},m.reLaunch.apply(this,arguments))});var t=arguments[0].success,r=arguments[0].fail;t&&(arguments[0].success=function(...r){b.uploadCusBehavior("reLaunch","success","重启:"+e.url),t&&t(...r)}),r&&(arguments[0].fail=function(...t){b.uploadCusBehavior("reLaunch","failed","重启:"+e.url),r&&r(...t)}),m.reLaunch.apply(this,arguments)}}),Object.defineProperty(wx,"request",{writable:!1,value:function(e){function t(e,t,r,a,n,o,i,s,c){if(b.checkIgnore("hl",r)){var u=new I(e,t,r,a,n,o,i,s,c);u.handleLogInfo(e,u)}}if(-1==e.url.indexOf(c)){e.startTime=(new Date).getTime();var r=e.method,a=e.url;t(h,r,a,"200","OK","request","","",0)}var n=arguments[0].success,o=arguments[0].fail,i=arguments[0].complete;if(!(n||o||i))return new Promise((r,a)=>{arguments[0].success=function(...a){if(-1==e.url.indexOf(c)){var n=(new Date).getTime()-e.startTime,o=e.method,i=e.url,s=a[0],u=s.statusCode,l=b.checkReqResLen(e.data,s.data,y);t(h,o,i,u,"OK","response",l.requestText,l.responseText,n)}r(...a)},arguments[0].fail=function(...r){if(-1==e.url.indexOf(c)){var n=(new Date).getTime()-e.startTime,o=e.method,i=e.url,s=r[0],u=JSON.stringify(e.data),l=s.errMsg;t(h,o,i,555,"fail","response",u,l,n)}a(...r)},m.request.apply(this,arguments)});arguments[0].success=function(...r){if(-1==e.url.indexOf(c)){var a=(new Date).getTime()-e.startTime,o=e.method,i=e.url,s=r[0],u=s.statusCode,l=b.checkReqResLen(e.data,s.data,y);t(h,o,i,u,"OK","response",l.requestText,l.responseText,a)}n&&n(...r)},arguments[0].fail=function(...r){if(-1==e.url.indexOf(c)){var a=(new Date).getTime()-e.startTime,n=e.method,i=e.url,s=r[0],u=JSON.stringify(e.data),l=s.errMsg;t(h,n,i,555,"fail","response",u,l,a)}o&&o(...r)},m.request.apply(this,arguments)}}),v.s&&(g=console.error,console.error=function(e){var t=arguments[0]&&arguments[0].message||e,r=arguments[0]&&arguments[0].stack;if(r)D("on_error",t,0,0,0,r);else{if("object"==typeof t)try{t=JSON.stringify(t)}catch(e){t="错误无法解析"}D("console_error",t,0,0,0,"CustomizeError: "+t)}return g.apply(console,arguments)});var w=(new Date).getTime();setInterval(function(){_();let e=(new Date).getTime(),t=e-w;r.getStorageSync(h).length>10?U():t>=200*d&&(U(),w=e)},1e3);var S={onLaunch:function(){!function(e){var t=b.isTodayBrowse(p),a=r.getStorageSync("monitorCustomerKey");if(a){var n="",o=a?a.match(/\d{14}/g):[];if(o&&o.length>0){var i=o[0].match(/\d{2}/g),s=i[0]+i[1]+"-"+i[2]+"-"+i[3]+" "+i[4]+":"+i[5]+":"+i[6],c=new Date(s).getTime();n=(new Date).getTime()-c>300?0==t?"o_uv":"o":"n_uv"}}else n="n_uv",b.getCustomerKey();var u=new C("reload",0,n,"");if(u.simpleUrl=e,u.completeUrl=e,"n_uv"===n||"o_uv"===n){var g=[u];b.getCusInfo("userId")?b.ajax("POST",l,g):setTimeout(function(){b.ajax("POST",l,g)},3e3)}else u.handleLogInfo(f,u)}("onLaunch")},onError:function(e){if(v.s){var t="";"string"==typeof e?t=e:"object"==typeof e&&(t=e.stack||"");var r=t.split("\n")[2];b.getCurrentPages(),D("on_error",r,0,0,0,t)}}};for(const t in S){const r="function"==typeof e[t]&&e[t];e[t]=function(){S[t].apply(this,arguments),r&&r.apply(this,arguments)}}return e}}}]); \ No newline at end of file diff --git a/lib/webfunny.uni.min.js b/lib/webfunny.uni.min.js index dfe3092c..e522bbc0 100644 --- a/lib/webfunny.uni.min.js +++ b/lib/webfunny.uni.min.js @@ -1 +1 @@ -!function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)r.d(n,a,function(t){return e[t]}.bind(null,a));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t){let r=uni;var n,a;a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",(n=r).btoa=n.btoa||function(e){for(var t,r,n,o,i="",s=0,c=(e=String(e)).length%3;s255||(n=e.charCodeAt(s++))>255||(o=e.charCodeAt(s++))>255)throw new TypeError("Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range.");i+=a.charAt((t=r<<16|n<<8|o)>>18&63)+a.charAt(t>>12&63)+a.charAt(t>>6&63)+a.charAt(63&t)}return c?i.slice(0,c-3)+"===".substring(c):i};var o=r.getStorageSync("WF_CONFIG"),i=o||{s:!0,ia:[""],wc:40,pv:{s:"webfunny-pageview-switch",ia:[""]},je:{s:"webfunny-jserror-switch",ia:[""]},hl:{s:"webfunny-http-switch",ia:[""],uh:!1,rl:500,sl:500},rl:{s:"webfunny-resource-switch",ia:[""]},bl:{s:"webfunny-behavior-switch"},lc:{s:"webfunny-location-switch"}},s="webfunnyVersionFlag",c="&&&www.webfunny.cn&&&",u="http://"+c,l=u+"/server/upMog",f="CUSTOMER_PV",g="CUS_LEAVE",h="HTTP_LOG",d="JS_ERROR",p="LAST_BROWSE_DATE",v="WM_PAGE_ENTRY_TIME",y="WM_VISIT_PAGE_COUNT",m="WEBFUNNY_COOKIE",T=[d,f,h],w=function(e){var t=new b("reload",0,"o","");t.simpleUrl=e,t.completeUrl=e,t.handleLogInfo(f,t)};class S{static getCurrentPages(){var e="";try{e=getCurrentPages().length?getCurrentPages()[0].route:""}catch(t){e=""}return e}static getUuid(){var e=S.formatDate((new Date).getTime(),"yMdhms");return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)})+"-"+e}static getCustomerKey(){var e=S.getUuid(),t=r.getStorageSync("monitorCustomerKey");return t||(r.setStorage({key:"monitorCustomerKey",data:e}),t=e),t}static isTodayBrowse(e){var t=r.getStorageSync(e),n=(new Date).getFullYear()+"-"+((new Date).getMonth()+1)+"-"+(new Date).getDate();return t&&n==t?!(!t||n!=t):(r.setStorageSync(e,n),!1)}static formatDate(e,t){var r=new Date(e).getFullYear(),n=new Date(e).getMonth()+1,a=new Date(e).getDate(),o=new Date(e).getHours(),i=new Date(e).getMinutes(),s=new Date(e).getSeconds();return n=n>9?n:"0"+n,a=a>9?a:"0"+a,o=o>9?o:"0"+o,i=i>9?i:"0"+i,s=s>9?s:"0"+s,t.replace("y",r).replace("M",n).replace("d",a).replace("h",o).replace("m",i).replace("s",s)}static getPageKey(){var e=r.getStorageSync("monitorPageKey"),t=S.getUuid();return e&&/^[0-9a-z]{8}(-[0-9a-z]{4}){3}-[0-9a-z]{12}-\d{13}$/.test(e)||(e=t),e}static setPageKey(){r.setStorage({key:"monitorPageKey",data:S.getUuid()})}static ajax(e,t,n,a,o){r.request({method:e,url:t,data:n,header:{"Content-Type":"application/json"},success:e=>{"function"==typeof a&&a(e)},fail:e=>{"function"==typeof o&&o(e)}})}static uploadCusBehavior(e,t,n){var a={webMonitorId:S.getWebMonitorId(),userId:S.getCusInfo("userId"),uploadType:"CUSTOMIZE_BEHAVIOR",happenTime:(new Date).getTime(),behaviorType:S.b64EncodeUnicode(e),behaviorResult:S.b64EncodeUnicode(t),description:S.b64EncodeUnicode(n)};r.request({method:"POST",url:u+"/server/upMyLog",data:{logs:[a]},header:{"Content-Type":"application/json"}})}static checkReqResLen(e="",t="",r){var n=e?JSON.stringify(e):"no param",a=t?JSON.stringify(t):"no result",o=parseInt(r.rl)||500,i=parseInt(r.sl)||500;return n&&n.length>o&&(n="too long"),a&&a.length>i&&(a="too long"),{requestText:n,responseText:a}}static encryptObj(e){if(e instanceof Array){for(var t=[],r=0;r50&&(e=e.substring(0,10)+"****"+e.substring(e.length-9,e.length)),e}static getDevice(){return r.getSystemInfoSync()}static b64EncodeUnicode(e){var t=encodeURIComponent(e);try{return r.btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,function(e,t){return String.fromCharCode("0x"+t)}))}catch(e){return t}}static utf8_encode(e){if(!e)return"";var t="";e=e.replace(/\r\n/g,"\n");for(var r=0;r127&&n<2048?(t+=String.fromCharCode(n>>6|192),t+=String.fromCharCode(63&n|128)):(t+=String.fromCharCode(n>>12|224),t+=String.fromCharCode(n>>6&63|128),t+=String.fromCharCode(63&n|128))}return t}static setWfCookie(e,t,n){var a={data:t,expires:n},o=r.getStorageSync(m);if(o)o[e]=a,r.setStorage(m,o);else{var i={};i[e]=a,r.setStorage(m,i)}}static getWfCookie(e){var t=r.getStorageSync(m);if(t){var n=t[e];if(!n)return"";var a=parseInt(n.expires,10);return(new Date).getTime()>a?(delete t[e],r.setStorage(m,t),""):n.data}return""}static getCusInfo(e){if(!e)return"";var t=r.getStorageSync("wmUserInfo"),n=(t?JSON.parse(t):{})[e];return n||""}static getWebMonitorId(){var e="jeffery_webmonitor";if(-1!==e.indexOf("_pro")){var t=S.getCusInfo("env");t&&(e=e.replace("_pro","_"+t))}return e}static checkIgnore(e,t){if(!t)return!0;for(var r=t.replace(/ /g,""),n=i[e].ia||[],a=!0,o=0;o0){var w=T[0].match(/\d{2}/g),C=w[0]+w[1]+"-"+w[2]+"-"+w[3]+" "+w[4]+":"+w[5]+":"+w[6],I=new Date(C).getTime();m=(new Date).getTime()-I>300?0==t?"o_uv":"o":"n_uv"}}else m="n_uv",S.getCustomerKey();var O=new b("reload",0,m,"");if("n_uv"===m||"o_uv"===m){var P=[O,a];S.ajax("POST",l,P)}else O.handleLogInfo(f,O)}}(),P=e)}}function D(e,t,r,n,a,o){_();var i=t||"",s=o||"",c="",u="";(i.length>=1e3&&(i=i.substring(0,999)),s.length>=3e3&&(s=s.substring(0,2999)),i.length>=80?u=i.substring(0,80):i.length>0&&i.length<80&&(u=i),i)&&(c="string"==typeof s?s.split(": ")[0].replace('"',""):JSON.stringify(s).split(": ")[0].replace('"',""));if(S.checkIgnore("je",i)){var l=new I(d,e,c+": "+u,c+": "+i,s);l.handleLogInfo(d,l)}}function U(){for(var e=[],t=0;t0&&S.ajax("POST",l,e,function(e){if(e&&e.data){var t=e.data;if(t&&t.data&&t.data.d){var n=t.data.c;if(n){var a=JSON.parse(n);if(r.setStorage({key:"WF_CONFIG",data:a}),i=a,0==a.s){var o=(new Date).getTime()+6e5;S.setWfCookie("webfunnyStart","p",o)}}}}},function(){})}uni.webfunny=function(e){for(var t=i.ia,n=!1,a=S.getCurrentPages(),o=0;o{arguments[0].success=function(...r){S.uploadCusBehavior("switchTab","success","Tab切换至:"+e.url),t(...r)},arguments[0].fail=function(...t){S.uploadCusBehavior("switchTab","failed","Tab切换至:"+e.url),r(...t)},y.apply(this,arguments)});arguments[0].success=function(...r){S.uploadCusBehavior("switchTab","success","Tab切换至:"+e.url),t&&t(...r)},arguments[0].fail=function(...t){S.uploadCusBehavior("switchTab","failed","Tab切换至:"+e.url),r&&r(...t)},y.apply(this,arguments)};var m=uni.navigateBack;uni.navigateBack=function(e){var t=arguments[0].success,r=arguments[0].fail,n=arguments[0].complete;if(!(t||r||n))return new Promise((t,r)=>{arguments[0].success=function(...r){S.uploadCusBehavior("navigateBack","success","页面回层数:"+e.delta),t(...r)},arguments[0].fail=function(...t){S.uploadCusBehavior("navigateBack","failed","页面回层数:"+e.delta),r(...t)},m.apply(this,arguments)});arguments[0].success=function(...r){S.uploadCusBehavior("navigateBack","success","页面回层数:"+e.delta),t&&t(...r)},arguments[0].fail=function(...t){S.uploadCusBehavior("navigateBack","failed","页面回层数:"+e.delta),r&&r(...t)},m.apply(this,arguments)};var T=uni.navigateTo;uni.navigateTo=function(e){var t=arguments[0].success,r=arguments[0].fail,n=arguments[0].complete;if(!(t||r||n))return new Promise((t,r)=>{arguments[0].success=function(...r){S.uploadCusBehavior("navigateTo","success","路由切换至:"+e.url),w(e.url),t(...r)},arguments[0].fail=function(...t){S.uploadCusBehavior("navigateTo","failed","路由切换至:"+e.url),r(...t)},T.apply(this,arguments)});arguments[0].success=function(...r){S.uploadCusBehavior("navigateTo","success","路由切换至:"+e.url),w(e.url),t&&t(...r)},arguments[0].fail=function(...t){S.uploadCusBehavior("navigateTo","failed","路由切换至:"+e.url),r&&r(...t)},T.apply(this,arguments)};var C=uni.redirectTo;uni.redirectTo=function(e){var t=arguments[0].success,r=arguments[0].fail,n=arguments[0].complete;if(!(t||r||n))return new Promise((t,r)=>{arguments[0].success=function(...r){S.uploadCusBehavior("redirectTo","success","重定向至:"+e.url),t(...r)},arguments[0].fail=function(...t){S.uploadCusBehavior("redirectTo","failed","重定向至:"+e.url),r(...t)},C.apply(this,arguments)});arguments[0].success=function(...r){S.uploadCusBehavior("redirectTo","success","重定向至:"+e.url),t&&t(...r)},arguments[0].fail=function(...t){S.uploadCusBehavior("redirectTo","failed","重定向至:"+e.url),r&&r(...t)},C.apply(this,arguments)};var x=uni.reLaunch;uni.reLaunch=function(e){var t=arguments[0].success,r=arguments[0].fail,n=arguments[0].complete;if(!(t||r||n))return new Promise((t,r)=>{arguments[0].success=function(...r){S.uploadCusBehavior("reLaunch","success","重启至:"+e.url),t(...r)},arguments[0].fail=function(...t){S.uploadCusBehavior("reLaunch","failed","重启至:"+e.url),r(...t)},x.apply(this,arguments)});arguments[0].success=function(...r){S.uploadCusBehavior("reLaunch","success","重启至:"+e.url),t&&t(...r)},arguments[0].fail=function(...t){S.uploadCusBehavior("reLaunch","failed","重启至:"+e.url),r&&r(...t)},x.apply(this,arguments)};var I,P=uni.request;uni.request=function(){function e(e,t,r,n,a,o,i,s,c){if(S.checkIgnore("hl",r)){var u=new O(e,t,r,n,a,o,i,s,c);u.handleLogInfo(e,u)}}let t=arguments[0];if(-1==t.url.indexOf(c)){t.startTime=(new Date).getTime();var r=t.method,n=t.url;e(h,r,n,"200","OK","request","","",0)}var a=arguments[0].success,o=arguments[0].fail,i=arguments[0].complete;if(!(a||o||i))return new Promise((r,n)=>{arguments[0].success=function(...n){if(-1==t.url.indexOf(c)){var a=(new Date).getTime()-t.startTime,o=t.method,i=t.url,s=n[0],u=s.statusCode;console.log("请求参数:",t);var l=S.checkReqResLen(t.data,s.data,v);e(h,o,i,u,"OK","response",l.requestText,l.responseText,a)}r(...n)},arguments[0].fail=function(...r){if(-1==t.url.indexOf(c)){var a=(new Date).getTime()-t.startTime,o=t.method,i=t.url,s=r[0],u=JSON.stringify(t.data),l=s.errMsg;e(h,o,i,555,"fail","response",u,l,a)}n(...r)},P.apply(this,arguments)});arguments[0].success=function(...r){if(-1==t.url.indexOf(c)){var n=(new Date).getTime()-t.startTime,o=t.method,i=t.url,s=r[0],u=s.statusCode,l=S.checkReqResLen(t.data,s.data,v);e(h,o,i,u,"OK","response",l.requestText,l.responseText,n)}a&&a(...r)},arguments[0].fail=function(...r){if(-1==t.url.indexOf(c)){var n=(new Date).getTime()-t.startTime,a=t.method,i=t.url,s=r[0],u=JSON.stringify(t.data),l=s.errMsg;e(h,a,i,555,"fail","response",u,l,n)}o&&o(...r)},P.apply(this,arguments)},d.s&&(I=console.error,console.error=function(e){var t=arguments[0]&&arguments[0].message||e,r=arguments[0]&&arguments[0].stack;if(r)D("on_error",t,0,0,0,r);else{if("object"==typeof t)try{t=JSON.stringify(t)}catch(e){t="错误无法解析"}D("console_error",t,0,0,0,"CustomizeError: "+t)}return I.apply(console,arguments)});var B=(new Date).getTime();setInterval(function(){_();let e=(new Date).getTime(),t=e-B;r.getStorageSync(h).length>10?U():t>=200*g&&(U(),B=e)},1e3);var E={onLaunch:function(){!function(e){var t=S.isTodayBrowse(p),n=r.getStorageSync("monitorCustomerKey");if(n){var a="",o=n?n.match(/\d{14}/g):[];if(o&&o.length>0){var i=o[0].match(/\d{2}/g),s=i[0]+i[1]+"-"+i[2]+"-"+i[3]+" "+i[4]+":"+i[5]+":"+i[6],c=new Date(s).getTime();a=(new Date).getTime()-c>300?0==t?"o_uv":"o":"n_uv"}}else a="n_uv",S.getCustomerKey();var u=new b("reload",0,a,"");if(u.simpleUrl=e,u.completeUrl=e,"n_uv"===a||"o_uv"===a){var g=[u];S.getCusInfo("userId")?S.ajax("POST",l,g):setTimeout(function(){S.ajax("POST",l,g)},3e3)}else u.handleLogInfo(f,u)}("onLaunch")},onError:function(e){if(d.s){var t="";"string"==typeof e?t=e:"object"==typeof e&&(t=e.stack||"");var r=t.split("\n")[2];S.getCurrentPages(),D("on_error",r,0,0,0,t)}}};for(const t in E){const r="function"==typeof e[t]&&e[t];e[t]=function(){E[t].apply(this,arguments),r&&r.apply(this,arguments)}}return e}}}]); \ No newline at end of file +!function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)r.d(n,a,function(t){return e[t]}.bind(null,a));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t){let r=uni;var n,a;a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",(n=r).btoa=n.btoa||function(e){for(var t,r,n,o,i="",s=0,u=(e=String(e)).length%3;s255||(n=e.charCodeAt(s++))>255||(o=e.charCodeAt(s++))>255)throw new TypeError("Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range.");i+=a.charAt((t=r<<16|n<<8|o)>>18&63)+a.charAt(t>>12&63)+a.charAt(t>>6&63)+a.charAt(63&t)}return u?i.slice(0,u-3)+"===".substring(u):i};var o=r.getStorageSync("WF_CONFIG"),i=o||{s:!0,ia:[""],wc:40,pv:{s:"webfunny-pageview-switch",ia:[""]},je:{s:"webfunny-jserror-switch",ia:[""]},hl:{s:"webfunny-http-switch",ia:[""],uh:!1,rl:500,sl:500},rl:{s:"webfunny-resource-switch",ia:[""]},bl:{s:"webfunny-behavior-switch"},lc:{s:"webfunny-location-switch"}},s="webfunnyVersionFlag",u="&&&www.webfunny.cn&&&",c="http://"+u,l=c+"/server/upMog",f="CUSTOMER_PV",g="CUS_LEAVE",h="HTTP_LOG",d="JS_ERROR",p="LAST_BROWSE_DATE",v="WM_PAGE_ENTRY_TIME",y="WM_VISIT_PAGE_COUNT",m="WEBFUNNY_COOKIE",T=[d,f,h],w=function(e){var t=new b("reload",0,"o","");t.simpleUrl=e,t.completeUrl=e,t.handleLogInfo(f,t)};class S{static getCurrentPages(){var e="";try{e=getCurrentPages().length?getCurrentPages()[0].route:""}catch(t){e=""}return e}static getUuid(){var e=S.formatDate((new Date).getTime(),"yMdhms");return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)})+"-"+e}static getCustomerKey(){var e=S.getUuid(),t=r.getStorageSync("monitorCustomerKey");return t||(r.setStorage({key:"monitorCustomerKey",data:e}),t=e),t}static isTodayBrowse(e){var t=r.getStorageSync(e),n=(new Date).getFullYear()+"-"+((new Date).getMonth()+1)+"-"+(new Date).getDate();return t&&n==t?!(!t||n!=t):(r.setStorageSync(e,n),!1)}static formatDate(e,t){var r=new Date(e).getFullYear(),n=new Date(e).getMonth()+1,a=new Date(e).getDate(),o=new Date(e).getHours(),i=new Date(e).getMinutes(),s=new Date(e).getSeconds();return n=n>9?n:"0"+n,a=a>9?a:"0"+a,o=o>9?o:"0"+o,i=i>9?i:"0"+i,s=s>9?s:"0"+s,t.replace("y",r).replace("M",n).replace("d",a).replace("h",o).replace("m",i).replace("s",s)}static getPageKey(){var e=r.getStorageSync("monitorPageKey"),t=S.getUuid();return e&&/^[0-9a-z]{8}(-[0-9a-z]{4}){3}-[0-9a-z]{12}-\d{13}$/.test(e)||(e=t),e}static setPageKey(){r.setStorage({key:"monitorPageKey",data:S.getUuid()})}static ajax(e,t,n,a,o){r.request({method:e,url:t,data:n,header:{"Content-Type":"application/json"},success:e=>{"function"==typeof a&&a(e)},fail:e=>{"function"==typeof o&&o(e)}})}static uploadCusBehavior(e,t,n){var a={webMonitorId:S.getWebMonitorId(),userId:S.getCusInfo("userId"),uploadType:"CUSTOMIZE_BEHAVIOR",happenTime:(new Date).getTime(),behaviorType:S.b64EncodeUnicode(e),behaviorResult:S.b64EncodeUnicode(t),description:S.b64EncodeUnicode(n)};r.request({method:"POST",url:c+"/server/upMyLog",data:{logs:[a]},header:{"Content-Type":"application/json"}})}static checkReqResLen(e="",t="",r){var n=e?JSON.stringify(e):"no param",a=t?JSON.stringify(t):"no result",o=parseInt(r.rl)||500,i=parseInt(r.sl)||500;return n&&n.length>o&&(n="too long"),a&&a.length>i&&(a="too long"),{requestText:n,responseText:a}}static encryptObj(e){if(e instanceof Array){for(var t=[],r=0;r50&&(e=e.substring(0,10)+"****"+e.substring(e.length-9,e.length)),e}static getDevice(){return r.getSystemInfoSync()}static b64EncodeUnicode(e){var t=encodeURIComponent(e);try{return r.btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,function(e,t){return String.fromCharCode("0x"+t)}))}catch(e){return t}}static utf8_encode(e){if(!e)return"";var t="";e=e.replace(/\r\n/g,"\n");for(var r=0;r127&&n<2048?(t+=String.fromCharCode(n>>6|192),t+=String.fromCharCode(63&n|128)):(t+=String.fromCharCode(n>>12|224),t+=String.fromCharCode(n>>6&63|128),t+=String.fromCharCode(63&n|128))}return t}static setWfCookie(e,t,n){var a={data:t,expires:n},o=r.getStorageSync(m);if(o)o[e]=a,r.setStorage(m,o);else{var i={};i[e]=a,r.setStorage(m,i)}}static getWfCookie(e){var t=r.getStorageSync(m);if(t){var n=t[e];if(!n)return"";var a=parseInt(n.expires,10);return(new Date).getTime()>a?(delete t[e],r.setStorage(m,t),""):n.data}return""}static getCusInfo(e){if(!e)return"";var t=r.getStorageSync("wmUserInfo"),n=(t?JSON.parse(t):{})[e];return n||""}static getWebMonitorId(){var e="jeffery_webmonitor";if(-1!==e.indexOf("_pro")){var t=S.getCusInfo("env");t&&(e=e.replace("_pro","_"+t))}return e}static checkIgnore(e,t){if(!t)return!0;for(var r=t.replace(/ /g,""),n=i[e].ia||[],a=!0,o=0;o0){var w=T[0].match(/\d{2}/g),C=w[0]+w[1]+"-"+w[2]+"-"+w[3]+" "+w[4]+":"+w[5]+":"+w[6],I=new Date(C).getTime();m=(new Date).getTime()-I>300?0==t?"o_uv":"o":"n_uv"}}else m="n_uv",S.getCustomerKey();var O=new b("reload",0,m,"");if("n_uv"===m||"o_uv"===m){var P=[O,a];S.ajax("POST",l,P)}else O.handleLogInfo(f,O)}}(),P=e)}}function D(e,t,r,n,a,o){_();var i=t||"",s=o||"",u="",c="";(i.length>=1e3&&(i=i.substring(0,999)),s.length>=3e3&&(s=s.substring(0,2999)),i.length>=80?c=i.substring(0,80):i.length>0&&i.length<80&&(c=i),i)&&(u="string"==typeof s?s.split(": ")[0].replace('"',""):JSON.stringify(s).split(": ")[0].replace('"',""));if(S.checkIgnore("je",i)){var l=new I(d,e,u+": "+c,u+": "+i,s);l.handleLogInfo(d,l)}}function U(){for(var e=[],t=0;t0&&S.ajax("POST",l,e,function(e){if(e&&e.data){var t=e.data;if(t&&t.data&&t.data.d){var n=t.data.c;if(n){var a=JSON.parse(n);if(r.setStorage({key:"WF_CONFIG",data:a}),i=a,0==a.s){var o=(new Date).getTime()+6e5;S.setWfCookie("webfunnyStart","p",o)}}}}},function(){})}uni.webfunny=function(e){for(var t=i.ia,n=!1,a=S.getCurrentPages(),o=0;o{arguments[0].success=function(...r){S.uploadCusBehavior("switchTab","success","Tab切换至:"+e.url),t(...r)},arguments[0].fail=function(...t){S.uploadCusBehavior("switchTab","failed","Tab切换至:"+e.url),r(...t)},y.apply(this,arguments)});arguments[0].success=function(...r){S.uploadCusBehavior("switchTab","success","Tab切换至:"+e.url),t&&t(...r)},arguments[0].fail=function(...t){S.uploadCusBehavior("switchTab","failed","Tab切换至:"+e.url),r&&r(...t)},y.apply(this,arguments)};var m=uni.navigateBack;uni.navigateBack=function(e){if(!arguments[0])return new Promise((t,r)=>{arguments[0].success=function(...r){S.uploadCusBehavior("navigateBack","success","页面回层数:"+e.delta),t(...r)},arguments[0].fail=function(...t){S.uploadCusBehavior("navigateBack","failed","页面回层数:"+e.delta),r(...t)},m.apply(this,arguments)});var t=arguments[0].success,r=arguments[0].fail;t&&(arguments[0].success=function(...r){S.uploadCusBehavior("navigateBack","success","页面回层数:"+e.delta),t&&t(...r)}),r&&(arguments[0].fail=function(...t){S.uploadCusBehavior("navigateBack","failed","页面回层数:"+e.delta),r&&r(...t)}),m.apply(this,arguments)};var T=uni.navigateTo;uni.navigateTo=function(e){if(!arguments[0])return new Promise((t,r)=>{arguments[0]&&(arguments[0].success=function(...r){S.uploadCusBehavior("navigateTo","success","路由切换至:"+e.url),w(e.url),t(...r)},arguments[0].fail=function(...t){S.uploadCusBehavior("navigateTo","failed","路由切换至:"+e.url),r(...t)},T.apply(this,arguments))});var t=arguments[0].success,r=arguments[0].fail;t&&(arguments[0].success=function(...r){S.uploadCusBehavior("navigateTo","success","路由切换至:"+e.url),w(e.url),t&&t(...r)}),r&&(arguments[0].fail=function(...t){S.uploadCusBehavior("navigateTo","failed","路由切换至:"+e.url),r&&r(...t)}),T.apply(this,arguments)};var C=uni.redirectTo;uni.redirectTo=function(e){if(!arguments[0])return new Promise((t,r)=>{arguments[0]&&(arguments[0].success=function(...r){S.uploadCusBehavior("redirectTo","success","重定向至:"+e.url),t(...r)},arguments[0].fail=function(...t){S.uploadCusBehavior("redirectTo","failed","重定向至:"+e.url),r(...t)},C.apply(this,arguments))});var t=arguments[0].success,r=arguments[0].fail;t&&(arguments[0].success=function(...r){S.uploadCusBehavior("redirectTo","success","重定向至:"+e.url),t&&t(...r)}),r&&(arguments[0].fail=function(...t){S.uploadCusBehavior("redirectTo","failed","重定向至:"+e.url),r&&r(...t)}),C.apply(this,arguments)};var x=uni.reLaunch;uni.reLaunch=function(e){if(!arguments[0])return new Promise((t,r)=>{arguments[0]&&(arguments[0].success=function(...r){S.uploadCusBehavior("reLaunch","success","重启至:"+e.url),t(...r)},arguments[0].fail=function(...t){S.uploadCusBehavior("reLaunch","failed","重启至:"+e.url),r(...t)},x.apply(this,arguments))});var t=arguments[0].success,r=arguments[0].fail;t&&(arguments[0].success=function(...r){S.uploadCusBehavior("reLaunch","success","重启至:"+e.url),t&&t(...r)}),r&&(arguments[0].fail=function(...t){S.uploadCusBehavior("reLaunch","failed","重启至:"+e.url),r&&r(...t)}),x.apply(this,arguments)};var I,P=uni.request;uni.request=function(){function e(e,t,r,n,a,o,i,s,u){if(S.checkIgnore("hl",r)){var c=new O(e,t,r,n,a,o,i,s,u);c.handleLogInfo(e,c)}}let t=arguments[0];if(-1==t.url.indexOf(u)){t.startTime=(new Date).getTime();var r=t.method,n=t.url;e(h,r,n,"200","OK","request","","",0)}var a=arguments[0].success,o=arguments[0].fail,i=arguments[0].complete;if(!(a||o||i))return new Promise((r,n)=>{arguments[0].success=function(...n){if(-1==t.url.indexOf(u)){var a=(new Date).getTime()-t.startTime,o=t.method,i=t.url,s=n[0],c=s.statusCode;console.log("请求参数:",t);var l=S.checkReqResLen(t.data,s.data,v);e(h,o,i,c,"OK","response",l.requestText,l.responseText,a)}r(...n)},arguments[0].fail=function(...r){if(-1==t.url.indexOf(u)){var a=(new Date).getTime()-t.startTime,o=t.method,i=t.url,s=r[0],c=JSON.stringify(t.data),l=s.errMsg;e(h,o,i,555,"fail","response",c,l,a)}n(...r)},P.apply(this,arguments)});arguments[0].success=function(...r){if(-1==t.url.indexOf(u)){var n=(new Date).getTime()-t.startTime,o=t.method,i=t.url,s=r[0],c=s.statusCode,l=S.checkReqResLen(t.data,s.data,v);e(h,o,i,c,"OK","response",l.requestText,l.responseText,n)}a&&a(...r)},arguments[0].fail=function(...r){if(-1==t.url.indexOf(u)){var n=(new Date).getTime()-t.startTime,a=t.method,i=t.url,s=r[0],c=JSON.stringify(t.data),l=s.errMsg;e(h,a,i,555,"fail","response",c,l,n)}o&&o(...r)},P.apply(this,arguments)},d.s&&(I=console.error,console.error=function(e){var t=arguments[0]&&arguments[0].message||e,r=arguments[0]&&arguments[0].stack;if(r)D("on_error",t,0,0,0,r);else{if("object"==typeof t)try{t=JSON.stringify(t)}catch(e){t="错误无法解析"}D("console_error",t,0,0,0,"CustomizeError: "+t)}return I.apply(console,arguments)});var B=(new Date).getTime();setInterval(function(){_();let e=(new Date).getTime(),t=e-B;r.getStorageSync(h).length>10?U():t>=200*g&&(U(),B=e)},1e3);var E={onLaunch:function(){!function(e){var t=S.isTodayBrowse(p),n=r.getStorageSync("monitorCustomerKey");if(n){var a="",o=n?n.match(/\d{14}/g):[];if(o&&o.length>0){var i=o[0].match(/\d{2}/g),s=i[0]+i[1]+"-"+i[2]+"-"+i[3]+" "+i[4]+":"+i[5]+":"+i[6],u=new Date(s).getTime();a=(new Date).getTime()-u>300?0==t?"o_uv":"o":"n_uv"}}else a="n_uv",S.getCustomerKey();var c=new b("reload",0,a,"");if(c.simpleUrl=e,c.completeUrl=e,"n_uv"===a||"o_uv"===a){var g=[c];S.getCusInfo("userId")?S.ajax("POST",l,g):setTimeout(function(){S.ajax("POST",l,g)},3e3)}else c.handleLogInfo(f,c)}("onLaunch")},onError:function(e){if(d.s){var t="";"string"==typeof e?t=e:"object"==typeof e&&(t=e.stack||"");var r=t.split("\n")[2];S.getCurrentPages(),D("on_error",r,0,0,0,t)}}};for(const t in E){const r="function"==typeof e[t]&&e[t];e[t]=function(){E[t].apply(this,arguments),r&&r.apply(this,arguments)}}return e}}}]); \ No newline at end of file diff --git a/package.json b/package.json index 47010598..bd2781e8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "webfunny_monitor", - "version": "3.0.87", + "version": "3.0.97", "description": "这是webfunny的安装包", "main": "app.js", "scripts": {