Browse Source

Merge branch 'dev/v4.8.35.1_cyl' of qmx/jy into hotfix/v4.8.35.1

zhangyuhan 2 years ago
parent
commit
1cd120d7ba
1 changed files with 10 additions and 2 deletions
  1. 10 2
      src/web/staticres/common-module/public/head.js

+ 10 - 2
src/web/staticres/common-module/public/head.js

@@ -1,13 +1,21 @@
 ;(function() {
   var host = location.host
   var hm = document.createElement("script");
+  // 去除query后的location
+  var uLocation = location.host + location.pathname
   var patterns = {
     ip: /((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})(\.((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})){3}/g,
-    testServer: /jianyu360\.cn$/g
+    productionMain: /jianyu360\.cn$/g, // 主站
+    pcCMS: /jianyu360\.cn\/jycms/g, // pcCMS
   }
-  if (patterns.ip.test(host) || patterns.testServer.test(host)) {
+  if (patterns.pcCMS.test(uLocation)) {
+    // 剑鱼PC端CMS专用百度统计
+    hm.src = "https://hm.baidu.com/hm.js?32344152a6d39fdf42b2a171d0a8eab7";
+  } else if (patterns.productionMain.test(host)) {
+    // 主站百度统计
     hm.src = "https://hm.baidu.com/hm.js?52c42de35032567eb9d7a24a43c84bda";
   } else {
+    // 测试环境和其他百度统计
     hm.src = "https://hm.baidu.com/hm.js?72331746d85dcac3dac65202d103e5d9";
   }
   setTimeout(function(){