Compare commits
7 Commits
main
...
feature/or
Author | SHA1 | Date |
---|---|---|
daniel.w | ac0b2eab13 | |
daniel.w | 0a62d892ce | |
daniel.w | f5a043ab79 | |
daniel.w | 352f11a792 | |
daniel.w | 73f91be649 | |
daniel.w | 07e5ce0eca | |
daniel.w | 03b4d39164 |
|
@ -14,7 +14,6 @@ func decimalPtrFromString(val string) *decimal.Decimal {
|
|||
dec, err := decimal.NewFromString(val)
|
||||
if err != nil {
|
||||
logx.Errorf("Failed to convert string to decimal: %v", err)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -29,7 +28,6 @@ func convertDecimalPtrToDecimal128(d *decimal.Decimal) *primitive.Decimal128 {
|
|||
result, err := primitive.ParseDecimal128(d.String())
|
||||
if err != nil {
|
||||
logx.Errorf("Failed to convert decimal to Decimal128: %v", err)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -41,7 +39,6 @@ func convertDecimalToDecimal128(d decimal.Decimal) primitive.Decimal128 {
|
|||
result, err := primitive.ParseDecimal128(d.String())
|
||||
if err != nil {
|
||||
logx.Errorf("Failed to convert decimal to Decimal128: %v", err)
|
||||
|
||||
return primitive.NewDecimal128(0, 0)
|
||||
}
|
||||
|
||||
|
@ -75,6 +72,16 @@ func optionalInt64(i *int64) *int64 {
|
|||
return nil
|
||||
}
|
||||
|
||||
func optionalDecimalToString(d *decimal.Decimal) *string {
|
||||
if d != nil {
|
||||
s := d.String()
|
||||
|
||||
return &s
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func nilString(s *string) *string {
|
||||
if s == nil {
|
||||
return nil
|
||||
|
|
|
@ -4,10 +4,9 @@ import (
|
|||
"app-cloudep-order-server/gen_result/pb/order"
|
||||
"app-cloudep-order-server/internal/domain"
|
||||
"app-cloudep-order-server/internal/svc"
|
||||
ers "code.30cm.net/digimon/library-go/errs"
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
ers "code.30cm.net/digimon/library-go/errs"
|
||||
"github.com/zeromicro/go-zero/core/stores/mon"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
|
@ -44,10 +43,9 @@ func (l *GetOrderLogic) GetOrder(in *order.GetOrderReq) (*order.GetOrderResp, er
|
|||
|
||||
o, err := l.svcCtx.OrderModel.FindOneBusinessID(l.ctx, in.GetBusinessId())
|
||||
if err != nil {
|
||||
if errors.Is(mon.ErrNotFound, err) {
|
||||
if errors.As(err, &mon.ErrNotFound) {
|
||||
return nil, domain.NotFoundError(domain.DataNotFoundErrorCode, "failed to get this order id:", in.GetBusinessId())
|
||||
}
|
||||
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
|
|
@ -8,9 +8,8 @@ import (
|
|||
"app-cloudep-order-server/internal/svc"
|
||||
"context"
|
||||
"errors"
|
||||
"testing"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"go.uber.org/mock/gomock"
|
||||
|
|
|
@ -6,7 +6,6 @@ import (
|
|||
"context"
|
||||
|
||||
"app-cloudep-order-server/internal/svc"
|
||||
|
||||
ers "code.30cm.net/digimon/library-go/errs"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
|
|
|
@ -4,9 +4,8 @@ import (
|
|||
"app-cloudep-order-server/gen_result/pb/order"
|
||||
"app-cloudep-order-server/internal/domain"
|
||||
model "app-cloudep-order-server/internal/model/mongo"
|
||||
"context"
|
||||
|
||||
ers "code.30cm.net/digimon/library-go/errs"
|
||||
"context"
|
||||
|
||||
"app-cloudep-order-server/internal/svc"
|
||||
|
||||
|
|
Loading…
Reference in New Issue