修改了优惠卷数据结构
This commit is contained in:
@@ -3,6 +3,7 @@ package dto
|
||||
import (
|
||||
"fmt"
|
||||
"hepa-calc-api/api/model"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type CouponDto struct {
|
||||
@@ -21,6 +22,7 @@ type CouponDto struct {
|
||||
ValidDays int `json:"valid_days"` // 自领取之日起有效天数
|
||||
ValidStartTime model.LocalTime `json:"valid_start_time"` // 开始使用时间
|
||||
ValidEndTime model.LocalTime `json:"valid_end_time"` // 结束使用时间
|
||||
SystemMemberIds []*string `json:"system_member_ids"` // 会员id(适用范围为会员时生效,如果此项为null,则表示所有会员通用)
|
||||
CouponDesc string `json:"coupon_desc"` // 优惠券描述
|
||||
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||
UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间
|
||||
@@ -49,3 +51,21 @@ func GetCouponDto(m *model.Coupon) *CouponDto {
|
||||
UpdatedAt: m.UpdatedAt,
|
||||
}
|
||||
}
|
||||
|
||||
// LoadSystemMemberIds 加载会员id
|
||||
func (r *CouponDto) LoadSystemMemberIds(systemMemberIds string) *CouponDto {
|
||||
if systemMemberIds != "" {
|
||||
s := strings.Split(systemMemberIds, ",")
|
||||
|
||||
response := make([]*string, len(s))
|
||||
|
||||
for i, v := range s {
|
||||
h := fmt.Sprintf("%v", v)
|
||||
response[i] = &h
|
||||
}
|
||||
|
||||
r.SystemMemberIds = response
|
||||
}
|
||||
|
||||
return r
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user