修改了系统优惠卷 问诊类型

This commit is contained in:
2024-06-05 17:39:18 +08:00
parent 52888553bf
commit 7f5330361f
4 changed files with 50 additions and 10 deletions
+11 -5
View File
@@ -35,6 +35,11 @@ func (r *CouponService) GetSystemCoupon(couponId int64) (g *dto.CouponDto, err e
g = g.LoadCouponGrant(coupon.CouponGrant)
}
// 加载关联问诊类型
if coupon.InquiryType != "" {
g.LoadInquiryType(coupon.InquiryType)
}
return g, nil
}
@@ -81,7 +86,7 @@ func (r *CouponService) AddSystemCoupon(req requests.AddSystemCoupon) (bool, err
// 适用范围-问诊
if *req.ApplicationScope == 2 {
// 关联问诊类型
if req.InquiryType == nil {
if len(req.InquiryType) == 0 {
return false, errors.New("请填入关联问诊类型")
}
}
@@ -206,8 +211,8 @@ func (r *CouponService) AddSystemCoupon(req requests.AddSystemCoupon) (bool, err
}
// 关联问诊类型
if req.InquiryType != nil {
coupon.InquiryType = *req.InquiryType
if len(req.InquiryType) > 0 {
coupon.InquiryType = strings.Join(req.InquiryType, ",")
}
// 发放关联天数
@@ -306,8 +311,9 @@ func (r *CouponService) PutSystemCoupon(couponId int64, req requests.PutSystemCo
// 关联问诊类型
if coupon.ApplicationScope == 2 {
if req.InquiryType != nil {
if *req.InquiryType != coupon.InquiryType {
if len(req.InquiryType) > 0 {
inquiryType := strings.Join(req.InquiryType, ",")
if inquiryType != coupon.InquiryType {
couponData["inquiry_type"] = req.InquiryType
}
}