Merge branch '1.3.x' into github-dev
This commit is contained in:
commit
1c046d9ddd
5 files changed
+16
-15
No files matched your search
@@ -273,6 +273,7 @@ func (e Gen) genApiToFile(c *gin.Context, tab tools.SysTables) {
|
||||
}
|
||||
|
||||
func (e Gen) ActionsGen(c *gin.Context, tab tools.SysTables) {
|
||||
e.Context = c
|
||||
log := api.GetRequestLogger(c)
|
||||
basePath := "template/v4/"
|
||||
routerFile := basePath + "actions/router_check_role.go.template"
|
||||
@@ -338,7 +339,7 @@ func (e Gen) ActionsGen(c *gin.Context, tab tools.SysTables) {
|
||||
|
||||
func (e Gen) GenMenuAndApi(c *gin.Context) {
|
||||
log := api.GetRequestLogger(c)
|
||||
|
||||
e.Context = c
|
||||
table := tools.SysTables{}
|
||||
timeNow := pkg.GetCurrentTime()
|
||||
id, err := pkg.StringToInt(c.Param("tableId"))
|
||||
@@ -578,4 +579,4 @@ func (e Gen) GenMenuAndApi(c *gin.Context) {
|
||||
ADelete.MenuId, err = ADelete.Create(db)
|
||||
|
||||
e.OK("", "数据生成成功!")
|
||||
}
|
||||
}
|
||||
@@ -4,10 +4,11 @@ import (
|
||||
"go-admin/app/jobs/service"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-admin-team/go-admin-core/sdk"
|
||||
"go-admin/common/apis"
|
||||
"go-admin/common/dto"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-admin-team/go-admin-core/sdk"
|
||||
)
|
||||
|
||||
type SysJob struct {
|
||||
@@ -16,7 +17,7 @@ type SysJob struct {
|
||||
|
||||
// RemoveJobForService 调用service实现
|
||||
func (e SysJob) RemoveJobForService(c *gin.Context) {
|
||||
e.SetContext(c)
|
||||
e.Context = c
|
||||
log := e.GetLogger()
|
||||
db, err := e.GetOrm()
|
||||
if err != nil {
|
||||
@@ -24,7 +25,7 @@ func (e SysJob) RemoveJobForService(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
var v dto.GeneralDelDto
|
||||
err = c.BindUri(&v)
|
||||
err = c.Bind(&v)
|
||||
if err != nil {
|
||||
log.Warnf("参数验证错误, error: %s", err)
|
||||
e.Error(http.StatusUnprocessableEntity, err, "参数验证失败")
|
||||
|
||||
@@ -19,7 +19,7 @@ type SysFileDir struct {
|
||||
}
|
||||
|
||||
func (e SysFileDir) GetSysFileDirList(c *gin.Context) {
|
||||
e.SetContext(c)
|
||||
e.Context = c
|
||||
log := e.GetLogger()
|
||||
search := new(dto.SysFileDirSearch)
|
||||
db, err := e.GetOrm()
|
||||
@@ -49,7 +49,7 @@ func (e SysFileDir) GetSysFileDirList(c *gin.Context) {
|
||||
|
||||
func (e SysFileDir) GetSysFileDir(c *gin.Context) {
|
||||
control := new(dto.SysFileDirById)
|
||||
e.SetContext(c)
|
||||
e.Context = c
|
||||
log := e.GetLogger()
|
||||
db, err := e.GetOrm()
|
||||
if err != nil {
|
||||
@@ -81,7 +81,7 @@ func (e SysFileDir) GetSysFileDir(c *gin.Context) {
|
||||
|
||||
func (e SysFileDir) InsertSysFileDir(c *gin.Context) {
|
||||
control := new(dto.SysFileDirControl)
|
||||
e.SetContext(c)
|
||||
e.Context = c
|
||||
log := e.GetLogger()
|
||||
db, err := e.GetOrm()
|
||||
if err != nil {
|
||||
@@ -195,4 +195,4 @@ func (e SysFileDir) DeleteSysFileDir(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
e.OK(control.Id, "删除成功")
|
||||
}
|
||||
}
|
||||
+3
-4
@@ -1,9 +1,10 @@
|
||||
package apis
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin/binding"
|
||||
"github.com/go-admin-team/go-admin-core/sdk/api"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-admin-team/go-admin-core/sdk/pkg"
|
||||
@@ -19,13 +20,11 @@ type Api struct {
|
||||
|
||||
func (e Api) SetContext(c *gin.Context) {
|
||||
e.Context = c
|
||||
|
||||
}
|
||||
|
||||
// GetLogger 获取上下文提供的日志
|
||||
func (e Api) GetLogger() *logger.Logger {
|
||||
e.Logger = api.GetRequestLogger(e.Context)
|
||||
return e.Logger
|
||||
return api.GetRequestLogger(e.Context)
|
||||
}
|
||||
|
||||
func (e Api) Bind(d interface{}, bindings ...binding.Binding) error {
|
||||
|
||||
@@ -22,7 +22,7 @@ func (s *ObjectById) Bind(ctx *gin.Context) error {
|
||||
return err
|
||||
}
|
||||
if ctx.Request.Method == http.MethodDelete {
|
||||
err = ctx.ShouldBind(&s.Ids)
|
||||
err = ctx.ShouldBind(&s)
|
||||
if err != nil {
|
||||
log.Warnf("ShouldBind error: %s", err.Error())
|
||||
return err
|
||||
|
||||
Reference in new issue
Block a user