From a756e706e48c11f46c256cd00c638bec8a8f8ad9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=B6=E5=A3=AB=E6=B6=B5?= <630892807@qq.com> Date: Sat, 27 Feb 2021 22:47:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AF=BC=E5=85=A5=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=81=87=E5=88=B0=E9=94=99=E8=AF=AF=E9=80=80=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/install.go | 1 + models/models.go | 3 +-- static/html/main.html | 5 +++++ static/html/nav.html | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/cmd/install.go b/cmd/install.go index 3f7629e..f418805 100644 --- a/cmd/install.go +++ b/cmd/install.go @@ -39,6 +39,7 @@ func install() { log.Println(sql, "\t success!") } else { log.Println(sql, err, "\t failed!") + os.Exit(1) } } } diff --git a/models/models.go b/models/models.go index 696552a..e9afaea 100644 --- a/models/models.go +++ b/models/models.go @@ -36,8 +36,7 @@ func init() { InitConfig() } func Execute(sql string) error { - DB.Exec(sql) - return DB.Error + return DB.Exec(sql).Error } func CloseDB() { defer DB.Close() diff --git a/static/html/main.html b/static/html/main.html index c0d112f..ed55739 100644 --- a/static/html/main.html +++ b/static/html/main.html @@ -89,6 +89,11 @@ openIframeUrl(url){ this.iframeUrl=url; }, + //退出 + logout(){ + localStorage.removeItem("token"); + this.openIframeUrl('/login'); + }, //跳转 openUrl(url){ window.location.href=url; diff --git a/static/html/nav.html b/static/html/nav.html index 09fa8f1..4c561e2 100644 --- a/static/html/nav.html +++ b/static/html/nav.html @@ -16,7 +16,7 @@ - + 退出