修改了优惠卷数据结构
This commit is contained in:
@@ -2,10 +2,12 @@ package service
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"gorm.io/gorm"
|
||||
"hepa-calc-api/api/dao"
|
||||
"hepa-calc-api/api/dto"
|
||||
"hepa-calc-api/api/model"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -58,10 +60,6 @@ func (r *UserCouponService) CheckUserCoupon(m *model.UserCoupon, id int64, order
|
||||
if m.Coupon.ApplicationScope != 1 && m.Coupon.ApplicationScope != 2 {
|
||||
return false, errors.New("优惠卷无法使用")
|
||||
}
|
||||
|
||||
if id != m.Coupon.QuestionId {
|
||||
return false, errors.New("优惠卷无法使用")
|
||||
}
|
||||
}
|
||||
|
||||
// 会员
|
||||
@@ -70,7 +68,9 @@ func (r *UserCouponService) CheckUserCoupon(m *model.UserCoupon, id int64, order
|
||||
return false, errors.New("优惠卷无法使用")
|
||||
}
|
||||
|
||||
if id != m.Coupon.SystemMemberId {
|
||||
systemMemberIds := fmt.Sprintf("%d", id)
|
||||
res := strings.Contains(m.Coupon.SystemMemberIds, systemMemberIds)
|
||||
if res == false {
|
||||
return false, errors.New("优惠卷无法使用")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user