- 调整几个GetLastTotalRowCount时的Commit位置,尽快调用Commit
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user