1
This commit is contained in:
@@ -721,7 +721,6 @@ func CreateActForMtByOrder(ctx *jxcontext.Context, act *model.Act, vendorIDs []i
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
globals.SugarLogger.Debugf("================createACte := %s", utils.Format4Output(1111, false))
|
||||
txDB, _ := dao.Begin(db)
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
@@ -730,7 +729,6 @@ func CreateActForMtByOrder(ctx *jxcontext.Context, act *model.Act, vendorIDs []i
|
||||
}
|
||||
}()
|
||||
dao.WrapAddIDCULDEntity(act, ctx.GetUserName())
|
||||
globals.SugarLogger.Debugf("================createACte := %s", utils.Format4Output(2222, false))
|
||||
err = dao.CreateEntityTx(txDB, act)
|
||||
if err != nil {
|
||||
dao.Rollback(db, txDB)
|
||||
@@ -741,14 +739,12 @@ func CreateActForMtByOrder(ctx *jxcontext.Context, act *model.Act, vendorIDs []i
|
||||
VendorID: vendorID,
|
||||
VendorOrgCode: vendorOrgCode,
|
||||
}
|
||||
globals.SugarLogger.Debugf("================createACte := %s", utils.Format4Output(3333, false))
|
||||
dao.WrapAddIDCULDEntity(actMap, ctx.GetUserName())
|
||||
err = dao.CreateEntityTx(txDB, actMap)
|
||||
if err != nil {
|
||||
dao.Rollback(db, txDB)
|
||||
return err
|
||||
}
|
||||
globals.SugarLogger.Debugf("================createACte := %s", utils.Format4Output(444, false))
|
||||
for storeID, storeSkus := range actStoreSkuMap {
|
||||
for _, storeSku := range storeSkus {
|
||||
actStoreSkuModel := &model.ActStoreSku{
|
||||
@@ -760,7 +756,6 @@ func CreateActForMtByOrder(ctx *jxcontext.Context, act *model.Act, vendorIDs []i
|
||||
ActPrice: int64(storeSku.JdsPrice),
|
||||
}
|
||||
dao.WrapAddIDCULDEntity(actStoreSkuModel, ctx.GetUserName())
|
||||
globals.SugarLogger.Debugf("================createACte := %s", utils.Format4Output(555, false))
|
||||
err = dao.CreateEntityTx(txDB, actStoreSkuModel)
|
||||
if err != nil {
|
||||
dao.Rollback(db, txDB)
|
||||
@@ -776,7 +771,6 @@ func CreateActForMtByOrder(ctx *jxcontext.Context, act *model.Act, vendorIDs []i
|
||||
ActualActPrice: int64(storeSku.JdsPrice),
|
||||
}
|
||||
dao.WrapAddIDCULDEntity(actStoreSkuMapModel, ctx.GetUserName())
|
||||
globals.SugarLogger.Debugf("================createACte := %s", utils.Format4Output(666, false))
|
||||
err = dao.CreateEntityTx(txDB, actStoreSkuMapModel)
|
||||
if err != nil {
|
||||
dao.Rollback(db, txDB)
|
||||
@@ -784,13 +778,11 @@ func CreateActForMtByOrder(ctx *jxcontext.Context, act *model.Act, vendorIDs []i
|
||||
}
|
||||
}
|
||||
}
|
||||
globals.SugarLogger.Debugf("================createACte := %s", utils.Format4Output(1111, false))
|
||||
dao.Commit(db, txDB)
|
||||
if !globals.IsProductEnv() {
|
||||
return err
|
||||
}
|
||||
//同步建到美团
|
||||
globals.SugarLogger.Debugf("================actStoreSkuMap := %s", utils.Format4Output(actStoreSkuMap, false))
|
||||
for storeID, storeSkus := range actStoreSkuMap {
|
||||
if storeDetail, _ := dao.GetStoreDetail(db, storeID, vendorID, vendorOrgCode); storeDetail != nil {
|
||||
var actData []*mtwmapi.RetailDiscountActData
|
||||
@@ -807,10 +799,8 @@ func CreateActForMtByOrder(ctx *jxcontext.Context, act *model.Act, vendorIDs []i
|
||||
})
|
||||
}
|
||||
actIdResult := make(map[string]int64, 0)
|
||||
actResult, faileInfoList, err := api.MtwmAPI.RetailDiscountBatchSave2(storeDetail.VendorStoreID, actType, actData)
|
||||
globals.SugarLogger.Debugf("================actResult := %s", utils.Format4Output(actResult, false))
|
||||
globals.SugarLogger.Debugf("================faileInfoList := %s", utils.Format4Output(faileInfoList, false))
|
||||
globals.SugarLogger.Debugf("================err := %v", err)
|
||||
mtApi := mtwm.GetAPI(vendorOrgCode, storeID, storeDetail.VendorStoreID)
|
||||
actResult, fileInfoList, _ := mtApi.RetailDiscountBatchSave2(storeDetail.VendorStoreID, actType, actData)
|
||||
for _, v := range actResult {
|
||||
var (
|
||||
actStoreSkuMapUpdate *model.ActStoreSkuMap
|
||||
@@ -842,9 +832,9 @@ func CreateActForMtByOrder(ctx *jxcontext.Context, act *model.Act, vendorIDs []i
|
||||
actData2[i-1].Sequence = i
|
||||
actData2[i-1].OrderLimit = 1
|
||||
}
|
||||
api.MtwmAPI.RetailDiscountBatchSave2(storeDetail.VendorStoreID, actType, actData2)
|
||||
mtApi.RetailDiscountBatchSave2(storeDetail.VendorStoreID, actType, actData2)
|
||||
}
|
||||
for _, v := range faileInfoList {
|
||||
for _, v := range fileInfoList {
|
||||
err2 += fmt.Sprintf("创建失败!门店ID:[%v],商品ID:[%v],原因:[%v]", storeID, v.AppFoodCode, v.ErrorMsg)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user