fix
This commit is contained in:
@@ -15,7 +15,7 @@ import (
|
||||
"fusenapi/server/product/internal/types"
|
||||
)
|
||||
|
||||
func GetThousandFaceDesignByPidHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
func GetLastProductDesignHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
var (
|
||||
@@ -53,7 +53,7 @@ func GetThousandFaceDesignByPidHandler(svcCtx *svc.ServiceContext) http.HandlerF
|
||||
userinfo = &auth.UserInfo{UserId: 0, GuestId: 0}
|
||||
}
|
||||
|
||||
var req types.GetThousandFaceDesignByPidReq
|
||||
var req types.Request
|
||||
// 如果端点有请求结构体,则使用httpx.Parse方法从HTTP请求体中解析请求数据
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.OkJsonCtx(r.Context(), w, &basic.Response{
|
||||
@@ -64,8 +64,8 @@ func GetThousandFaceDesignByPidHandler(svcCtx *svc.ServiceContext) http.HandlerF
|
||||
return
|
||||
}
|
||||
// 创建一个业务逻辑层实例
|
||||
l := logic.NewGetThousandFaceDesignByPidLogic(r.Context(), svcCtx)
|
||||
resp := l.GetThousandFaceDesignByPid(&req, userinfo)
|
||||
l := logic.NewGetLastProductDesignLogic(r.Context(), svcCtx)
|
||||
resp := l.GetLastProductDesign(&req, userinfo)
|
||||
// 如果响应不为nil,则使用httpx.OkJsonCtx方法返回JSON响应;
|
||||
if resp != nil {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
@@ -104,8 +104,8 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/api/product/get_thousand_face_design_by_pid",
|
||||
Handler: GetThousandFaceDesignByPidHandler(serverCtx),
|
||||
Path: "/api/product/get_last_product_design",
|
||||
Handler: GetLastProductDesignHandler(serverCtx),
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user