mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-12-25 09:06:34 +08:00
refactor: 后端路由定义方式&请求参数绑定重构
This commit is contained in:
@@ -9,7 +9,6 @@ import (
|
||||
"mayfly-go/internal/sys/domain/entity"
|
||||
"mayfly-go/pkg/ginx"
|
||||
"mayfly-go/pkg/req"
|
||||
"mayfly-go/pkg/utils"
|
||||
)
|
||||
|
||||
type Resource struct {
|
||||
@@ -29,11 +28,10 @@ func (r *Resource) GetById(rc *req.Ctx) {
|
||||
func (r *Resource) SaveResource(rc *req.Ctx) {
|
||||
g := rc.GinCtx
|
||||
form := new(form.ResourceForm)
|
||||
ginx.BindJsonAndValid(g, form)
|
||||
entity := ginx.BindJsonAndCopyTo(g, form, new(entity.Resource))
|
||||
|
||||
rc.ReqParam = form
|
||||
|
||||
entity := new(entity.Resource)
|
||||
utils.Copy(entity, form)
|
||||
// 将meta转为json字符串存储
|
||||
bytes, _ := json.Marshal(form.Meta)
|
||||
entity.Meta = string(bytes)
|
||||
|
||||
Reference in New Issue
Block a user