Skip to content

Commit

Permalink
curd controller优化
Browse files Browse the repository at this point in the history
  • Loading branch information
jinmao88 committed Dec 14, 2022
1 parent ed6fd06 commit c7b92fd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
2 changes: 2 additions & 0 deletions api/v1/curd.go
Original file line number Diff line number Diff line change
@@ -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
}
9 changes: 1 addition & 8 deletions internal/controller/curd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -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)
}

0 comments on commit c7b92fd

Please sign in to comment.