tianyuan-api-server/apps/gateway/internal/handler/userProduct/deleteuserproducthandler.go

31 lines
789 B
Go
Raw Normal View History

2024-10-02 00:57:17 +08:00
package userProduct
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tianyuan-api/apps/gateway/internal/logic/userProduct"
"tianyuan-api/apps/gateway/internal/svc"
"tianyuan-api/apps/gateway/internal/types"
xhttp "github.com/zeromicro/x/http"
)
func DeleteUserProductHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.DeleteUserProductReq
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
return
}
l := userProduct.NewDeleteUserProductLogic(r.Context(), svcCtx)
err := l.DeleteUserProduct(&req)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, nil)
}
}
}