This commit is contained in:
苏尹岚
2021-03-30 17:39:07 +08:00
parent b9f7d7f53a
commit 0dd7235485
49 changed files with 579 additions and 582 deletions

View File

@@ -84,10 +84,10 @@ func BeginSavePriceRefer(ctx *jxcontext.Context, cityCodes, skuIDs []int, isAsyn
case 0:
priceReferSnapshot, err := dao.GetStatisticsReportForStoreSkusPrice(db, cityCodes, skuIDs)
if len(priceReferSnapshot) > 0 {
dao.Begin(db)
txDB , _ := dao.Begin(db)
defer func() {
if r := recover(); r != nil || err != nil {
dao.Rollback(db)
dao.Rollback(db, txDB)
if r != nil {
panic(r)
}
@@ -98,7 +98,7 @@ func BeginSavePriceRefer(ctx *jxcontext.Context, cityCodes, skuIDs []int, isAsyn
v.SnapshotAt = snapshotAt
}
dao.CreateMultiEntities(db, priceReferSnapshot)
dao.Commit(db)
dao.Commit(db, txDB)
}
case 1:
priceReferSnapshotList, err = dao.GetPriceReferSnapshotNoPage(db, nil, nil, nil, snapshotAt)
@@ -214,10 +214,10 @@ func BeginSavePriceRefer(ctx *jxcontext.Context, cityCodes, skuIDs []int, isAsyn
}
resultMap[k1] = skuNameMap
}
dao.Begin(db)
txDB , _ := dao.Begin(db)
defer func() {
if r := recover(); r != nil || err != nil {
dao.Rollback(db)
dao.Rollback(db, txDB)
if r != nil {
panic(r)
}
@@ -244,12 +244,12 @@ func BeginSavePriceRefer(ctx *jxcontext.Context, cityCodes, skuIDs []int, isAsyn
}
}
}
dao.Commit(db)
dao.Commit(db, txDB)
case 2:
dao.Begin(db)
txDB , _ := dao.Begin(db)
defer func() {
if r := recover(); r != nil || err != nil {
dao.Rollback(db)
dao.Rollback(db, txDB)
if r != nil {
panic(r)
}
@@ -265,7 +265,7 @@ func BeginSavePriceRefer(ctx *jxcontext.Context, cityCodes, skuIDs []int, isAsyn
dao.UpdateEntity(db, v, "MidPrice", "MaxPrice", "MinPrice", "AvgPrice")
}
}
dao.Commit(db)
dao.Commit(db, txDB)
//TODO 京东查询接口报错,暂时屏蔽了
// case 3:
// priceReferSnapshotList, err = dao.GetPriceReferSnapshotNoPage(db, []int{0}, nil, nil, snapshotAt)