diff --git a/config/go-fly.sql b/config/go-fly.sql index af0108b..01e06f9 100644 --- a/config/go-fly.sql +++ b/config/go-fly.sql @@ -109,6 +109,7 @@ CREATE TABLE `config` ( INSERT INTO `config` (`id`, `conf_name`, `conf_key`, `conf_value`) VALUES (NULL, '是否开启Server酱微信提醒', 'NoticeServerJiang', 'false')| INSERT INTO `config` (`id`, `conf_name`, `conf_key`, `conf_value`) VALUES (NULL, 'Server酱API', 'ServerJiangAPI', '')| INSERT INTO `config` (`id`, `conf_name`, `conf_key`, `conf_value`) VALUES (NULL, '微信小程序Token', 'WeixinToken', '')| +INSERT INTO `config` (`id`, `conf_name`, `conf_key`, `conf_value`) VALUES (NULL, '首页跳转语言', 'JumpLang', 'cn')| DROP TABLE IF EXISTS `about`| CREATE TABLE `about` ( diff --git a/controller/index.go b/controller/index.go index 03ca685..9e44038 100644 --- a/controller/index.go +++ b/controller/index.go @@ -2,29 +2,13 @@ package controller import ( "github.com/gin-gonic/gin" - "github.com/taoshihan1991/imaptool/tools" - "net/http" + "github.com/taoshihan1991/imaptool/models" ) func Index(c *gin.Context) { - c.Redirect(302, "/index_en") -} - -//首页跳转 -func ActionIndex(w http.ResponseWriter, r *http.Request) { - if r.URL.RequestURI() == "/favicon.ico" { - return - } - - mailServer := tools.GetMailServerFromCookie(r) - if mailServer == nil { - http.Redirect(w, r, "/login", 302) - } else { - res := tools.CheckEmailPassword(mailServer.Server, mailServer.Email, mailServer.Password) - if res { - http.Redirect(w, r, "/main", 302) - } else { - http.Redirect(w, r, "/login", 302) - } + jump := models.FindConfig("JumpLang") + if jump != "cn" { + jump = "en" } + c.Redirect(302, "/index_"+jump) }