2025-04-09 14:46:53 +00:00
|
|
|
package productitemservicelogic
|
2025-04-09 09:29:56 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"code.30cm.net/digimon/app-cloudep-product-service/gen_result/pb/product"
|
|
|
|
"code.30cm.net/digimon/app-cloudep-product-service/internal/svc"
|
|
|
|
|
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
|
|
)
|
|
|
|
|
2025-04-09 14:46:53 +00:00
|
|
|
type DeleteLogic struct {
|
2025-04-09 09:29:56 +00:00
|
|
|
ctx context.Context
|
|
|
|
svcCtx *svc.ServiceContext
|
|
|
|
logx.Logger
|
|
|
|
}
|
|
|
|
|
2025-04-09 14:46:53 +00:00
|
|
|
func NewDeleteLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteLogic {
|
|
|
|
return &DeleteLogic{
|
2025-04-09 09:29:56 +00:00
|
|
|
ctx: ctx,
|
|
|
|
svcCtx: svcCtx,
|
|
|
|
Logger: logx.WithContext(ctx),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2025-04-09 14:46:53 +00:00
|
|
|
// Delete 刪除 Delete Product Item
|
|
|
|
func (l *DeleteLogic) Delete(in *product.DeleteProductItemRequest) (*product.OKResp, error) {
|
2025-04-09 09:29:56 +00:00
|
|
|
err := l.svcCtx.ProductItemUseCase.Delete(l.ctx, in.GetId())
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return &product.OKResp{}, nil
|
|
|
|
}
|