- check status in CancelPromotion.

- return more accurate error in user related funcs
This commit is contained in:
gazebo
2018-11-06 08:34:23 +08:00
parent ee5e7ffe18
commit 434827abe6
2 changed files with 16 additions and 3 deletions

View File

@@ -555,6 +555,9 @@ 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("当前状态不能进行取消操作")
}
promotionHandler := getPromotionHander(promotion.Type)
if promotionHandler == nil {
return errors.New("非法的促销类型")