初步搭建02

This commit is contained in:
des
2026-01-13 13:02:27 +08:00
parent 0c68d57180
commit a289a90676
3 changed files with 45 additions and 19 deletions

View File

@@ -4,14 +4,29 @@ import (
"net/http"
"github.com/labstack/echo"
"gorm.io/gorm"
)
type Controller struct{}
type Controller struct {
client *gorm.DB
group string
}
func (Controller) GetLogin(ctx echo.Context) error {
func (*Controller) GetLogin(ctx echo.Context) error {
return ctx.String(http.StatusOK, "success")
}
func New() *Controller {
return &Controller{}
func (s *Controller) RegisterRoute(echo *echo.Echo) {
echo.GET("/login", s.GetLogin)
}
// New 获取用户模块的控制器
//
// 参数
// - gorm.DB 该模块所使用的数据库链接
//
// 返回值
// - Controller 控制器的实例指针
func New(client *gorm.DB) *Controller {
return &Controller{client}
}