fix: some api bug
This commit is contained in:
@@ -4,17 +4,12 @@
|
||||
package shop
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"juwan-backend/common/utils/contextj"
|
||||
"juwan-backend/common/utils/httpj"
|
||||
"juwan-backend/common/utils/responses"
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"juwan-backend/app/shop/api/internal/logic/shop"
|
||||
"juwan-backend/app/shop/api/internal/svc"
|
||||
"juwan-backend/app/shop/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
)
|
||||
|
||||
// 获取当前用户的店铺
|
||||
@@ -26,12 +21,7 @@ func GetMyShopHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return
|
||||
}
|
||||
|
||||
userId, err := httpj.GetUserIdFromHeader(r.Header)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, responses.NewErrorResp(403, errors.New("forbidden: user not authenticated")))
|
||||
}
|
||||
ctx := contextj.WithUserID(r.Context(), userId)
|
||||
l := shop.NewGetMyShopLogic(ctx, svcCtx)
|
||||
l := shop.NewGetMyShopLogic(r.Context(), svcCtx)
|
||||
resp, err := l.GetMyShop(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
|
||||
Reference in New Issue
Block a user