初步搭建02
This commit is contained in:
@@ -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}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user