소스 검색

feat:知识库问题

wangxiaogang 3 년 전
부모
커밋
6bc7f8b9d2
2개의 변경된 파일92개의 추가작업 그리고 0개의 파일을 삭제
  1. 46 0
      src/jfw/modules/app/src/web/templates/me/customer.html
  2. 46 0
      src/web/templates/big-member/wx/page_customer.html

+ 46 - 0
src/jfw/modules/app/src/web/templates/me/customer.html

@@ -36,6 +36,52 @@
 <!--S-当前页面的资源-->
 <script src=//cdn-common.jianyu360.com/cdn/lib/jquery/3.6.0/jquery.min.js></script>
 {{include "/big-member/commonjs.html"}}
+<script>
+  // 客服地址分流
+    // 重置本地人工客服地址
+    function refreshData (res) {
+      const myDate = new Date()
+      const nowDate =  myDate.getFullYear()+'/'+(myDate.getMonth() + 1)+'/'+myDate.getDate()
+      const params = {
+        lastTime: nowDate,
+        url: res.data.url
+      }
+      localStorage.setItem('getParams', JSON.stringify(params))
+      location.href = params.url
+    }
+    const typeModel = JSON.stringify({
+      type: 'APP'
+    })
+    $.post({
+      url: '/message/obtainShunt',
+      contentType: 'application/json',
+      data: typeModel,
+      success: function(res) {
+        console.log(res)
+        if (res && res.error_code === 0) {
+        // isShunt为true,标识要分流,先查本地是否有地址
+        if (res.data.isShunt) {
+          // 判断当前时间是否与缓存时间是同一天,是:取缓存url,不是:取接口url
+          const myDate = new Date()
+          const nowDate =  myDate.getFullYear()+'/'+(myDate.getMonth() + 1)+'/'+myDate.getDate()
+          let getParams = localStorage.getItem('getParams')
+          if (getParams) {
+            getParams = JSON.parse(getParams)
+            if (nowDate === getParams.nowDate ) {
+              location.href = getParams.url
+            } else {
+              refreshData(res)
+            }
+          } else {
+            refreshData(res)
+          }
+        } else {
+          location.href = res.data.url
+        }
+      }
+      }
+    })
+</script>
 <script>
     $.get('/jyapp/front/app/sobot?t='+new Date().getTime())
     /* 智齿客服 */

+ 46 - 0
src/web/templates/big-member/wx/page_customer.html

@@ -46,6 +46,52 @@
 <!--S-当前页面的资源-->
 <script src='{{Msg "seo" "cdn"}}/js/rem.js'></script>
 <script src=//cdn-common.jianyu360.com/cdn/lib/jquery/3.6.0/jquery.min.js></script>
+<script>
+  // 客服地址分流
+    // 重置本地人工客服地址
+    function refreshData (res) {
+      const myDate = new Date()
+      const nowDate =  myDate.getFullYear()+'/'+(myDate.getMonth() + 1)+'/'+myDate.getDate()
+      const params = {
+        lastTime: nowDate,
+        url: res.data.url
+      }
+      localStorage.setItem('getParams', JSON.stringify(params))
+      location.href = params.url
+    }
+    const typeModel = JSON.stringify({
+      type: 'WX'
+    })
+    $.post({
+      url: '/message/obtainShunt',
+      contentType: 'application/json',
+      data: typeModel,
+      success: function(res) {
+        console.log(res)
+        if (res && res.error_code === 0) {
+        // isShunt为true,标识要分流,先查本地是否有地址
+        if (res.data.isShunt) {
+          // 判断当前时间是否与缓存时间是同一天,是:取缓存url,不是:取接口url
+          const myDate = new Date()
+          const nowDate =  myDate.getFullYear()+'/'+(myDate.getMonth() + 1)+'/'+myDate.getDate()
+          let getParams = localStorage.getItem('getParams')
+          if (getParams) {
+            getParams = JSON.parse(getParams)
+            if (nowDate === getParams.nowDate ) {
+              location.href = getParams.url
+            } else {
+              refreshData(res)
+            }
+          } else {
+            refreshData(res)
+          }
+        } else {
+          location.href = res.data.url
+        }
+      }
+      }
+    })
+</script>
 <script>
     $.get('/front/wx/sobot?t='+new Date().getTime())
     /* 智齿客服 */