|
@@ -37,7 +37,7 @@ func (s SyncOrderService) SyncOrderFromBestshop(cmd command.CreateOrderFromBests |
|
@@ -37,7 +37,7 @@ func (s SyncOrderService) SyncOrderFromBestshop(cmd command.CreateOrderFromBests |
37
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
37
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
38
|
}
|
38
|
}
|
39
|
defer func() {
|
39
|
defer func() {
|
40
|
- transactionContext.RollbackTransaction()
|
40
|
+ _ = transactionContext.RollbackTransaction()
|
41
|
}()
|
41
|
}()
|
42
|
|
42
|
|
43
|
//检查账号是否存在
|
43
|
//检查账号是否存在
|
|
@@ -101,7 +101,7 @@ func (s SyncOrderService) CreateOrderFromBestshop(cmd command.CreateOrderFromBes |
|
@@ -101,7 +101,7 @@ func (s SyncOrderService) CreateOrderFromBestshop(cmd command.CreateOrderFromBes |
101
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
101
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
102
|
}
|
102
|
}
|
103
|
defer func() {
|
103
|
defer func() {
|
104
|
- transactionContext.RollbackTransaction()
|
104
|
+ _ = transactionContext.RollbackTransaction()
|
105
|
}()
|
105
|
}()
|
106
|
var (
|
106
|
var (
|
107
|
orderBestshopRepository domain.OrderBestshopRepository
|
107
|
orderBestshopRepository domain.OrderBestshopRepository
|
|
@@ -117,6 +117,7 @@ func (s SyncOrderService) CreateOrderFromBestshop(cmd command.CreateOrderFromBes |
|
@@ -117,6 +117,7 @@ func (s SyncOrderService) CreateOrderFromBestshop(cmd command.CreateOrderFromBes |
117
|
}); err != nil {
|
117
|
}); err != nil {
|
118
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
118
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
119
|
}
|
119
|
}
|
|
|
120
|
+ // TODO 增加小程序id
|
120
|
order := domain.OrderBestShop{
|
121
|
order := domain.OrderBestShop{
|
121
|
OrderCode: cmd.OrderCode,
|
122
|
OrderCode: cmd.OrderCode,
|
122
|
OrderTime: cmd.OrderTime,
|
123
|
OrderTime: cmd.OrderTime,
|
|
@@ -135,6 +136,7 @@ func (s SyncOrderService) CreateOrderFromBestshop(cmd command.CreateOrderFromBes |
|
@@ -135,6 +136,7 @@ func (s SyncOrderService) CreateOrderFromBestshop(cmd command.CreateOrderFromBes |
135
|
IsCopy: false,
|
136
|
IsCopy: false,
|
136
|
CompanyId: cmd.CompanyId,
|
137
|
CompanyId: cmd.CompanyId,
|
137
|
OrderArea: cmd.OrderArea,
|
138
|
OrderArea: cmd.OrderArea,
|
|
|
139
|
+ WxAppletId: cmd.WxAppletId,
|
138
|
}
|
140
|
}
|
139
|
err = orderBestshopRepository.Add(&order)
|
141
|
err = orderBestshopRepository.Add(&order)
|
140
|
if err != nil {
|
142
|
if err != nil {
|
|
@@ -232,11 +234,16 @@ func (s SyncOrderService) copyOrderBestshopToOrderBase(orderBestshop *domain.Ord |
|
@@ -232,11 +234,16 @@ func (s SyncOrderService) copyOrderBestshopToOrderBase(orderBestshop *domain.Ord |
232
|
e := fmt.Sprintf("未找到指定的合伙人的公司(partner_id=%d,company_id=%d)数据,%s", orderBestshop.PartnerId, partnerData.CompanyId, err)
|
234
|
e := fmt.Sprintf("未找到指定的合伙人的公司(partner_id=%d,company_id=%d)数据,%s", orderBestshop.PartnerId, partnerData.CompanyId, err)
|
233
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, e)
|
235
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, e)
|
234
|
}
|
236
|
}
|
|
|
237
|
+ // TODO 判断多小程序
|
235
|
for _, v := range companyData.Applets {
|
238
|
for _, v := range companyData.Applets {
|
236
|
//BEST_SHOP_UNIONID string = "gh_18eb644002fb" //香米小程序原始id
|
239
|
//BEST_SHOP_UNIONID string = "gh_18eb644002fb" //香米小程序原始id
|
237
|
//接收香米小程序的订单数据
|
240
|
//接收香米小程序的订单数据
|
238
|
- if len(v.Id) > 0 {
|
241
|
+ //if len(v.Id) > 0 {
|
|
|
242
|
+ // canCopyOrder = true
|
|
|
243
|
+ //}
|
|
|
244
|
+ if v.Id == orderBestshop.WxAppletId {
|
239
|
canCopyOrder = true
|
245
|
canCopyOrder = true
|
|
|
246
|
+ break
|
240
|
}
|
247
|
}
|
241
|
}
|
248
|
}
|
242
|
if !canCopyOrder {
|
249
|
if !canCopyOrder {
|
|
@@ -329,7 +336,7 @@ func (s SyncOrderService) UpdateOrderFromBestshop(cmd command.CreateOrderFromBes |
|
@@ -329,7 +336,7 @@ func (s SyncOrderService) UpdateOrderFromBestshop(cmd command.CreateOrderFromBes |
329
|
if err != nil {
|
336
|
if err != nil {
|
330
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, "获取orderBestshop(order_code=%s)数据失败,err=%s", cmd.OrderCode, err.Error())
|
337
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, "获取orderBestshop(order_code=%s)数据失败,err=%s", cmd.OrderCode, err.Error())
|
331
|
}
|
338
|
}
|
332
|
-
|
339
|
+ // TODO 增加小程序id
|
333
|
orderData.OrderCode = cmd.OrderCode
|
340
|
orderData.OrderCode = cmd.OrderCode
|
334
|
orderData.OrderTime = cmd.OrderTime
|
341
|
orderData.OrderTime = cmd.OrderTime
|
335
|
orderData.OrderState = cmd.OrderState
|
342
|
orderData.OrderState = cmd.OrderState
|
|
@@ -344,6 +351,7 @@ func (s SyncOrderService) UpdateOrderFromBestshop(cmd command.CreateOrderFromBes |
|
@@ -344,6 +351,7 @@ func (s SyncOrderService) UpdateOrderFromBestshop(cmd command.CreateOrderFromBes |
344
|
orderData.DeliveryState = cmd.DeliveryState
|
351
|
orderData.DeliveryState = cmd.DeliveryState
|
345
|
orderData.DeliveryTime = cmd.DeliveryTime
|
352
|
orderData.DeliveryTime = cmd.DeliveryTime
|
346
|
orderData.CompanyId = cmd.CompanyId
|
353
|
orderData.CompanyId = cmd.CompanyId
|
|
|
354
|
+ orderData.WxAppletId = cmd.WxAppletId
|
347
|
err = orderBestshopRepository.Edit(orderData)
|
355
|
err = orderBestshopRepository.Edit(orderData)
|
348
|
if err != nil {
|
356
|
if err != nil {
|
349
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, "编辑order_bestshop失败:"+err.Error())
|
357
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, "编辑order_bestshop失败:"+err.Error())
|