...
|
...
|
@@ -37,7 +37,7 @@ func (s SyncOrderService) SyncOrderFromBestshop(cmd command.CreateOrderFromBests |
|
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
defer func() {
|
|
|
transactionContext.RollbackTransaction()
|
|
|
_ = transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
|
|
|
//检查账号是否存在
|
...
|
...
|
@@ -101,7 +101,7 @@ func (s SyncOrderService) CreateOrderFromBestshop(cmd command.CreateOrderFromBes |
|
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
defer func() {
|
|
|
transactionContext.RollbackTransaction()
|
|
|
_ = transactionContext.RollbackTransaction()
|
|
|
}()
|
|
|
var (
|
|
|
orderBestshopRepository domain.OrderBestshopRepository
|
...
|
...
|
@@ -117,6 +117,7 @@ func (s SyncOrderService) CreateOrderFromBestshop(cmd command.CreateOrderFromBes |
|
|
}); err != nil {
|
|
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error())
|
|
|
}
|
|
|
// TODO 增加小程序id
|
|
|
order := domain.OrderBestShop{
|
|
|
OrderCode: cmd.OrderCode,
|
|
|
OrderTime: cmd.OrderTime,
|
...
|
...
|
@@ -135,6 +136,7 @@ func (s SyncOrderService) CreateOrderFromBestshop(cmd command.CreateOrderFromBes |
|
|
IsCopy: false,
|
|
|
CompanyId: cmd.CompanyId,
|
|
|
OrderArea: cmd.OrderArea,
|
|
|
WxAppletId: cmd.WxAppletId,
|
|
|
}
|
|
|
err = orderBestshopRepository.Add(&order)
|
|
|
if err != nil {
|
...
|
...
|
@@ -232,11 +234,16 @@ func (s SyncOrderService) copyOrderBestshopToOrderBase(orderBestshop *domain.Ord |
|
|
e := fmt.Sprintf("未找到指定的合伙人的公司(partner_id=%d,company_id=%d)数据,%s", orderBestshop.PartnerId, partnerData.CompanyId, err)
|
|
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, e)
|
|
|
}
|
|
|
// TODO 判断多小程序
|
|
|
for _, v := range companyData.Applets {
|
|
|
//BEST_SHOP_UNIONID string = "gh_18eb644002fb" //香米小程序原始id
|
|
|
//接收香米小程序的订单数据
|
|
|
if len(v.Id) > 0 {
|
|
|
//if len(v.Id) > 0 {
|
|
|
// canCopyOrder = true
|
|
|
//}
|
|
|
if v.Id == orderBestshop.WxAppletId {
|
|
|
canCopyOrder = true
|
|
|
break
|
|
|
}
|
|
|
}
|
|
|
if !canCopyOrder {
|
...
|
...
|
@@ -329,7 +336,7 @@ func (s SyncOrderService) UpdateOrderFromBestshop(cmd command.CreateOrderFromBes |
|
|
if err != nil {
|
|
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, "获取orderBestshop(order_code=%s)数据失败,err=%s", cmd.OrderCode, err.Error())
|
|
|
}
|
|
|
|
|
|
// TODO 增加小程序id
|
|
|
orderData.OrderCode = cmd.OrderCode
|
|
|
orderData.OrderTime = cmd.OrderTime
|
|
|
orderData.OrderState = cmd.OrderState
|
...
|
...
|
@@ -344,6 +351,7 @@ func (s SyncOrderService) UpdateOrderFromBestshop(cmd command.CreateOrderFromBes |
|
|
orderData.DeliveryState = cmd.DeliveryState
|
|
|
orderData.DeliveryTime = cmd.DeliveryTime
|
|
|
orderData.CompanyId = cmd.CompanyId
|
|
|
orderData.WxAppletId = cmd.WxAppletId
|
|
|
err = orderBestshopRepository.Edit(orderData)
|
|
|
if err != nil {
|
|
|
return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, "编辑order_bestshop失败:"+err.Error())
|
...
|
...
|
|