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

@@ -194,10 +194,10 @@ func GetAndStoreCitiesShops(ctx *jxcontext.Context, vendorIDs []int, cityCodeLis
globals.SugarLogger.Debugf("process city:%d", cityCode)
shopList, err := GetCityShops(ctx, task, vendorIDs, cityCode, radius, gridWith)
if err == nil {
dao.Begin(db)
txDB , _ := dao.Begin(db)
defer func() {
if r := recover(); r != nil {
dao.Rollback(db)
dao.Rollback(db, txDB)
panic(r)
}
}()
@@ -216,10 +216,10 @@ func GetAndStoreCitiesShops(ctx *jxcontext.Context, vendorIDs []int, cityCodeLis
}
}
if err != nil {
dao.Rollback(db)
dao.Rollback(db, txDB)
} else {
hint = utils.Int2Str(len(shopList))
dao.Commit(db)
dao.Commit(db, txDB)
}
}
globals.SugarLogger.Debugf("process city:%d, len(shopList):%d, err:%v", cityCode, len(shopList), err)