$(function(){ postini(); }); function postini(){ $.ajax({ url : getRootPath() + "-s1api" + '/ini/getstyle', type : "POST", // 用POST方式传输 contentType : "application/json; charset=utf-8", dataType : "Json", data: JSON.stringify(postiniDate()), success: function(msg) { var resCode = msg["resultCode"]; if(resCode == "0000"){ //var festival = msg["festival"]; //theme(festival["title"], festival["icon"]);加载页面信息头,图标 var productlist = msg["product"]; for(var i=0,l=productlist.length;i= 0) { burypointLogId('110002');// 退订页面pv, pv去重得到uv } else if (location.href.indexOf('/draw') >= 0) { burypointLogId('110003');// 领取页面pv, pv去重得到uv } else if (location.href.indexOf('/flow') >= 0) { burypointLogId('110004');// 流量查询pv, pv去重得到uv } else if (location.href.indexOf('/active') >= 0) { burypointLogId('110005');// 激活页面pv, pv去重得到uv } else { // location.href.indexOf('/index') >= 0 // location.href.indexOf('/order') >= 0 burypointLogId('110001');// 订购页面pv, pv去重得到uv } }, error: function(XMLHttpRequest, textStatus,errorThrown){//加载请求失败 goto404(); }, }); } function postiniDate() { var data = { fes : getUrlParam("fes"), sou : getUrlParam("sou"), }; return data; } (function () { Date.prototype.from = function (dateString) { var pattern2 = /(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/ var str = dateString.replace(/-/g, '/'); str = str.replace(pattern2, '$1/$2/$3 $4:$5:$6') return new Date(str) } // 对Date的扩展,将 Date 转化为指定格式的String // 月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符, // 年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字) // 例子: // (new Date()).Format("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423 // (new Date()).Format("yyyy-M-d h:m:s.S") ==> 2006-7-2 8:9:4.18 Date.prototype.format = function (fmt) { //author: meizz var o = { "M+": this.getMonth() + 1, //月份 "d+": this.getDate(), //日 "h+": this.getHours(), //小时 "m+": this.getMinutes(), //分 "s+": this.getSeconds(), //秒 "q+": Math.floor((this.getMonth() + 3) / 3), //季度 "S": this.getMilliseconds() //毫秒 }; if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length)); for (var k in o) if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length))); return fmt; } })(); function getTodaySurplusMillis() { var time1 = new Date(); var time2 = time1.from(time1.getFullYear() + '-' + (time1.getMonth() + 1) + '-' + time1.getDate() + ' 23:59:59'); console.log(time2.getTime() - time1) return time2.getTime() - time1.getTime(); } function burypointLogId(operid, remark, url) { var uuid = getCookie('uuid');// uv var vvid = getCookie('vvid');// vv if (uuid == null || uuid.trim() == '') { uuid = guid(); setCookie('uuid', uuid, getTodaySurplusMillis()); } if (vvid == null || vvid.trim() == '') { vvid = guid(); setCookie('vvid', vvid, -1); } if (operid == null || operid == '') { // 页面的埋点不通过/burypoint/logid接口实现,通过文件日志入库方式 return; } var param = { operid: operid, uuid: uuid, vvid: vvid, fog: getMemoValbyId('xx', 'fog'),//学习强国 userid: '', fes: getUrlParam("fes"), sou: getUrlParam("sou"), url: encodeURIComponent(url||window.location.href), remark: encodeURIComponent(remark||'') } $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", dataType: "Json", url: getRootPath() + "-s1api" + '/burypoint/logid',//目标地址 data: JSON.stringify(param), success: function () {}, error: function () {}, }); } function getCookie(name) { var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)"); if(arr=document.cookie.match(reg)) return unescape(arr[2]); else return null; } /** * 如果没有设置时间 */ function setCookie(name, value, millis) { millis = (millis == undefined ? 0 : millis); var exp = new Date(); if (millis < 0) { document.cookie = name + "=" + escape(value); } else { exp.setTime(exp.getTime() + millis); document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString(); } } function guid() { return 'xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx'.replace(/[xy]/g, function(c) { var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8); return v.toString(16); }); }