|
@@ -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())
|
|
|
/* 智齿客服 */
|