This commit is contained in:
laodaming
2023-07-20 17:47:28 +08:00
parent 0e72027ff3
commit 421b63846a
5 changed files with 18 additions and 18 deletions

View File

@@ -13,7 +13,7 @@ import (
"fusenapi/server/product/internal/svc"
)
func HomePageRecommandProductListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
func HomePageRecommendProductListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var (
@@ -51,7 +51,7 @@ func HomePageRecommandProductListHandler(svcCtx *svc.ServiceContext) http.Handle
userinfo = &auth.UserInfo{UserId: 0, GuestId: 0}
}
var req types.HomePageRecommandProductListReq
var req types.HomePageRecommendProductListReq
// 如果端点有请求结构体则使用httpx.Parse方法从HTTP请求体中解析请求数据
if err := httpx.Parse(r, &req); err != nil {
httpx.OkJsonCtx(r.Context(), w, &basic.Response{
@@ -62,8 +62,8 @@ func HomePageRecommandProductListHandler(svcCtx *svc.ServiceContext) http.Handle
return
}
// 创建一个业务逻辑层实例
l := logic.NewHomePageRecommandProductListLogic(r.Context(), svcCtx)
resp := l.HomePageRecommandProductList(&req, userinfo)
l := logic.NewHomePageRecommendProductListLogic(r.Context(), svcCtx)
resp := l.HomePageRecommendProductList(&req, userinfo)
// 如果响应不为nil则使用httpx.OkJsonCtx方法返回JSON响应;
if resp != nil {
httpx.OkJsonCtx(r.Context(), w, resp)

View File

@@ -109,8 +109,8 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
},
{
Method: http.MethodGet,
Path: "/api/product/home_page_recommand",
Handler: HomePageRecommandProductListHandler(serverCtx),
Path: "/api/product/home_page_recommend",
Handler: HomePageRecommendProductListHandler(serverCtx),
},
},
)