25 lines
639 B
Go
Raw Normal View History

package supplier
import (
"context"
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"github.com/zeromicro/go-zero/rest/pathvar"
"muyu-apiserver/gateway/internal/logic/purchase/supplier"
"muyu-apiserver/gateway/internal/svc"
)
func DeleteSupplierHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
ctx := context.WithValue(r.Context(), "pathId", pathvar.Vars(r)["id"])
l := supplier.NewDeleteSupplierLogic(ctx, svcCtx)
err := l.DeleteSupplier()
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, nil)
}
}
}