package productbatch import ( "context" "muyu-apiserver/gateway/internal/svc" "muyu-apiserver/gateway/internal/types" "muyu-apiserver/pkg/ctxdata" "muyu-apiserver/rpc/inventory/pb" "github.com/zeromicro/go-zero/core/logx" ) type DeleteProductBatchLogic struct { logx.Logger ctx context.Context svcCtx *svc.ServiceContext } func NewDeleteProductBatchLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteProductBatchLogic { return &DeleteProductBatchLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx} } func (l *DeleteProductBatchLogic) DeleteProductBatch() (*types.IdResp, error) { productId := ctxdata.GetPathId(l.ctx) batchId, _ := l.ctx.Value("batchId").(string) if _, err := l.svcCtx.InventoryRpc.DeleteProductBatch(l.ctx, &pb.DeleteProductBatchReq{ProductId: productId, BatchId: batchId}); err != nil { return nil, err } return &types.IdResp{Id: batchId}, nil }