gin路由分组 路由文件抽离
gin自定义控制器 实现控制器的继承
This commit is contained in:
10
controller/admin/articleController.go
Normal file
10
controller/admin/articleController.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package admin
|
||||
|
||||
import "github.com/gin-gonic/gin"
|
||||
|
||||
type ArticleController struct {
|
||||
}
|
||||
|
||||
func (con ArticleController) Article(c *gin.Context) {
|
||||
c.String(200, "管理员文章列表")
|
||||
}
|
||||
18
controller/admin/indexController.go
Normal file
18
controller/admin/indexController.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package admin
|
||||
|
||||
import "github.com/gin-gonic/gin"
|
||||
|
||||
type IndexController struct {
|
||||
}
|
||||
|
||||
func (con IndexController) Index(c *gin.Context) {
|
||||
c.String(200, "管理员用户列表")
|
||||
}
|
||||
|
||||
func (con IndexController) Plist(c *gin.Context) {
|
||||
c.String(200, "管理员用户详情")
|
||||
}
|
||||
|
||||
func (con IndexController) Login(c *gin.Context) {
|
||||
c.String(200, "管理员登录页面")
|
||||
}
|
||||
14
controller/admin/userController.go
Normal file
14
controller/admin/userController.go
Normal file
@@ -0,0 +1,14 @@
|
||||
package admin
|
||||
|
||||
import "github.com/gin-gonic/gin"
|
||||
|
||||
type UserController struct {
|
||||
}
|
||||
|
||||
func (con UserController) Index(c *gin.Context) {
|
||||
c.String(200, "管理员用户列表")
|
||||
}
|
||||
|
||||
func (con UserController) Show(c *gin.Context) {
|
||||
c.String(200, "管理员用户详情")
|
||||
}
|
||||
Reference in New Issue
Block a user