From f24a9d6bb6e007fef19c22771068a6094f3d95c9 Mon Sep 17 00:00:00 2001 From: gazebo Date: Mon, 5 Nov 2018 15:34:22 +0800 Subject: [PATCH] - update local status when cancel promotion successfully --- business/jxstore/promotion/jd_promotion.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/business/jxstore/promotion/jd_promotion.go b/business/jxstore/promotion/jd_promotion.go index ce02e7866..2311e696f 100644 --- a/business/jxstore/promotion/jd_promotion.go +++ b/business/jxstore/promotion/jd_promotion.go @@ -339,8 +339,9 @@ func CreateJdPromotion(ctx *jxcontext.Context, isIDJd bool, isAsync bool, params promotion.Status = model.PromotionStatusRemoteFailed } db := dao.GetDB() - dao.WrapUpdateULEntity(promotion, userName) - _, err = dao.UpdateEntity(db, promotion, "Status") + _, err = dao.UpdateEntityLogically(db, promotion, map[string]interface{}{ + "Status": promotion.Status, + }, ctx.GetUserName(), nil) } return nil, err }, 4) @@ -542,7 +543,11 @@ func CancelJdPromotion(ctx *jxcontext.Context, promotionID int) (err error) { if promotionHandler == nil { return errors.New("非法的促销类型") } - err = promotionHandler.CancelPromotion(utils.Str2Int64(promotion.VendorPromotionID), "") + if err = promotionHandler.CancelPromotion(utils.Str2Int64(promotion.VendorPromotionID), ""); err == nil { + _, err = dao.UpdateEntityLogically(db, promotion, map[string]interface{}{ + "Status": model.PromotionStatusCanceled, + }, ctx.GetUserName(), nil) + } return err }