This commit is contained in:
laodaming
2023-06-19 12:23:02 +08:00
parent 56a3c05eae
commit bbb1a845ad
10 changed files with 244 additions and 15 deletions

View File

@@ -12,6 +12,7 @@ import (
"fusenapi/server/product/internal/logic"
"fusenapi/server/product/internal/svc"
"fusenapi/server/product/internal/types"
)
func GetProductDesignHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
@@ -52,8 +53,19 @@ func GetProductDesignHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
userinfo = &auth.UserInfo{UserId: 0, GuestId: 0}
}
var req types.GetProductDesignReq
// 如果端点有请求结构体则使用httpx.Parse方法从HTTP请求体中解析请求数据
if err := httpx.Parse(r, &req); err != nil {
httpx.OkJsonCtx(r.Context(), w, &basic.Response{
Code: 510,
Message: "parameter error",
})
logx.Info(err)
return
}
// 创建一个业务逻辑层实例
l := logic.NewGetProductDesignLogic(r.Context(), svcCtx)
resp := l.GetProductDesign(userinfo)
resp := l.GetProductDesign(&req, userinfo)
// 如果响应不为nil则使用httpx.OkJsonCtx方法返回JSON响应;
if resp != nil {
httpx.OkJsonCtx(r.Context(), w, resp)