From 5c8a5c157a755f741f4520e7f6b111b7dfeca388 Mon Sep 17 00:00:00 2001 From: gazebo Date: Fri, 28 Jun 2019 11:29:42 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E8=B0=83=E6=95=B4=E5=87=A0=E4=B8=AAGetLast?= =?UTF-8?q?TotalRowCount=E6=97=B6=E7=9A=84Commit=E4=BD=8D=E7=BD=AE?= =?UTF-8?q?=EF=BC=8C=E5=B0=BD=E5=BF=AB=E8=B0=83=E7=94=A8Commit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/sku.go | 4 +++- business/jxstore/promotion/jd_promotion.go | 12 +++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/business/jxstore/cms/sku.go b/business/jxstore/cms/sku.go index b54947091..4609fac23 100644 --- a/business/jxstore/cms/sku.go +++ b/business/jxstore/cms/sku.go @@ -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 } diff --git a/business/jxstore/promotion/jd_promotion.go b/business/jxstore/promotion/jd_promotion.go index 67deb83c0..5eb547bbb 100644 --- a/business/jxstore/promotion/jd_promotion.go +++ b/business/jxstore/promotion/jd_promotion.go @@ -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 }