This commit is contained in:
laodaming
2023-06-01 18:34:41 +08:00
parent 08e6f00ff5
commit 2d7ea2e302
10 changed files with 304 additions and 10 deletions

View File

@@ -1,6 +1,7 @@
package handler
import (
"fusenapi/utils/auth"
"net/http"
"fusenapi/product/internal/logic"
@@ -11,14 +12,19 @@ import (
func GetProductListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
//检测登录权限
userInfo, err := auth.CheckAuth(r)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
var req types.GetProductListReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := logic.NewGetProductListLogic(r.Context(), svcCtx)
resp, err := l.GetProductList(&req)
resp, err := l.GetProductList(&req, userInfo.UserId)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {