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