作者 tangxvhui

Merge branch 'dev' of http://gitlab.fjmaimaimai.com/mmm-go/partnermg into dev

@@ -76,6 +76,12 @@ func (service OrderService) GetOrder(getOrderQuery query.GetOrderQuery) (*domain @@ -76,6 +76,12 @@ func (service OrderService) GetOrder(getOrderQuery query.GetOrderQuery) (*domain
76 orderRepository domain.OrderRepository 76 orderRepository domain.OrderRepository
77 order *domain.Order 77 order *domain.Order
78 ) 78 )
  79 + if err = transactionContext.StartTransaction(); err != nil {
  80 + return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
  81 + }
  82 + defer func() {
  83 + transactionContext.RollbackTransaction()
  84 + }()
79 if value, err := factory.CreateOrderRepository(map[string]interface{}{ 85 if value, err := factory.CreateOrderRepository(map[string]interface{}{
80 "transactionContext": transactionContext, 86 "transactionContext": transactionContext,
81 }); err != nil { 87 }); err != nil {
@@ -102,7 +108,10 @@ func (service OrderService) GetOrder(getOrderQuery query.GetOrderQuery) (*domain @@ -102,7 +108,10 @@ func (service OrderService) GetOrder(getOrderQuery query.GetOrderQuery) (*domain
102 return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) 108 return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
103 } 109 }
104 order.PartnerInfo = partnerData.Partner 110 order.PartnerInfo = partnerData.Partner
105 - 111 + err = transactionContext.CommitTransaction()
  112 + if err != nil {
  113 + return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
  114 + }
106 return order, nil 115 return order, nil
107 } 116 }
108 117