aa
This commit is contained in:
@@ -1314,6 +1314,21 @@ func CancelOrder(ctx *jxcontext.Context, order *model.GoodsOrder, reason string)
|
||||
}
|
||||
}
|
||||
if err == nil {
|
||||
//如果用了优惠券,状态要刷回去
|
||||
if order.CouponIDs != "" {
|
||||
sCouponIDs := strings.Split(order.CouponIDs, ",")
|
||||
couponIDs := []int{}
|
||||
for _, v := range sCouponIDs {
|
||||
couponIDs = append(couponIDs, utils.Str2Int(v))
|
||||
}
|
||||
if userCoupons, err := dao.GetUserCoupons(db, couponIDs, []string{order.UserID}, nil, model.CouponStatusNormal); err == nil {
|
||||
for _, vv := range userCoupons {
|
||||
vv.UserCouponStatus = model.CouponStatusNormal
|
||||
vv.UpdatedAt = time.Now()
|
||||
dao.UpdateEntity(db, vv, "UserCouponStatus", "UpdatedAt")
|
||||
}
|
||||
}
|
||||
}
|
||||
MarkArrears(db, order, orderPay)
|
||||
err2 := CancelMatterOrder(db, order, reason)
|
||||
errList.AddErr(err2)
|
||||
|
||||
Reference in New Issue
Block a user