作者 陈志颖

fix:移除代码警告

... ... @@ -8,6 +8,7 @@ import (
"gitlab.fjmaimaimai.com/mmm-go-pp/partner01/pkg/application/order/command"
"gitlab.fjmaimaimai.com/mmm-go-pp/partner01/pkg/application/order/query"
"gitlab.fjmaimaimai.com/mmm-go-pp/partner01/pkg/domain"
"strconv"
)
// 订单基础服务
... ... @@ -89,7 +90,7 @@ func (orderService *OrderService) DarwDividends(darwDividendsCommand *command.Dr
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
defer func() {
transactionContext.RollbackTransaction()
_ = transactionContext.RollbackTransaction()
}()
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
... ... @@ -110,7 +111,7 @@ func (orderService *OrderService) GetOrder(getOrderQuery *query.GetOrderQuery) (
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
defer func() {
transactionContext.RollbackTransaction()
_ = transactionContext.RollbackTransaction()
}()
var orderRepository domain.OrderRepository
if value, err := factory.CreateOrderRepository(map[string]interface{}{
... ... @@ -125,7 +126,7 @@ func (orderService *OrderService) GetOrder(getOrderQuery *query.GetOrderQuery) (
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if order == nil {
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(getOrderQuery.OrderId)))
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(getOrderQuery.OrderId, 10)))
} else {
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
... ... @@ -147,7 +148,7 @@ func (orderService *OrderService) ListOrder(listOrderQuery *query.ListOrderQuery
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
defer func() {
transactionContext.RollbackTransaction()
_ = transactionContext.RollbackTransaction()
}()
var orderRepository domain.OrderRepository
if value, err := factory.CreateOrderRepository(map[string]interface{}{
... ... @@ -183,7 +184,7 @@ func (orderService *OrderService) Receiving(receivingCommand *command.ReceivingC
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
defer func() {
transactionContext.RollbackTransaction()
_ = transactionContext.RollbackTransaction()
}()
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
... ... @@ -204,7 +205,7 @@ func (orderService *OrderService) RemoveOrder(removeOrderCommand *command.Remove
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
defer func() {
transactionContext.RollbackTransaction()
_ = transactionContext.RollbackTransaction()
}()
var orderRepository domain.OrderRepository
if value, err := factory.CreateOrderRepository(map[string]interface{}{
... ... @@ -219,7 +220,7 @@ func (orderService *OrderService) RemoveOrder(removeOrderCommand *command.Remove
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if order == nil {
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(removeOrderCommand.OrderId)))
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(removeOrderCommand.OrderId, 10)))
}
if order, err := orderRepository.Remove(order); err != nil {
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
... ... @@ -244,7 +245,7 @@ func (orderService *OrderService) Return(returnCommand *command.ReturnCommand) (
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
defer func() {
transactionContext.RollbackTransaction()
_ = transactionContext.RollbackTransaction()
}()
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
... ... @@ -265,7 +266,7 @@ func (orderService *OrderService) Shipping(shippingCommand *command.ShippingComm
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
defer func() {
transactionContext.RollbackTransaction()
_ = transactionContext.RollbackTransaction()
}()
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
... ... @@ -301,7 +302,7 @@ func (orderService *OrderService) UpdateOrder(updateOrderCommand *command.Update
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
}
if order == nil {
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(updateOrderCommand.OrderId)))
return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(updateOrderCommand.OrderId, 10)))
}
if err := order.Update(tool_funs.SimpleStructToMap(updateOrderCommand)); err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
... ...