From faca22c9935d50e70414fac67b108d32075d6876 Mon Sep 17 00:00:00 2001 From: gazebo Date: Thu, 20 Jun 2019 09:41:00 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E5=8F=96=E6=B6=88=E6=B4=BB=E5=8A=A8?= =?UTF-8?q?=E6=97=B6=E9=80=BB=E8=BE=91=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/promotion/jd_promotion.go | 27 +++++++++++++--------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/business/jxstore/promotion/jd_promotion.go b/business/jxstore/promotion/jd_promotion.go index 2b78d6fda..3910a50b2 100644 --- a/business/jxstore/promotion/jd_promotion.go +++ b/business/jxstore/promotion/jd_promotion.go @@ -653,20 +653,25 @@ func CancelJdPromotion(ctx *jxcontext.Context, promotionID int) (err error) { if err = dao.GetEntity(db, promotion); err != nil { return err } - if promotion.Status != model.PromotionStatusRemoteCreated { - return errors.New("当前状态不能进行取消操作") + if promotion.Status != model.PromotionStatusCanceled { + return errors.New("当前状态已经是取消") } - promotionHandler := getPromotionHander(promotion.Type) - if promotionHandler == nil { - return errors.New("非法的活动类型") - } - if err = promotionHandler.CancelPromotion(utils.Str2Int64(promotion.VendorPromotionID), ""); err == nil { - if _, err = dao.UpdateEntityLogically(db, promotion, map[string]interface{}{ - "Status": model.PromotionStatusCanceled, - }, ctx.GetUserName(), nil); err == nil { - RefreshJdPromotionLockStatus(ctx, promotionID) + if promotion.Status == model.PromotionStatusRemoteCreated { + if promotion.VendorPromotionID != "" { + promotionHandler := getPromotionHander(promotion.Type) + if promotionHandler == nil { + return errors.New("非法的活动类型") + } + if err = promotionHandler.CancelPromotion(utils.Str2Int64(promotion.VendorPromotionID), ""); err != nil { + return err + } } } + if _, err = dao.UpdateEntityLogically(db, promotion, map[string]interface{}{ + "Status": model.PromotionStatusCanceled, + }, ctx.GetUserName(), nil); err == nil { + // RefreshJdPromotionLockStatus(ctx, promotionID) + } return err }