29 lines
789 B
Go
29 lines
789 B
Go
|
|
// Code scaffolded by goctl. Safe to edit.
|
||
|
|
|
||
|
|
package productbatch
|
||
|
|
|
||
|
|
import (
|
||
|
|
"context"
|
||
|
|
"net/http"
|
||
|
|
|
||
|
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||
|
|
"github.com/zeromicro/go-zero/rest/pathvar"
|
||
|
|
"muyu-apiserver/gateway/internal/logic/inventory/productbatch"
|
||
|
|
"muyu-apiserver/gateway/internal/svc"
|
||
|
|
)
|
||
|
|
|
||
|
|
func DeleteProductBatchHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||
|
|
return func(w http.ResponseWriter, r *http.Request) {
|
||
|
|
vars := pathvar.Vars(r)
|
||
|
|
ctx := context.WithValue(r.Context(), "pathId", vars["id"])
|
||
|
|
ctx = context.WithValue(ctx, "batchId", vars["batchId"])
|
||
|
|
l := productbatch.NewDeleteProductBatchLogic(ctx, svcCtx)
|
||
|
|
resp, err := l.DeleteProductBatch()
|
||
|
|
if err != nil {
|
||
|
|
httpx.ErrorCtx(r.Context(), w, err)
|
||
|
|
} else {
|
||
|
|
httpx.OkJsonCtx(r.Context(), w, resp)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|