diff --git a/controller/mysql.go b/controller/mysql.go index e6b7353..0661fef 100644 --- a/controller/mysql.go +++ b/controller/mysql.go @@ -1,10 +1,17 @@ package controller import ( + "github.com/gin-gonic/gin" "github.com/taoshihan1991/imaptool/tmpl" "net/http" ) +func MysqlGetConf(c *gin.Context) { + c.JSON(200, gin.H{ + "code": 200, + "msg": "验证成功", + }) +} func ActionMysqlSet(w http.ResponseWriter, r *http.Request) { render := tmpl.NewSettingHtml(w) render.SetLeft("setting_left") diff --git a/server.go b/server.go index f9df902..c19eef3 100644 --- a/server.go +++ b/server.go @@ -31,6 +31,11 @@ func main() { engine.POST("/check_auth",middleware.JwtApiMiddleware, controller.MainCheckAuth) //前后聊天 engine.GET("/chat_server", controller.NewChatServer) + //设置页 + engine.GET("/setting", tmpl.PageSetting) + //设置mysql + engine.GET("/setting_mysql", tmpl.PageSettingMysql) + engine.GET("/get_setting_mysql",middleware.JwtApiMiddleware, controller.MysqlGetConf) //------------------old code----------------------------- mux := &http.ServeMux{} //根路径 diff --git a/static/html/header.html b/static/html/header.html index 656d017..2d9e028 100644 --- a/static/html/header.html +++ b/static/html/header.html @@ -1,3 +1,4 @@ +{{define "header"}} @@ -51,4 +52,5 @@ - \ No newline at end of file + +{{end}} \ No newline at end of file diff --git a/static/html/setting.html b/static/html/setting.html index 69a7a67..3511d4f 100644 --- a/static/html/setting.html +++ b/static/html/setting.html @@ -1,9 +1,9 @@ -{{.Header}} +{{template "header" }}