From 7545415f940e3f38d8f5a0e7bce539c4494659ca Mon Sep 17 00:00:00 2001 From: "DESKTOP-RQ919RC\\Pc" <1300399510@qq.com> Date: Thu, 27 Mar 2025 19:03:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BB=9F=E8=AE=A1=E3=80=81?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E4=B8=8D=E4=B8=8D=E5=BF=85=E8=A6=81=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E3=80=81=E4=BF=AE=E6=94=B9=E9=A1=B9=E7=9B=AE=E5=BA=93?= =?UTF-8?q?=E8=AF=A6=E6=83=85bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.js | 67 ++++++++++--------- component/document-box/document-box.less | 3 +- component/document-box/document-box.wxss | 3 +- component/goLogin/goLogin.js | 3 +- component/indexSidebar/indexSidebar.js | 18 ++--- component/rent-pop/rent-pop.js | 6 +- pages/projectAllList/projectAllList.js | 3 - pages/projectComparison/projectComparison.js | 7 +- pages/projectDetails/projectDetails.js | 14 ++-- pages/projectDetails/projectDetails.less | 3 +- pages/projectDetails/projectDetails.wxml | 16 +++-- pages/projectDetails/projectDetails.wxss | 3 +- pages/projectLibrary/projectLibrary.js | 9 +-- pages/projectList/projectList.js | 7 +- .../projectSchoolHomepage.js | 4 -- .../projectSubjectList/projectSubjectList.js | 5 +- pages/search/search.js | 16 ++--- project.private.config.json | 7 ++ utils/commonMethod.js | 3 +- utils/miucms.js | 3 +- utils/util.js | 1 + utils/xstat.js | 1 + 22 files changed, 104 insertions(+), 98 deletions(-) create mode 100644 utils/xstat.js diff --git a/app.js b/app.js index 9973b25..5814e77 100644 --- a/app.js +++ b/app.js @@ -6,34 +6,39 @@ var miucms = require('./utils/miucms.js'); var initial_url = 'https://api.gter.net/xiaoapp_offer.init.json'; var __ = require('./utils/miucms.js'); import util from './utils/util' +import './utils/xstat'; -// 保存原始的Page构造器 -const originPage = Page; +// // 保存原始的Page构造器 +// const originPage = Page; +// // 重写Page构造器 +// Page = function (pageConfig) { +// // 添加全局的onShow逻辑 +// const originOnLoad = pageConfig.onLoad; +// pageConfig.onLoad = function () { +// util.statistics({}) +// if (originOnLoad) originOnLoad.apply(this, arguments); +// }; -// 重写Page构造器 -Page = function (pageConfig) { - // 添加全局的onShow逻辑 - const originOnLoad = pageConfig.onLoad; - pageConfig.onLoad = function () { - util.statistics({}) - if (originOnLoad) originOnLoad.apply(this, arguments); - }; +// const originOnShare = pageConfig.onShareAppMessage; +// if (originOnShare) { +// pageConfig.onShareAppMessage = function (e) { +// util.statistics({ +// name: "share" +// }) +// return originOnShare.apply(this, [e]); +// }; +// } - const originOnShare = pageConfig.onShareAppMessage; - if (originOnShare) { - pageConfig.onShareAppMessage = function (e) { - util.statistics({ - name: "share" - }) - return originOnShare.apply(this, [e]); - }; - } - - // 调用原始的Page函数 - return originPage(pageConfig); -}; +// // 调用原始的Page函数 +// return originPage(pageConfig); +// }; App({ + xstatConfig: { + appKey: wx.getAccountInfoSync().miniProgram.appId, // 自动获取 小程序appid + debug: true, //是否打开调试模式 + LOG_URL: 'https://stat.gter.net/send', // 上报地址 + }, randomString(n) { let str = 'abcdefghijklmnopqrstuvwxyz9876543210'; let tmp = '', @@ -46,14 +51,14 @@ App({ }, onLaunch: function (options) { - util.statistics({ - data: { - scene: options.scene - }, - path: options.path, - query: options.query, - name: "onLaunch" - }) + // util.statistics({ + // data: { + // scene: options.scene + // }, + // path: options.path, + // query: options.query, + // name: "onLaunch" + // }) const accountInfo = wx.getAccountInfoSync(); const envVersion = accountInfo.miniProgram.envVersion; diff --git a/component/document-box/document-box.less b/component/document-box/document-box.less index cae2618..af2ee3f 100644 --- a/component/document-box/document-box.less +++ b/component/document-box/document-box.less @@ -81,7 +81,8 @@ &.selectable { border: 1rpx solid rgba(215, 215, 215, 1); background-color: #fff; - color: #000000; + color: #333333; + font-weight: 400; } } } diff --git a/component/document-box/document-box.wxss b/component/document-box/document-box.wxss index bdee768..429636b 100644 --- a/component/document-box/document-box.wxss +++ b/component/document-box/document-box.wxss @@ -67,7 +67,8 @@ .file .file-list .file-item .name .tag.selectable { border: 1rpx solid #d7d7d7; background-color: #fff; - color: #000000; + color: #333333; + font-weight: 400; } .file .file-list .file-item .hint { font-size: 24rpx; diff --git a/component/goLogin/goLogin.js b/component/goLogin/goLogin.js index 7871dcf..86befea 100644 --- a/component/goLogin/goLogin.js +++ b/component/goLogin/goLogin.js @@ -186,7 +186,8 @@ Component({ }) } - util.bindingUser(data.user) + // util.bindingUser(data.user) + wx.xstat && wx.xstat.setUserid(data.user.uid); // 登录后手动设置用户id , 如果有 }).finally(() => { this.isloginState = false }) diff --git a/component/indexSidebar/indexSidebar.js b/component/indexSidebar/indexSidebar.js index 3887588..796e9d3 100644 --- a/component/indexSidebar/indexSidebar.js +++ b/component/indexSidebar/indexSidebar.js @@ -117,9 +117,9 @@ Component({ this.setData({ groupState: true, }) - util.statistics({ - name: "side-group" - }) + // util.statistics({ + // name: "side-group" + // }) return } @@ -129,9 +129,9 @@ Component({ path: "/pages/victoryList/victoryList" }) - util.statistics({ - name: "side-offer" - }) + // util.statistics({ + // name: "side-offer" + // }) return } @@ -141,9 +141,9 @@ Component({ path: "/pages/index/index" }) - util.statistics({ - name: "side-gx" - }) + // util.statistics({ + // name: "side-gx" + // }) return } diff --git a/component/rent-pop/rent-pop.js b/component/rent-pop/rent-pop.js index 630f04c..67e6389 100644 --- a/component/rent-pop/rent-pop.js +++ b/component/rent-pop/rent-pop.js @@ -36,9 +36,9 @@ Component({ }, skip() { - util.statistics({ - name: this.data.popup.statEvent - }) + // util.statistics({ + // name: this.data.popup.statEvent + // }) if (this.data.popup.applet?.appid) { wx.navigateToMiniProgram({ appId: this.data.popup.applet.appid, diff --git a/pages/projectAllList/projectAllList.js b/pages/projectAllList/projectAllList.js index 01cd03f..77d6005 100644 --- a/pages/projectAllList/projectAllList.js +++ b/pages/projectAllList/projectAllList.js @@ -463,9 +463,6 @@ Page({ }, onShareTimeline() { - util.statistics({ - name: "share-timeline" - }) return { title: "【寄托港校项目库】- 世界排行榜", } diff --git a/pages/projectComparison/projectComparison.js b/pages/projectComparison/projectComparison.js index ecc57f7..210ce8b 100644 --- a/pages/projectComparison/projectComparison.js +++ b/pages/projectComparison/projectComparison.js @@ -163,9 +163,9 @@ Page({ element['entrance_requirements'] = element.admission_requirements[0]['basic_requirements'] - element['tuition_fee_text'] = common.formatNumberWithSpaces(element.admissions?.[0]?.tuition_fee ? element.admissions[0].tuition_fee + '' : '') + element['tuition_fee_text'] = common.formatNumberWithSpaces(element.admissions[0].tuition_fee || '') - element['admission_deposit_text'] = common.formatNumberWithSpaces(element.admissions?.[0]?.admission_deposit ? element.admissions[0].admission_deposit + '' : '') + element['admission_deposit_text'] = common.formatNumberWithSpaces(element.admissions[0].admission_deposit || '') element['period'] = element.details.full_time_normal_year ? (element.details.full_time_normal_year + '年') : '_' @@ -563,9 +563,6 @@ Page({ } }, onShareTimeline() { - util.statistics({ - name: "share-timeline" - }) return { title: this.getShareTitle(), } diff --git a/pages/projectDetails/projectDetails.js b/pages/projectDetails/projectDetails.js index 9ec9788..c3f01c1 100644 --- a/pages/projectDetails/projectDetails.js +++ b/pages/projectDetails/projectDetails.js @@ -174,7 +174,7 @@ Page({ const data = res.data let admissionofficerin = data.admissionofficerin || [] - console.log("data", data); + // console.log("data", data); // data.info.tags = {} // data.info.rankings = [] // data.scholarships = [] @@ -399,12 +399,12 @@ Page({ admissions.forEach(element => { fields.forEach(field => { const textKey = `${field}_text`; - element[textKey] = common.formatNumberWithSpaces(element[field] ? element[field] + '' : ''); + element[textKey] = common.formatNumberWithSpaces(element[field] || ''); }); element['season'] = this.getIntakeSeason(element.intake_month, element.intake_year) element['interviewRounds'] = this.calculateInterviewRound(element.application_end || {}) - console.log("element", element); + // console.log("element", element); }) this.setData({ @@ -766,7 +766,8 @@ Page({ getOfferData() { if (this.data.offerPage == 0) return - util.wxget(`https://api.gter.net/v1/program/offerList?limit=10&projectid=${ this.data.info.id }&page=${ this.data.offerPage }`).then(res => { + const limit = this.data.offerPage == 1 ? 5 : 10 + util.wxget(`https://api.gter.net/v1/program/offerList?limit=${ limit }&projectid=${ this.data.info.id }&page=${ this.data.offerPage }`).then(res => { const data = res.data const list = data.list || [] let side = this.data.side @@ -842,9 +843,6 @@ Page({ } }, onShareTimeline() { - util.statistics({ - name: "share-timeline" - }) return { title: `【${ this.data.info.schoolalias || this.data.info.schoolname || '' }】 - ${this.data.info.name_zh}`, } @@ -916,7 +914,7 @@ Page({ list = (list).map(element => ({ ...element, semesterState: (year < element.semester.year) || (year === element.semester.year && month < element.semester.month), - tuition_fee_text: common.formatNumberWithSpaces(element.tuition_fee ? element.tuition_fee + '' : '') + tuition_fee_text: common.formatNumberWithSpaces(element.tuition_fee || '') })); let side = this.data.side diff --git a/pages/projectDetails/projectDetails.less b/pages/projectDetails/projectDetails.less index 26d4de9..f96b30f 100644 --- a/pages/projectDetails/projectDetails.less +++ b/pages/projectDetails/projectDetails.less @@ -657,6 +657,7 @@ navigator { .text { font-size: 24rpx; color: #555555; + margin-top: 5rpx; // margin-right: 20rpx; } @@ -999,7 +1000,7 @@ navigator { } .demand { - padding: 25.5rpx 22.5rpx 75rpx; + padding: 25.5rpx 22.5rpx 40rpx; // height: 800rpx; // overflow: hidden; diff --git a/pages/projectDetails/projectDetails.wxml b/pages/projectDetails/projectDetails.wxml index 16bb444..16401d3 100644 --- a/pages/projectDetails/projectDetails.wxml +++ b/pages/projectDetails/projectDetails.wxml @@ -157,6 +157,10 @@ 基本信息 + + + + {{ newest || '' }} @@ -294,7 +298,7 @@ {{ admission_requirementsObj.basic_requirements }} - + @@ -311,8 +315,8 @@ {{ admissionsObj.tuition_currency || 'HK$' }} - 总学费 {{ admissionsObj.tuition_fee_text || '待确认' }} + 总学费 @@ -345,7 +349,7 @@ {{ item.description }} 适用范围 - {{ item.is_local_eligible ? '本地生适用' : '' }}{{ item.is_nonlocal_eligible ? '非本地生适用' : '' }} + {{ item.is_local_eligible ? '本地生适用、' : '' }}{{ item.is_nonlocal_eligible ? '非本地生适用' : '' }} @@ -550,8 +554,8 @@ {{ item.view || 0 }} - - {{ item.ripostes || 0 }} + + {{ item.likenum || 0 }} @@ -585,7 +589,7 @@ - 相关链接 + diff --git a/pages/projectDetails/projectDetails.wxss b/pages/projectDetails/projectDetails.wxss index 31cdd18..5ffa685 100644 --- a/pages/projectDetails/projectDetails.wxss +++ b/pages/projectDetails/projectDetails.wxss @@ -545,6 +545,7 @@ navigator { .details-box .tuition .text { font-size: 24rpx; color: #555555; + margin-top: 5rpx; } .details-box .tuition .tuition-details { width: 300rpx; @@ -827,7 +828,7 @@ navigator { color: #333333; } .details-box .demand { - padding: 25.5rpx 22.5rpx 75rpx; + padding: 25.5rpx 22.5rpx 40rpx; position: relative; transition: all 0.3s; } diff --git a/pages/projectLibrary/projectLibrary.js b/pages/projectLibrary/projectLibrary.js index 46f6893..27bfaa7 100644 --- a/pages/projectLibrary/projectLibrary.js +++ b/pages/projectLibrary/projectLibrary.js @@ -503,9 +503,9 @@ Page({ this.indexSidebar.setData({ groupState: true, }) - util.statistics({ - name: "side-group" - }) + // util.statistics({ + // name: "side-group" + // }) }, indexSidebar: null, @@ -787,9 +787,6 @@ Page({ }, onShareTimeline() { - util.statistics({ - name: "share-timeline" - }) return { title: "聚焦港校项目,助你迈向国际名校之路!", } diff --git a/pages/projectList/projectList.js b/pages/projectList/projectList.js index 2f9193c..efddee6 100644 --- a/pages/projectList/projectList.js +++ b/pages/projectList/projectList.js @@ -70,7 +70,7 @@ Page({ } if (['subject', 'school'].includes(options.type)) { const isSubject = options.type === 'subject'; - const targetKey = isSubject ? 'maj' : 'com'; + const targetKey = isSubject ? 'majDefault' : 'comDefault'; const source = this.data[targetKey] || (isSubject ? {} : this.data.com); let updates = { jg: this.decodeKey(isSubject ? options.system : options.mechanism) || '', @@ -380,9 +380,6 @@ Page({ } }, onShareTimeline() { - util.statistics({ - name: "share-timeline" - }) return { title: "【寄托港校项目库】- 榜单", } @@ -396,6 +393,8 @@ Page({ this.setData({ [classify == "school" ? 'com' : 'maj']: detail, screenState: false, + comDefault:{}, + majDefault:{}, }) if (classify == "school") this.getSynthesizeData() diff --git a/pages/projectSchoolHomepage/projectSchoolHomepage.js b/pages/projectSchoolHomepage/projectSchoolHomepage.js index 814578d..5273f3f 100644 --- a/pages/projectSchoolHomepage/projectSchoolHomepage.js +++ b/pages/projectSchoolHomepage/projectSchoolHomepage.js @@ -643,10 +643,6 @@ Page({ } }, onShareTimeline() { - util.statistics({ - name: "share-timeline" - }) - return { title: "【寄托港校项目库】- " + this.data.info.name, } diff --git a/pages/projectSubjectList/projectSubjectList.js b/pages/projectSubjectList/projectSubjectList.js index bac842b..f90d3f8 100644 --- a/pages/projectSubjectList/projectSubjectList.js +++ b/pages/projectSubjectList/projectSubjectList.js @@ -263,7 +263,7 @@ Page({ }) query.exec((res) => { const data = res[0] - console.log("data", data); + // console.log("data", data); this.setData({ bezier: { x: data.left + data.width / 2 - this.rpx15, @@ -507,9 +507,6 @@ Page({ }, onShareTimeline() { - util.statistics({ - name: "share-timeline" - }) return { title: "【寄托港校项目库】 - 学科", path: `/pages/projectSubjectList/projectSubjectList?id=${ this.data.id }&sid=${ this.data.sid }`, diff --git a/pages/search/search.js b/pages/search/search.js index a0e8b11..957d879 100644 --- a/pages/search/search.js +++ b/pages/search/search.js @@ -223,14 +223,14 @@ Page({ if (this.data.loading || page == 0 || !kw) return this.data.loading = true // 代表是第一次搜索需要统计 - if (page == 1) { - util.statistics({ - name: "search", - data: { - kw - } - }) - } + // if (page == 1) { + // util.statistics({ + // name: "search", + // data: { + // kw + // } + // }) + // } wx.showLoading() let url = "/miniprogramApi/offer/search/lists" diff --git a/project.private.config.json b/project.private.config.json index 168304e..720bd9b 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -8,6 +8,13 @@ "condition": { "miniprogram": { "list": [ + { + "name": "pages/projectDetails/projectDetails", + "pathName": "pages/projectDetails/projectDetails", + "query": "uniqid=G5C00CznrKHP", + "launchMode": "default", + "scene": null + }, { "name": "pages/projectDetails/projectDetails", "pathName": "pages/projectDetails/projectDetails", diff --git a/utils/commonMethod.js b/utils/commonMethod.js index 2541cdd..ee22a59 100644 --- a/utils/commonMethod.js +++ b/utils/commonMethod.js @@ -68,7 +68,8 @@ function xgBasicData(that, app, isindex = false) { } function formatNumberWithSpaces(number) { - if (typeof number != 'string') number = '' + // if (typeof number != 'string') number = '' + if (Number(number) != number) return return number.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); } diff --git a/utils/miucms.js b/utils/miucms.js index 7ea5106..018520a 100644 --- a/utils/miucms.js +++ b/utils/miucms.js @@ -109,7 +109,8 @@ function sendData(code) { success: function (res) { var data = typeof res.data == 'string' ? JSON.parse(res.data) : res.data; - util.bindingUser(data.user) + // util.bindingUser(data.user) + wx.xstat && wx.xstat.setUserid(data.user.uid); // 登录后手动设置用户id , 如果有 // 将配置与用户session存于本地 // if (!data.session) { diff --git a/utils/util.js b/utils/util.js index 8b1c80e..c20017b 100644 --- a/utils/util.js +++ b/utils/util.js @@ -583,6 +583,7 @@ function statistics(obj) { // 判断是否登录 如果登录需要发送 绑定微信信息埋点 function bindingUser(user = {}) { + return if (user.uid <= 0) return; setTimeout(() => { statistics({ diff --git a/utils/xstat.js b/utils/xstat.js new file mode 100644 index 0000000..0a5a1a6 --- /dev/null +++ b/utils/xstat.js @@ -0,0 +1 @@ +"use strict";var e="[X-STAT] -- ",t=function(){var t=null,n=!1;return function(){return null===t&&(t=new function(){this.setDebug=function(e){n=e},this.d=function(){if(n)try{"string"==typeof arguments[0]&&(arguments[0]=e+arguments[0]),console.debug.apply(console,arguments)}catch(e){}},this.i=function(){try{if(n)try{"string"==typeof arguments[0]&&(arguments[0]=e+arguments[0]),console.info.apply(console,arguments)}catch(e){}}catch(e){}},this.e=function(){if(n)try{"string"==typeof arguments[0]&&(arguments[0]=e+arguments[0]),console.error.apply(console,arguments)}catch(e){}},this.w=function(){if(n)try{"string"==typeof arguments[0]&&(arguments[0]=e+arguments[0]),console.warn.apply(console,arguments)}catch(e){}},this.v=function(){if(n)try{"string"==typeof arguments[0]&&(arguments[0]=e+arguments[0]),console.log.apply(console,arguments)}catch(e){}},this.t=function(){if(n)try{console.table.apply(console,arguments)}catch(e){}},this.tip=function(){try{"string"==typeof arguments[0]&&(arguments[0]=e+arguments[0]),console.log.apply(console,arguments)}catch(e){}},this.tip_w=function(e){try{console.log("%c [UMENG] -- "+e,"background:red; padding: 4px; padding-right: 8px; border-radius: 4px; color: #fff;")}catch(e){}},this.err=function(){try{"string"==typeof arguments[0]&&(arguments[0]=e+arguments[0]),console.error.apply(console,arguments)}catch(e){}},this.repeat=function(e){for(var t=e;t.length<86;)t+=e;return t}}),t}}(),n=function(){var e=null;return function(){return e||(e=new function(){var e={};this.useOpenid=function(){return!!e.useOpenid},this.useSwanid=function(){return!!e.useSwanid},this.autoGetOpenid=function(){return!!e.autoGetOpenid},this.appKey=function(){return e.appKey},this.url=function(){return e.url},this.uploadUserInfo=function(){return e.uploadUserInfo},this.enableVerify=function(){return e.enableVerify},this.set=function(t){e=t},this.get=function(){return e},this.setItem=function(t,n){e[t]=n},this.getItem=function(t){return e[t]}}),e}}();function i(){}i.prototype={on:function(e,t,n){var r=this.e||(this.e={});return(r[e]||(r[e]=[])).push({fn:t,ctx:n}),this},once:function(e,t,n){var r=this;function i(){r.off(e,i),t.apply(n,arguments)}return i._=t,this.on(e,i,n)},emit:function(e){for(var t=[].slice.call(arguments,1),n=((this.e||(this.e={}))[e]||[]).slice(),r=0,i=n.length;rs?o+"*"+s:s+"*"+o,"function"==typeof e&&e(r)},fail:function(){"function"==typeof e&&e()}})},e.prototype.getDeviceInfo=function(e){"function"==typeof e&&e("")},e.prototype.checkNetworkAvailable=function(e){wx.getNetworkType({success:function(t){"function"==typeof e&&e(t&&"none"!==t.networkType)},fail:function(){"function"==typeof e&&e(!1)}})},e.prototype.getNetworkInfo=function(e){wx.getNetworkType({success:function(t){"function"==typeof e&&e({networkAvailable:"none"!==t.networkType,networkType:t.networkType})},fail:function(){"function"==typeof e&&e()}})},e.prototype.getDeviceId=function(e){e("")},e.prototype.getAdvertisingId=function(e){"function"==typeof e&&e("")},e.prototype.onNetworkStatusChange=function(e){wx.onNetworkStatusChange(function(t){"function"==typeof e&&e(t.isConnected)})},e.prototype.request=function(e){var t=e.success,n=e.fail,r=!1,i=null;e.success=function(e){r||(i&&clearTimeout(i),"function"==typeof t&&t(e))},e.fail=function(){r||(i&&clearTimeout(i),"function"==typeof n&&n(!1))},wx.request(e),i=setTimeout(function(){i&&clearTimeout(i),r=!0,"function"==typeof n&&n(r)},e.timeout||5e3)},e.prototype.getSdkType=function(){return"wxmp"},e.prototype.getPlatform=function(){return"wx"},e.prototype.getUserInfo=function(e){e()},e.prototype.getAppInfoSync=function(){if(wx.getAccountInfoSync){var e=wx.getAccountInfoSync(),t=e&&e.miniProgram?e.miniProgram:{};return{appId:t.appId,appEnv:t.envVersion,appVersion:t.version}}return{}},e.prototype.onShareAppMessage=function(e){wx.onShareAppMessage(e)},e.prototype.shareAppMessage=function(e){wx.shareAppMessage(e)},e.prototype.getLaunchOptionsSync=function(){var e=null;if(e)return e;if(!wx.getLaunchOptionsSync)return{};try{e=wx.getLaunchOptionsSync()}catch(t){e=null}return e||{}},e}()),s=function(e,t){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function a(e,t){function n(){this.constructor=e}s(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}console.log(e);var c,u={SESSION_INTERVAL:3e4,LOG_URL:"https://stat.x-php.com/stat",GET_OPENID_URL:"https://stat.x-php.com/stat/wx/getuut",USERINFO_URL:"https://stat.x-php.com/stat/comm/uif",FETCHURL:"https://stat.x-php.com/stat/fetch",GETVALUEURL:"https://stat.x-php.com/stat/getVlue",DEVICE_INFO_KEY:"device_info",ADVERTISING_ID:"mobile_ad_id",ANDROID_ID:"android_id",CURRENT_SESSION:"current_session",SESSION_PAUSE_TIME:"session_pause_time",EVENT_SEND_DEFAULT_INTERVAL:15e3,EVENT_LAST_SEND_TIME:"last_send_time",MAX_EVENTID_LENGTH:128,MAX_PROPERTY_KEY_LENGTH:256,MAX_PROPERTY_KEYS_COUNT:100,REPORT_POLICY:"report_policy",REPORT_INTERVAL_TIME:"report_interval_time",REPORT_POLICY_START_SEND:"1",REPORT_POLICY_INTERVAL:"6",IMPRINT:"imprint",SEED_VERSION:"1.0.0",IMPL_VERSION:"2.8.0",ALIPAY_AVAILABLE_VERSION:"10.1.52",SHARE_PATH:"xphp_share_path",SHARES:"shares",REQUESTS:"requests",UUID:"xphp_uuid",UUID_SUFFIX:"ud",OPENID:"xphp_od",UNIONID:"xphp_unid",ALIPAYID:"xphp_alipayid",USERID:"xphp_userid",SWANID:"xphp_swanid",ANONYMOUSID:"xphp_anonymousid",LAUNCH_OPTIONS:"LAUNCH_OPTIONS",XPHP_SSRC:"_xphp_ssrc",USER_INFO:"user_info",IS_ALIYUN:!1},f={isNumber:function(e){return!Number.isNaN(parseInt(e,10))},compareVersion:function(e,t){for(var n=String(e).split("."),r=String(t).split("."),i=0;is)return 1;if(oe.length)&&e.substr(0,t.length)===t},endsWith:function(e,t){return!(!t||0===e.length||t.length>e.length)&&e.substring(e.length-t.length)===t},assign:function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=1;n1&&f.startsWith(o.path,"/")&&(o.path=f.trimStart(o.path,"/"));var s=e.path||"",a=l().getId();if(a){var u=r.split(","),c=(u=u.filter(function(e){return e.length>0})).indexOf(a);c>=0&&(u=u.slice(0,c)),u.length<3&&u.push(a);var p=u.join(",");-1!==s.indexOf("?")?s+="&_xphp_ssrc="+p:s+="?_xphp_ssrc="+p;var h=Date.now();if(s+="&_xphp_sts="+h,i){var g=function(e){var t=[];for(var n in e)"_xphp_ssrc"!==n&&"_xphp_sts"!==n&&t.push(n+"="+e[n]);return t.join("&")}(d),v=g?g+"&_xphp_ssrc="+p+"&_xphp_sts="+h:"_xphp_ssrc="+p+"&_xphp_sts="+h;e.query=e.query?e.query+"&_xphp_ssrc="+p+"&_xphp_sts="+h:v}else e.path=s;o._xphp_ssrc=p,o._xphp_sts=h}return n.push(o),t().v("share: %o",e),e},setShareSource:function(e){r=e},clear:function(){n.length=0},get:function(){return n}}}),e}}(),v=function(e){if(e)try{return JSON.stringify(e)}catch(e){}return""},_=function(e){if(e)try{return JSON.parse(e)}catch(e){}return null},y=function(){var e=null,t="",r=null,i=!1;return function(){return e||(e=new function(){this.load=function(e){r?(o.removeStorage(t),e()):(t="xphp_cache_"+n().appKey(),o.getStorage(t,function(n){r=_(n)||{},i=!0,o.removeStorage(t),e()}))},this.save=function(){r&&o.setStorage(t,v(r))},this.set=function(e,t){r&&(r[e]=t)},this.get=function(e){return(r||{})[e]},this.remove=function(e){r&&r[e]&&delete r[e]},this.getAll=function(){return r},this.clear=function(){r=null},this.has=function(e){return!!this.get(e)},this.isLoaded=function(){return i}}),e}}(),m=function(){var e,n,r=[],i=[];function o(e,t){var r=(e=e||{})[n];return Array.isArray(r)&&r.length?e[n]=r.concat(t):e[n]=[].concat(t),e}return function(){return e||(e={addEvent:function(e){n?(r.unshift(e),r.length>1&&(!function(){if(r.length){var e=y().get("ekvs");(function(e){var t=0;for(var n in e)Array.isArray(e[n])&&(t+=e[n].length);return t})(e)+r.length<=1e4&&(e=o(e,r),y().set("ekvs",e))}}(),r.length=0)):(t().w("session id is null: ",n),i.unshift(e))},setSessionId:function(e){if(n=e,t().v("setSessionId: ",n),Array.isArray(i)&&i.length&&n){for(var r=0;ru.SESSION_INTERVAL?(i=!0,function(e){try{var n=(r||{}).options||{},i=f.assign({},function(e){var n={};for(var r in e)0===r.indexOf("_xphp_")&&(n[r]=e[r]);return t().v("query: ",e),t().v("_xphp_params: ",n),n}(e.query));i.path=e.path||n.path,"gaode"!==o.getPlatform()&&(i.scene=e.scene?o.getPlatform()+"_"+e.scene:n.scene);var s=e.referrerInfo;s&&(i.referrerAppId=s.appId),t().v("session options: ",i);var a=i[u.XPHP_SSRC];a&&g().setShareSource(a);var c=Date.now();r={id:f.getRandomStr(10)+c,start_time:c,options:i}}catch(e){t().e("生成新session失败: ",e)}}(e),t().v("开始新的session(%s): ",r.id,r)):t().v("延续上一次session(%s): %s ",r.id,s.toLocaleTimeString(),r),i},pause:function(){!function(){if(r){var e=new Date;r.end_time=e.getTime(),"number"!=typeof r.duration&&(r.duration=0),r.duration=r.end_time-n,y().set(u.CURRENT_SESSION,r),t().v("退出会话(%s): %s ",r.id,e.toLocaleTimeString(),r)}}()},getCurrentSessionId:function(){return(r||{}).id},getCurrentSession:function(){return r},cloneCurrentSession:function(){return f.clone(r)}}),e}}();function b(e){var t=null;switch(e){case A:t=function(){var e=null,t=k().cloneCurrentSession();return t&&(e={header:{st:"1"},analytics:{sessions:[t]}}),e}();break;case E:t=function(){var e=null,t={},n=k().cloneCurrentSession();if(n){var r=h().get(),i=g().get();Array.isArray(r)&&r.length&&(n.pages=f.clone(r)),Array.isArray(i)&&i.length&&(n.shares=f.clone(i)),h().clear(),g().clear(),t.sessions=[n]}var o=m().getEkvs();return o&&(t.ekvs=f.clone(o),m().clear()),(t.sessions||t.ekvs)&&(e={analytics:t}),e}();break;case N:t=function(){var e=null,t=m().getEkvs();return t&&(e={analytics:{ekvs:f.clone(t)}},m().clear()),e}()}return t}var D={sessions:"sn",ekvs:"e",active_user:"active_user"},U={sdk_type:"sdt",access:"ac",access_subtype:"acs",device_model:"dm",language:"lang",device_type:"dt",device_manufacturer:"dmf",device_name:"dn",platform_version:"pv",id_type:"it",font_size_setting:"fss",os_version:"ov",device_manuid:"did",platform_sdk_version:"psv",device_brand:"db",appkey:"ak",_id:"id",id_tracking:"itr",imprint:"imp",sdk_version:"sv",resolution:"rl",testToken:"ttn",theme:"t5",benchmark_level:"bml",screen_width:"sw",screen_height:"sh",status_bar_height:"sbh",safe_area_top:"sat",safe_area_left:"sal",safe_area_right:"sar",safe_area_bottom:"sab",safe_area_height:"sah",safe_area_width:"saw",pixel_ratio:"pr",storage:"s7",host:"hs"},P={uuid:"ud",unionid:"und",openid:"od",anonymousid:"nd",alipay_id:"ad",device_id:"dd",userid:"puid"};function R(e,t){var n=L(e,t);return e&&e.id_tracking&&(n[t.id_tracking||"id_tracking"]=L(e.id_tracking,P)),n}function L(e,t){var n={};for(var r in e)t[r]?n[t[r]]=e[r]:n[r]=e[r];return n}function C(e,t){var n={};if(e)for(var r in e)e[r]&&(n[t[r]]=e[r]);return n}var M="";function x(){return M}var V="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",j=function(e){for(var t={},n=0,r=e.length;n>>6)+F(128|63&t):F(224|t>>>12&15)+F(128|t>>>6&63)+F(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return F(240|t>>>18&7)+F(128|t>>>12&63)+F(128|t>>>6&63)+F(128|63&t)},q=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,K=function(e){var t=[0,2,1][e.length%3],n=e.charCodeAt(0)<<16|(e.length>1?e.charCodeAt(1):0)<<8|(e.length>2?e.charCodeAt(2):0);return[V.charAt(n>>>18),V.charAt(n>>>12&63),t>=2?"=":V.charAt(n>>>6&63),t>=1?"=":V.charAt(63&n)].join("")},H=function(e){return function(e){return e.replace(q,G)}(e).replace(/[\s\S]{1,3}/g,K)},Y=new RegExp(["[À-ß][€-¿]","[à-ï][€-¿]{2}","[ð-÷][€-¿]{3}"].join("|"),"g"),J=function(e){switch(e.length){case 4:var t=((7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3))-65536;return F(55296+(t>>>10))+F(56320+(1023&t));case 3:return F((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return F((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},B=function(e){var t=e.length,n=t%4,r=(t>0?j[e.charAt(0)]<<18:0)|(t>1?j[e.charAt(1)]<<12:0)|(t>2?j[e.charAt(2)]<<6:0)|(t>3?j[e.charAt(3)]:0),i=[F(r>>>16),F(r>>>8&255),F(255&r)];return i.length-=[0,0,2,1][n],i.join("")},X=function(e){return function(e){return e.replace(/[\s\S]{1,4}/g,B)}(e).replace(Y,J)},W=function(e,t){return t?H(String(e)).replace(/[+\/]/g,function(e){return"+"==e?"-":"_"}).replace(/=/g,""):H(String(e))},z=function(e){return X(String(e).replace(/[-_]/g,function(e){return"-"==e?"+":"/"}).replace(/[^A-Za-z0-9\+\/]/g,""))},Q=new function(){var e="",t=this;this.set=function(t){e=t},this.get=function(){return e},this.getImpObj=function(){return _(z(e))},this.getItem=function(e){var n=t.getImpObj();return n&&n[e]||""},this.load=function(){e=y().get(u.IMPRINT)},this.save=function(){e&&y().set(u.IMPRINT,e)}};function Z(e,n,r,i){w.instance().setIdType(l().getIdType()),w.instance().setIdTracking(l().getIdTracking());var s=l().getUserId();s&&e.analytics&&(e.analytics.active_user={uid:s});var a=f.clone(w.instance().get());e.header=f.assign(a,e.header,{ts:Date.now(),testToken:x(),traceId:f.getRandomStr(10)+Date.now()+f.getRandomStr(9)});var c=function(e){return{h:R(e.header,U),a:C(e.analytics,D)}}(e),p=v(c),h={url:u.LOG_URL,method:"POST",data:c,success:function(i){var o=i.code||i.status||i.statusCode;200===o||413===o?(t().i("数据发送成功: ",e,p),function(e){e&&(w.instance().setItem(u.IMPRINT,e),Q.set(e),Q.save(),t().v("imprint: ",Q.getImpObj()),Q.getItem("ttn_invalid")&&(M=""))}((i.data||{}).imprint),"function"==typeof n&&n(i)):(t().w("数据发送失败: ",p),"function"==typeof r&&r())},fail:function(e){t().w("超时: ",p),"function"==typeof r&&r()},complete:function(){"function"==typeof i&&i()}};o.request(f.assign(h,{header:{"Msg-Type":o.getSdkType()+"/json","disable-base64":"Y"}}))}function $(e){var t=e,n=[];this.enqueue=function(e){"number"==typeof t&&this.size()>=t&&this.dequeue(),n.push(e)},this.dequeue=function(){return n.shift()},this.front=function(){return n[0]},this.isEmpty=function(){return 0===n.length},this.clear=function(){n.length=0},this.size=function(){return n.length},this.items=function(){return n},this.print=function(){console.log(n.toString())}}var ee=function(){var e=null,n=!1,r=[],i=new $(50);function o(e){l().getId()?n?t().i("队列正在发送中"):(n=!0,function e(t){var n=i.front();n?Z(n,function(){i.dequeue(),e(t)},function(){var n=i.dequeue();n&&!n.noCache&&r.push(n),e(t)}):(r.forEach(function(e){i.enqueue(e)}),r.length=0,t())}(function(){n=!1,"function"==typeof e&&e()})):(t().i("获取id标识失败,暂缓发送"),"function"==typeof e&&e())}function s(){this.send=function(e,t,n){e?this.add(e,t,function(){o(n)}):o(n)},this.add=function(e,t,n){!function e(t,n,r){if(w.instance().isLoaded()){n=n||{};var o=b(t);if(o){var s=w.instance().getRealtimeFields();o.header=f.assign({},o.header,s),o.noCache=n.noCache,i.enqueue(o)}"function"==typeof r&&r()}else setTimeout(function(){e(t,n,r)},100)}(e,t,n)},this.load=function(){var e=y().get(u.REQUESTS);e&&e.length&&e.forEach(function(e){i.enqueue(e)}),y().remove(u.REQUESTS)},this.save=function(){y().set(u.REQUESTS,f.clone(i.items())),i.clear()}}return function(){return e||(e=new s),e}}(),te=function(){var e=null,r=null;return function(){return e||(e=new function(){function e(e){if(e&&"object"==typeof e){var r=y().get(u.USER_INFO);return r&&f.deepEqual(e,r)||function(e,r){var i=n().appKey(),s=o.getSdkType(),a=l().getId(),c=l().getIdType();if(i&&s&&a&&c){var f={ak:n().appKey(),sdt:o.getSdkType(),uin:e.nickName,uia:e.avatar||e.avatarUrl,uig:e.gender,uit:e.country,uip:e.province,uic:e.city,uil:e.language,id:l().getId(),it:l().getIdType(),age:e.age,cln:e.constellation},p=JSON.stringify(f);p=W(p),o.request({url:u.USERINFO_URL,method:"POST",header:{"content-type":"application/x-www-form-urlencoded"},data:"ui="+p,success:function(n){t().v("用户信息上传成功: ",e),r&&r(n&&n.data&&200===n.data.code)},fail:function(){t().e("用户信息上传失败: ",e),r&&r(!1)}})}}(e,function(t){t&&y().set(u.USER_INFO,e)}),!0}return!1}this.setUserInfo=function(e){r=e},this.update=function(){e(r)||o.getUserInfo(function(t){e(t)})}}),e}}();function ne(e,t){this.id=e,this.ts=Date.now();var n=typeof t;if("string"===n&&t)this[e]=t;else if("object"===n)for(var r in t)({}).hasOwnProperty.call(t,r)&&(this[r]=t[r])}function ie(){var e=!1,r=!1,i=0;this.init=function(r){t().v("sdk version: "+u.IMPL_VERSION),e?t().v("Lib重复实例化"):y().load(function(){t().v("cache初始化成功: ",y().getAll()),l().setUseOpenid&&l().setUseOpenid(n().useOpenid()),l().init(function(){w.instance().init(),t().v("Header初始化成功")}),e=!0,"function"==typeof r&&r(),t().tip("SDK集成成功")})},this.resume=function(i){var o;e&&!r&&(t().v("showOptions: ",i),r=!0,n().enableVerify()&&i&&i.query&&(o=i.query._ttn,M=o||M),this._resume(i))},this._resume=function(e){ee().load();var r=k().resume(e),i=k().getCurrentSessionId();m().setSessionId(i),r&&ee().add(A,{},function(){l().setUseOpenid&&l().setUseOpenid(n().useOpenid()),n().useOpenid()&&n().autoGetOpenid()&&!l().getId()?(t().v("get id async"),function e(r,i){l().getId()||r<=0||l().getOpenIdAsync(n().appKey(),function(n){n?(t().v("获取id成功"),ee().send()):(t().v("获取openid失败,启动重试,剩余可用次数",r-1),setTimeout(function(){e(r-1,i)},i))})}(10,3e3)):(t().v("session auto send"),ee().send())})},this.pause=function(o){e&&(r=!1,i=0,k().pause(),n().uploadUserInfo()&&te().update(),ee().send(E,{},function(){ee().save(),y().save(),t().v("cache save success"),"function"==typeof o&&o()}))},this.setOpenid=function(e){t().v("setOpenId: %s",e),l().setOpenid(e),ee().send()},this.setUnionid=function(e){t().v("setUnionid: %s",e),l().setUnionid(e)},this.setUserid=function(e,n){t().v("setUserid: %s",e,n),l().setUserid(e,n)},this.removeUserid=function(){t().v("removeUserid"),l().removeUserid()},this.setUserInfo=function(e){t().v("setUserInfo: %s",e),te().setUserInfo(e)},this.setAnonymousid=function(e){t().v("setAnonymousId: %s",e),l().setAnonymousid(e),ee().send()},this.setAppVersion=function(e){e&&"string"!=typeof e?t().w("setAppVersion方法只接受字符串类型参数"):w.instance().setAppVersion(e)},this.setAlipayUserid=function(e){e&&"string"!=typeof e?t().w("setAlipayUserid方法只接受字符串类型参数"):(t().v("setAlipayUserid: %s",e),l().setAlipayUserid(e))},this.setDeviceId=function(e){if("string"==typeof e)return l().setDeviceId(e),e},this.setSuperProperty=function(e){if(e&&"string"!=typeof e)t().w("超级属性只支持字符串类型");else{var n=this;w.instance().getSuperProperty()!==e&&(w.instance().setSuperProperty(e),n.pause(function(){n.resume()}))}},this.trackEvent=function(n,r){if(e&&(t().v("event: ",n,r),function(e,n){if(!e||"string"!=typeof e)return t().e('please check trackEvent id. id should be "string" and not null'),!1;var r=["id","ts","du"],i={};if(r.forEach(function(e){i[e]=1}),i[e])return t().e("eventId不能与以下保留字冲突: "+r.join(",")),!1;if(e.length>u.MAX_EVENTID_LENGTH)return t().e("The maximum length of event id shall not exceed "+u.MAX_EVENTID_LENGTH),!1;if(n&&("object"!=typeof n||Array.isArray(n))&&"string"!=typeof n)return t().e("please check trackEvent properties. properties should be string or object(not include Array)"),!1;if("object"==typeof n){var o=0;for(var s in n)if({}.hasOwnProperty.call(n,s)){if(s.length>u.MAX_PROPERTY_KEY_LENGTH)return t().e("The maximum length of property key shall not exceed "+u.MAX_PROPERTY_KEY_LENGTH),!1;if(o>=u.MAX_PROPERTY_KEYS_COUNT)return t().e("The maximum count of properties shall not exceed "+u.MAX_PROPERTY_KEYS_COUNT),!1;if(i[s])return t().e("属性中的key不能与以下保留字冲突: "+r.join(",")),!1;o+=1}}return!0}(n,r))){var o=new ne(n,r);m().addEvent(o);var s=!!x(),a=s?0:u.EVENT_SEND_DEFAULT_INTERVAL,c=Date.now();("number"!=typeof i||"number"!=typeof a||i<=0||c-i>a)&&(i=c,ee().send(N,{noCache:s},function(){}))}},this.trackShare=function(n){if(e)try{o.getSdkType().indexOf("game")>-1?(n=g().add(n,!0),t().v("shareQuery: ",n)):(n=g().add(n,!1),t().v("sharePath: ",n.path))}catch(e){t().v("shareAppMessage: ",e)}return n},this.trackPageStart=function(t){e&&h().addPageStart(t)},this.trackPageEnd=function(t){e&&h().addPageEnd(t)},this.onShareAppMessage=function(e){var t=this;o.onShareAppMessage(function(){return t.trackShare(e())})},this.shareAppMessage=function(e){this.trackShare(e),o.shareAppMessage(e)}}var re=[];function oe(){}oe.prototype={createMethod:function(e,n,r){try{e[n]=r&&r[n]?function(){return r[n].apply(r,arguments)}:function(){re.push([n,[].slice.call(arguments)])}}catch(e){t().v("create method errror: ",e)}},installApi:function(e,n){try{var r,i,o="resume,pause,trackEvent,trackPageStart,trackPageEnd,trackShare,setUserid,setOpenid,setUnionid,setSuperProperty,setUserInfo".split(",");for(r=0,i=o.length;r