This commit is contained in:
苏尹岚
2021-01-20 14:06:40 +08:00
parent ca415b259f
commit 4f61f1f35d
2 changed files with 18 additions and 0 deletions

View File

@@ -177,6 +177,8 @@ func UpdateUserRole(ctx *jxcontext.Context, userIDs []string, roleIDs []int) (er
} }
} }
} }
fmt.Println("1 ", addUserRoleMap)
fmt.Println("2 ", deleteUserRoleMap)
dao.Begin(db) dao.Begin(db)
defer func() { defer func() {
if r := recover(); r != nil { if r := recover(); r != nil {

View File

@@ -518,6 +518,22 @@ func OnPayFinished(orderPay *model.OrderPay) (err error) {
} }
PickupGoods(order, false, "jxadmin") PickupGoods(order, false, "jxadmin")
// } // }
} else {
//普通的订单要看用没用优惠券,用了的话,要把这个用户用过的优惠券状态改了
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.UserCouponStatusUsed
vv.UpdatedAt = time.Now()
dao.UpdateEntity(db, vv, "UserCouponStatus", "UpdatedAt")
}
}
}
} }
} else { } else {
switch orderPay.PayType { switch orderPay.PayType {