修改了系统优惠卷 问诊类型
This commit is contained in:
+17
-3
@@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
"hospital-admin-api/api/model"
|
||||
"hospital-admin-api/utils"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// CouponDto 优惠卷表
|
||||
@@ -16,7 +17,7 @@ type CouponDto struct {
|
||||
CouponStatus int `json:"coupon_status"` // 状态(1:正常 2:强制失效 3:结束 4:删除)
|
||||
DistributionObject int `json:"distribution_object"` // 发放对象(1:全部用户 2:新注册用户 3:会员 4:近期消费 5:近期购药 6:存量用户 7:健康包服务用户)
|
||||
ApplicationScope int `json:"application_scope"` // 适用范围(1:全场通用 2:问诊 3:按品牌适用 4:按类别适用 5:单品使用 6:全品类药品)
|
||||
InquiryType string `json:"inquiry_type"` // 关联问诊类型,application_scope=问诊时存在生效,逗号分隔(1:全部 2:快速问诊 3:专家问诊 4:公益问诊 5:问诊购药 6:检测)
|
||||
InquiryType []string `json:"inquiry_type"` // 关联问诊类型,application_scope=问诊时存在生效,逗号分隔(1:全部 2:快速问诊 3:专家问诊 4:公益问诊 5:问诊购药 6:检测)
|
||||
BrandId string `json:"brand_id"` // 关联品牌id(如不限制品牌,此项为空)
|
||||
IsMutex int `json:"is_mutex"` // 是否互斥(0:否 1:是)互斥情况下无法和其他优惠卷同时使用
|
||||
IsDisplay int `json:"is_display"` // 是否展示(0:否 1:是)
|
||||
@@ -52,7 +53,6 @@ func GetCouponDto(m *model.Coupon) *CouponDto {
|
||||
CouponStatus: m.CouponStatus,
|
||||
DistributionObject: m.DistributionObject,
|
||||
ApplicationScope: m.ApplicationScope,
|
||||
InquiryType: m.InquiryType,
|
||||
BrandId: fmt.Sprintf("%d", m.BrandId),
|
||||
IsMutex: *m.IsMutex,
|
||||
IsDisplay: m.IsDisplay,
|
||||
@@ -93,7 +93,6 @@ func GetCouponListDto(m []*model.Coupon) []*CouponDto {
|
||||
CouponStatus: v.CouponStatus,
|
||||
DistributionObject: v.DistributionObject,
|
||||
ApplicationScope: v.ApplicationScope,
|
||||
InquiryType: v.InquiryType,
|
||||
BrandId: fmt.Sprintf("%d", v.BrandId),
|
||||
IsMutex: *v.IsMutex,
|
||||
IsDisplay: v.IsDisplay,
|
||||
@@ -117,6 +116,11 @@ func GetCouponListDto(m []*model.Coupon) []*CouponDto {
|
||||
UpdatedAt: v.UpdatedAt,
|
||||
}
|
||||
|
||||
// 加载关联问诊类型
|
||||
if v.InquiryType != "" {
|
||||
response.LoadInquiryType(v.InquiryType)
|
||||
}
|
||||
|
||||
// 将转换后的结构体添加到新切片中
|
||||
responses[i] = response
|
||||
}
|
||||
@@ -134,3 +138,13 @@ func (r *CouponDto) LoadCouponGrant(m []*model.CouponGrant) *CouponDto {
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
// LoadInquiryType 加载关联问诊类型
|
||||
func (r *CouponDto) LoadInquiryType(m string) *CouponDto {
|
||||
if m != "" {
|
||||
inquiryType := strings.Split(m, ",")
|
||||
|
||||
r.InquiryType = inquiryType
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user