| | |
| | | } |
| | | |
| | | func (s *Server) OrderProductOutput(ctx context.Context, req *OrderProductOutputRequest) (resp *OrderProductOutputResponse, err error) { |
| | | resp = new(OrderProductOutputResponse) |
| | | if req.OrderNumber == "" || len(req.Products) == 0 { |
| | | return nil, errors.New("参数缺失") |
| | | } |
| | |
| | | } else { |
| | | locationSendAmount = productAmount |
| | | } |
| | | if locationSendAmount.LessThanOrEqual(decimal.Zero) { |
| | | continue |
| | | } |
| | | productInfoList = append(productInfoList, &service.ProductInfo{ |
| | | ProductID: productNumber, |
| | | Amount: locationSendAmount, |
| | |
| | | err = service.AddOutputOperations(outputInfoList) |
| | | |
| | | if err != nil { |
| | | logx.Errorf("OrderProductOutput AddOutputOperations err:%v", err) |
| | | return nil, err |
| | | } |
| | | |
| | | resp.Code = 1 |
| | | resp.Msg = "success" |
| | | return nil, nil |
| | | return resp, nil |
| | | } |