添加服务器 & 展示服务器

This commit is contained in:
奶爸
2019-12-08 23:18:29 +08:00
parent d8c4364653
commit 1b18e7103e
13 changed files with 149 additions and 38 deletions

View File

@@ -1,8 +1,12 @@
package controller
import (
"net/http"
"github.com/gin-gonic/gin"
"github.com/p14yground/nezha/model"
"github.com/p14yground/nezha/pkg/mygin"
"github.com/p14yground/nezha/service/dao"
)
type memberPage struct {
@@ -18,4 +22,14 @@ func (mp *memberPage) serve() {
Btn: "点此登录",
Redirect: "/login",
}))
mr.GET("/server", mp.server)
}
func (mp *memberPage) server(c *gin.Context) {
var servers []model.Server
dao.DB.Find(&servers)
c.HTML(http.StatusOK, "page/server", mygin.CommonEnvironment(c, gin.H{
"Title": "服务器管理",
"Servers": servers,
}))
}