38 lines
874 B
Go
38 lines
874 B
Go
|
package productlogic
|
||
|
|
||
|
import (
|
||
|
"code.30cm.net/digimon/app-cloudep-product-service/pkg/domain/usecase"
|
||
|
"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"
|
||
|
)
|
||
|
|
||
|
type UpdateLogic struct {
|
||
|
ctx context.Context
|
||
|
svcCtx *svc.ServiceContext
|
||
|
logx.Logger
|
||
|
}
|
||
|
|
||
|
func NewUpdateLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateLogic {
|
||
|
return &UpdateLogic{
|
||
|
ctx: ctx,
|
||
|
svcCtx: svcCtx,
|
||
|
Logger: logx.WithContext(ctx),
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// Update 更新 Item
|
||
|
func (l *UpdateLogic) Update(in *product.UpdateProductItemRequest) (*product.OKResp, error) {
|
||
|
update := &usecase.UpdateProductItems{}
|
||
|
|
||
|
err := l.svcCtx.ProductItemUseCase.Update(l.ctx, in.GetId(), update)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
return &product.OKResp{}, nil
|
||
|
}
|