31 lines
754 B
Go
31 lines
754 B
Go
|
|
package yarn
|
||
|
|
|
||
|
|
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 DeleteYarnLogic struct {
|
||
|
|
logx.Logger
|
||
|
|
ctx context.Context
|
||
|
|
svcCtx *svc.ServiceContext
|
||
|
|
}
|
||
|
|
|
||
|
|
func NewDeleteYarnLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteYarnLogic {
|
||
|
|
return &DeleteYarnLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx}
|
||
|
|
}
|
||
|
|
|
||
|
|
func (l *DeleteYarnLogic) DeleteYarn() (*types.IdResp, error) {
|
||
|
|
id := ctxdata.GetPathId(l.ctx)
|
||
|
|
if _, err := l.svcCtx.InventoryRpc.DeleteYarn(l.ctx, &pb.DeleteYarnReq{YarnId: id}); err != nil {
|
||
|
|
return nil, err
|
||
|
|
}
|
||
|
|
return &types.IdResp{Id: id}, nil
|
||
|
|
}
|