mirror of
https://github.com/vbenjs/gf-vben.git
synced 2025-01-23 01:00:21 +08:00
curd controller优化
This commit is contained in:
parent
ed6fd06688
commit
c7b92fdc04
@ -1,9 +1,11 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"Gf-Vben/internal/model"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
type CurdReq struct {
|
||||
g.Meta `path:"/curd" method:"post" summary:"Curd请求" tags:"Curd"`
|
||||
model.CurdReq
|
||||
}
|
||||
|
@ -2,11 +2,9 @@ package controller
|
||||
|
||||
import (
|
||||
"Gf-Vben/api/v1"
|
||||
"Gf-Vben/internal/model"
|
||||
"Gf-Vben/internal/service"
|
||||
"Gf-Vben/util"
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -17,10 +15,5 @@ type cCurd struct {
|
||||
}
|
||||
|
||||
func (cCurd) Curd(ctx context.Context, req *v1.CurdReq) (res *util.JsonRes, err error) {
|
||||
r := g.RequestFromCtx(ctx)
|
||||
in := new(model.CurdReq)
|
||||
if err := r.Parse(&in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return service.Curd().Curd(ctx, in)
|
||||
return service.Curd().Curd(ctx, &req.CurdReq)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user