36 lines
872 B
Go
36 lines
872 B
Go
|
package productlogic
|
|||
|
|
|||
|
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"
|
|||
|
)
|
|||
|
|
|||
|
type IncSalesCountLogic struct {
|
|||
|
ctx context.Context
|
|||
|
svcCtx *svc.ServiceContext
|
|||
|
logx.Logger
|
|||
|
}
|
|||
|
|
|||
|
func NewIncSalesCountLogic(ctx context.Context, svcCtx *svc.ServiceContext) *IncSalesCountLogic {
|
|||
|
return &IncSalesCountLogic{
|
|||
|
ctx: ctx,
|
|||
|
svcCtx: svcCtx,
|
|||
|
Logger: logx.WithContext(ctx),
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
// IncSalesCount 增加賣出數量
|
|||
|
func (l *IncSalesCountLogic) IncSalesCount(in *product.IncDecSalesCountRequest) (*product.OKResp, error) {
|
|||
|
// TODO 有問題可以在這邊加瑣
|
|||
|
err := l.svcCtx.ProductItemUseCase.IncSalesCount(l.ctx, in.GetId(), in.GetCount())
|
|||
|
if err != nil {
|
|||
|
return nil, err
|
|||
|
}
|
|||
|
|
|||
|
return &product.OKResp{}, nil
|
|||
|
}
|