mirror of
https://gitee.com/dromara/mayfly-go
synced 2026-01-01 04:06:37 +08:00
refactor: 包名变更ctx -> req
This commit is contained in:
@@ -3,7 +3,7 @@ package router
|
||||
import (
|
||||
"mayfly-go/internal/sys/api"
|
||||
"mayfly-go/internal/sys/application"
|
||||
"mayfly-go/pkg/ctx"
|
||||
"mayfly-go/pkg/req"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
@@ -13,35 +13,35 @@ func InitResourceRouter(router *gin.RouterGroup) {
|
||||
db := router.Group("sys/resources")
|
||||
{
|
||||
db.GET("", func(c *gin.Context) {
|
||||
ctx.NewReqCtxWithGin(c).Handle(r.GetAllResourceTree)
|
||||
req.NewCtxWithGin(c).Handle(r.GetAllResourceTree)
|
||||
})
|
||||
|
||||
db.GET(":id", func(c *gin.Context) {
|
||||
ctx.NewReqCtxWithGin(c).Handle(r.GetById)
|
||||
req.NewCtxWithGin(c).Handle(r.GetById)
|
||||
})
|
||||
|
||||
saveResource := ctx.NewLogInfo("保存资源").WithSave(true)
|
||||
srPermission := ctx.NewPermission("resource:add")
|
||||
saveResource := req.NewLogInfo("保存资源").WithSave(true)
|
||||
srPermission := req.NewPermission("resource:add")
|
||||
db.POST("", func(c *gin.Context) {
|
||||
ctx.NewReqCtxWithGin(c).
|
||||
req.NewCtxWithGin(c).
|
||||
WithLog(saveResource).
|
||||
WithRequiredPermission(srPermission).
|
||||
Handle(r.SaveResource)
|
||||
})
|
||||
|
||||
changeStatus := ctx.NewLogInfo("修改资源状态").WithSave(true)
|
||||
csPermission := ctx.NewPermission("resource:changeStatus")
|
||||
changeStatus := req.NewLogInfo("修改资源状态").WithSave(true)
|
||||
csPermission := req.NewPermission("resource:changeStatus")
|
||||
db.PUT(":id/:status", func(c *gin.Context) {
|
||||
ctx.NewReqCtxWithGin(c).
|
||||
req.NewCtxWithGin(c).
|
||||
WithLog(changeStatus).
|
||||
WithRequiredPermission(csPermission).
|
||||
Handle(r.ChangeStatus)
|
||||
})
|
||||
|
||||
delResource := ctx.NewLogInfo("删除资源").WithSave(true)
|
||||
dePermission := ctx.NewPermission("resource:delete")
|
||||
delResource := req.NewLogInfo("删除资源").WithSave(true)
|
||||
dePermission := req.NewPermission("resource:delete")
|
||||
db.DELETE(":id", func(c *gin.Context) {
|
||||
ctx.NewReqCtxWithGin(c).
|
||||
req.NewCtxWithGin(c).
|
||||
WithLog(delResource).
|
||||
WithRequiredPermission(dePermission).
|
||||
Handle(r.DelResource)
|
||||
|
||||
Reference in New Issue
Block a user