- 取消活动时逻辑调整
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user