正在显示
1 个修改的文件
包含
11 行增加
和
10 行删除
| @@ -8,6 +8,7 @@ import ( | @@ -8,6 +8,7 @@ import ( | ||
| 8 | "gitlab.fjmaimaimai.com/mmm-go-pp/partner01/pkg/application/order/command" | 8 | "gitlab.fjmaimaimai.com/mmm-go-pp/partner01/pkg/application/order/command" |
| 9 | "gitlab.fjmaimaimai.com/mmm-go-pp/partner01/pkg/application/order/query" | 9 | "gitlab.fjmaimaimai.com/mmm-go-pp/partner01/pkg/application/order/query" |
| 10 | "gitlab.fjmaimaimai.com/mmm-go-pp/partner01/pkg/domain" | 10 | "gitlab.fjmaimaimai.com/mmm-go-pp/partner01/pkg/domain" |
| 11 | + "strconv" | ||
| 11 | ) | 12 | ) |
| 12 | 13 | ||
| 13 | // 订单基础服务 | 14 | // 订单基础服务 |
| @@ -89,7 +90,7 @@ func (orderService *OrderService) DarwDividends(darwDividendsCommand *command.Dr | @@ -89,7 +90,7 @@ func (orderService *OrderService) DarwDividends(darwDividendsCommand *command.Dr | ||
| 89 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 90 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
| 90 | } | 91 | } |
| 91 | defer func() { | 92 | defer func() { |
| 92 | - transactionContext.RollbackTransaction() | 93 | + _ = transactionContext.RollbackTransaction() |
| 93 | }() | 94 | }() |
| 94 | if err := transactionContext.CommitTransaction(); err != nil { | 95 | if err := transactionContext.CommitTransaction(); err != nil { |
| 95 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 96 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
| @@ -110,7 +111,7 @@ func (orderService *OrderService) GetOrder(getOrderQuery *query.GetOrderQuery) ( | @@ -110,7 +111,7 @@ func (orderService *OrderService) GetOrder(getOrderQuery *query.GetOrderQuery) ( | ||
| 110 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 111 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
| 111 | } | 112 | } |
| 112 | defer func() { | 113 | defer func() { |
| 113 | - transactionContext.RollbackTransaction() | 114 | + _ = transactionContext.RollbackTransaction() |
| 114 | }() | 115 | }() |
| 115 | var orderRepository domain.OrderRepository | 116 | var orderRepository domain.OrderRepository |
| 116 | if value, err := factory.CreateOrderRepository(map[string]interface{}{ | 117 | if value, err := factory.CreateOrderRepository(map[string]interface{}{ |
| @@ -125,7 +126,7 @@ func (orderService *OrderService) GetOrder(getOrderQuery *query.GetOrderQuery) ( | @@ -125,7 +126,7 @@ func (orderService *OrderService) GetOrder(getOrderQuery *query.GetOrderQuery) ( | ||
| 125 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 126 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
| 126 | } | 127 | } |
| 127 | if order == nil { | 128 | if order == nil { |
| 128 | - return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(getOrderQuery.OrderId))) | 129 | + return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(getOrderQuery.OrderId, 10))) |
| 129 | } else { | 130 | } else { |
| 130 | if err := transactionContext.CommitTransaction(); err != nil { | 131 | if err := transactionContext.CommitTransaction(); err != nil { |
| 131 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 132 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
| @@ -147,7 +148,7 @@ func (orderService *OrderService) ListOrder(listOrderQuery *query.ListOrderQuery | @@ -147,7 +148,7 @@ func (orderService *OrderService) ListOrder(listOrderQuery *query.ListOrderQuery | ||
| 147 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 148 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
| 148 | } | 149 | } |
| 149 | defer func() { | 150 | defer func() { |
| 150 | - transactionContext.RollbackTransaction() | 151 | + _ = transactionContext.RollbackTransaction() |
| 151 | }() | 152 | }() |
| 152 | var orderRepository domain.OrderRepository | 153 | var orderRepository domain.OrderRepository |
| 153 | if value, err := factory.CreateOrderRepository(map[string]interface{}{ | 154 | if value, err := factory.CreateOrderRepository(map[string]interface{}{ |
| @@ -183,7 +184,7 @@ func (orderService *OrderService) Receiving(receivingCommand *command.ReceivingC | @@ -183,7 +184,7 @@ func (orderService *OrderService) Receiving(receivingCommand *command.ReceivingC | ||
| 183 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 184 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
| 184 | } | 185 | } |
| 185 | defer func() { | 186 | defer func() { |
| 186 | - transactionContext.RollbackTransaction() | 187 | + _ = transactionContext.RollbackTransaction() |
| 187 | }() | 188 | }() |
| 188 | if err := transactionContext.CommitTransaction(); err != nil { | 189 | if err := transactionContext.CommitTransaction(); err != nil { |
| 189 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 190 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
| @@ -204,7 +205,7 @@ func (orderService *OrderService) RemoveOrder(removeOrderCommand *command.Remove | @@ -204,7 +205,7 @@ func (orderService *OrderService) RemoveOrder(removeOrderCommand *command.Remove | ||
| 204 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 205 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
| 205 | } | 206 | } |
| 206 | defer func() { | 207 | defer func() { |
| 207 | - transactionContext.RollbackTransaction() | 208 | + _ = transactionContext.RollbackTransaction() |
| 208 | }() | 209 | }() |
| 209 | var orderRepository domain.OrderRepository | 210 | var orderRepository domain.OrderRepository |
| 210 | if value, err := factory.CreateOrderRepository(map[string]interface{}{ | 211 | if value, err := factory.CreateOrderRepository(map[string]interface{}{ |
| @@ -219,7 +220,7 @@ func (orderService *OrderService) RemoveOrder(removeOrderCommand *command.Remove | @@ -219,7 +220,7 @@ func (orderService *OrderService) RemoveOrder(removeOrderCommand *command.Remove | ||
| 219 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 220 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
| 220 | } | 221 | } |
| 221 | if order == nil { | 222 | if order == nil { |
| 222 | - return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(removeOrderCommand.OrderId))) | 223 | + return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(removeOrderCommand.OrderId, 10))) |
| 223 | } | 224 | } |
| 224 | if order, err := orderRepository.Remove(order); err != nil { | 225 | if order, err := orderRepository.Remove(order); err != nil { |
| 225 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 226 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
| @@ -244,7 +245,7 @@ func (orderService *OrderService) Return(returnCommand *command.ReturnCommand) ( | @@ -244,7 +245,7 @@ func (orderService *OrderService) Return(returnCommand *command.ReturnCommand) ( | ||
| 244 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 245 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
| 245 | } | 246 | } |
| 246 | defer func() { | 247 | defer func() { |
| 247 | - transactionContext.RollbackTransaction() | 248 | + _ = transactionContext.RollbackTransaction() |
| 248 | }() | 249 | }() |
| 249 | if err := transactionContext.CommitTransaction(); err != nil { | 250 | if err := transactionContext.CommitTransaction(); err != nil { |
| 250 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 251 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
| @@ -265,7 +266,7 @@ func (orderService *OrderService) Shipping(shippingCommand *command.ShippingComm | @@ -265,7 +266,7 @@ func (orderService *OrderService) Shipping(shippingCommand *command.ShippingComm | ||
| 265 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 266 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
| 266 | } | 267 | } |
| 267 | defer func() { | 268 | defer func() { |
| 268 | - transactionContext.RollbackTransaction() | 269 | + _ = transactionContext.RollbackTransaction() |
| 269 | }() | 270 | }() |
| 270 | if err := transactionContext.CommitTransaction(); err != nil { | 271 | if err := transactionContext.CommitTransaction(); err != nil { |
| 271 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | 272 | return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) |
| @@ -301,7 +302,7 @@ func (orderService *OrderService) UpdateOrder(updateOrderCommand *command.Update | @@ -301,7 +302,7 @@ func (orderService *OrderService) UpdateOrder(updateOrderCommand *command.Update | ||
| 301 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 302 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
| 302 | } | 303 | } |
| 303 | if order == nil { | 304 | if order == nil { |
| 304 | - return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", string(updateOrderCommand.OrderId))) | 305 | + return nil, application.ThrowError(application.RES_NO_FIND_ERROR, fmt.Sprintf("%s", strconv.FormatInt(updateOrderCommand.OrderId, 10))) |
| 305 | } | 306 | } |
| 306 | if err := order.Update(tool_funs.SimpleStructToMap(updateOrderCommand)); err != nil { | 307 | if err := order.Update(tool_funs.SimpleStructToMap(updateOrderCommand)); err != nil { |
| 307 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | 308 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) |
-
请 注册 或 登录 后发表评论