muyu-apiserver/gateway/internal/logic/inventory/check/confirmStockCheckLogic.go

42 lines
898 B
Go
Raw Normal View History

package check
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 ConfirmStockCheckLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewConfirmStockCheckLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ConfirmStockCheckLogic {
return &ConfirmStockCheckLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *ConfirmStockCheckLogic) ConfirmStockCheck() (resp *types.IdResp, err error) {
id := ctxdata.GetPathId(l.ctx)
userId := ctxdata.GetUserId(l.ctx)
_, err = l.svcCtx.InventoryRpc.ConfirmStockCheck(l.ctx, &pb.ConfirmStockCheckReq{
CheckId: id,
Operator: userId,
})
if err != nil {
return nil, err
}
return &types.IdResp{Id: id}, nil
}