- 调整几个GetLastTotalRowCount时的Commit位置,尽快调用Commit

This commit is contained in:
gazebo
2019-06-28 11:29:42 +08:00
parent 9db43e273a
commit 5c8a5c157a
2 changed files with 10 additions and 6 deletions

View File

@@ -486,6 +486,7 @@ func GetSkuNames(ctx *jxcontext.Context, keyword string, isBySku bool, params ma
// globals.SugarLogger.Debug(utils.Format4Output(sqlParams, false))
if err = dao.GetRows(db, &skuNamesInfo.SkuNames, sqlData, sqlParams...); err == nil {
skuNamesInfo.TotalCount = dao.GetLastTotalRowCount(db)
dao.Commit(db)
for _, skuName := range skuNamesInfo.SkuNames {
if skuName.SkusStr != "" {
if err = utils.UnmarshalUseNumber([]byte(skuName.SkusStr), &skuName.Skus); err != nil {
@@ -500,8 +501,9 @@ func GetSkuNames(ctx *jxcontext.Context, keyword string, isBySku bool, params ma
}
}
}
} else {
dao.Rollback(db)
}
dao.Commit(db)
return skuNamesInfo, err
}

View File

@@ -639,6 +639,11 @@ func GetJdPromotions(ctx *jxcontext.Context, keyword string, params map[string]i
// globals.SugarLogger.Debug(sql)
var promotionList []*tPromotionInfo
if err = dao.GetRows(db, &promotionList, sql, sqlParams...); err == nil {
pagedInfo = &model.PagedInfo{
TotalCount: dao.GetLastTotalRowCount(db),
Data: promotionList,
}
dao.Commit(db)
for _, v := range promotionList {
if v.StoreStr != "" {
if err = utils.UnmarshalUseNumber([]byte(v.StoreStr), &v.Stores); err != nil {
@@ -651,12 +656,9 @@ func GetJdPromotions(ctx *jxcontext.Context, keyword string, params map[string]i
}
}
}
pagedInfo = &model.PagedInfo{
TotalCount: dao.GetLastTotalRowCount(db),
Data: promotionList,
}
} else {
dao.Rollback(db)
}
dao.Commit(db)
return pagedInfo, err
}