37 lines
747 B
Go
37 lines
747 B
Go
package product
|
|
|
|
import (
|
|
"context"
|
|
"tianyuan-api/apps/sentinel/client/product"
|
|
|
|
"tianyuan-api/apps/admin/internal/svc"
|
|
"tianyuan-api/apps/admin/internal/types"
|
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
)
|
|
|
|
type DeleteProductLogic struct {
|
|
logx.Logger
|
|
ctx context.Context
|
|
svcCtx *svc.ServiceContext
|
|
}
|
|
|
|
func NewDeleteProductLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteProductLogic {
|
|
return &DeleteProductLogic{
|
|
Logger: logx.WithContext(ctx),
|
|
ctx: ctx,
|
|
svcCtx: svcCtx,
|
|
}
|
|
}
|
|
|
|
func (l *DeleteProductLogic) DeleteProduct(req *types.DeleteProductReq) error {
|
|
_, err := l.svcCtx.ProductRpc.DeleteProduct(l.ctx, &product.DeleteProductRequest{
|
|
Id: req.ProductId,
|
|
})
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|