新增了首单立减金额
This commit is contained in:
parent
747a060c2d
commit
bb17607133
@ -246,7 +246,6 @@ func (b *Public) GetIndexData(c *gin.Context) {
|
||||
date := time.Time(user.CreatedAt).Format("2006-01-02")
|
||||
results[date]++
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 新增算算数
|
||||
|
||||
@ -157,18 +157,18 @@ func (b *SystemMember) PutSystemMember(c *gin.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
// 首单优惠价格
|
||||
if req.FirstTimePrice != nil {
|
||||
if systemMember.FirstTimePrice == nil {
|
||||
systemMemberData["first_time_price"] = req.FirstTimePrice
|
||||
// 首单立减金额
|
||||
if req.ReductionAmount != nil {
|
||||
if systemMember.ReductionAmount == nil {
|
||||
systemMemberData["reduction_amount"] = req.ReductionAmount
|
||||
} else {
|
||||
if *req.FirstTimePrice != *systemMember.FirstTimePrice {
|
||||
systemMemberData["first_time_price"] = req.FirstTimePrice
|
||||
if *req.ReductionAmount != *systemMember.ReductionAmount {
|
||||
systemMemberData["reduction_amount"] = req.ReductionAmount
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if systemMember.FirstTimePrice != nil {
|
||||
systemMemberData["first_time_price"] = nil
|
||||
if systemMember.ReductionAmount != nil {
|
||||
systemMemberData["reduction_amount"] = nil
|
||||
}
|
||||
}
|
||||
|
||||
@ -232,7 +232,7 @@ func (b *SystemMember) AddSystemMember(c *gin.Context) {
|
||||
MemberDays: req.MemberDays,
|
||||
Price: req.Price,
|
||||
DiscountPrice: req.DiscountPrice,
|
||||
FirstTimePrice: req.FirstTimePrice,
|
||||
ReductionAmount: req.ReductionAmount,
|
||||
}
|
||||
|
||||
// 处理优惠截止时间
|
||||
|
||||
@ -12,7 +12,7 @@ type SystemMemberDto struct {
|
||||
Price float64 `json:"price"` // 价格(原价)
|
||||
DiscountPrice *float64 `json:"discount_price"` // 优惠价格
|
||||
DiscountEndTime *model.LocalTime `json:"discount_end_time"` // 优惠截止时间
|
||||
FirstTimePrice *float64 `json:"first_time_price"` // 首次购买价格
|
||||
ReductionAmount *float64 `json:"reduction_amount"` // 立减金额
|
||||
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||
UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间
|
||||
}
|
||||
@ -30,7 +30,7 @@ func GetSystemMemberListDto(m []*model.SystemMember) []*SystemMemberDto {
|
||||
Price: v.Price,
|
||||
DiscountPrice: v.DiscountPrice,
|
||||
DiscountEndTime: v.DiscountEndTime,
|
||||
FirstTimePrice: v.FirstTimePrice,
|
||||
ReductionAmount: v.ReductionAmount,
|
||||
CreatedAt: v.CreatedAt,
|
||||
UpdatedAt: v.UpdatedAt,
|
||||
}
|
||||
@ -51,7 +51,7 @@ func GetSystemMemberDto(m *model.SystemMember) *SystemMemberDto {
|
||||
Price: m.Price,
|
||||
DiscountPrice: m.DiscountPrice,
|
||||
DiscountEndTime: m.DiscountEndTime,
|
||||
FirstTimePrice: m.FirstTimePrice,
|
||||
ReductionAmount: m.ReductionAmount,
|
||||
CreatedAt: m.CreatedAt,
|
||||
UpdatedAt: m.UpdatedAt,
|
||||
}
|
||||
|
||||
@ -13,7 +13,7 @@ type SystemMember struct {
|
||||
Price float64 `gorm:"column:price;type:decimal(10,2);default:0.00;comment:价格(原价)" json:"price"`
|
||||
DiscountPrice *float64 `gorm:"column:discount_price;type:decimal(10,2);comment:优惠价格" json:"discount_price"`
|
||||
DiscountEndTime *LocalTime `gorm:"column:discount_end_time;type:datetime;comment:优惠截止时间" json:"discount_end_time"`
|
||||
FirstTimePrice *float64 `gorm:"column:first_time_price;type:decimal(10,2);comment:首次购买价格" json:"first_time_price"`
|
||||
ReductionAmount *float64 `gorm:"column:reduction_amount;type:decimal(10,2);comment:首单立减金额" json:"reduction_amount"`
|
||||
Model
|
||||
}
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@ type PutSystemMember struct {
|
||||
Price float64 `json:"price" form:"price" label:"价格(原价)" validate:"required,numeric,min=0"`
|
||||
DiscountPrice *float64 `json:"discount_price" form:"discount_price" label:"优惠价格" validate:"omitempty,numeric,min=0"`
|
||||
DiscountEndTime *string `json:"discount_end_time" form:"discount_end_time" label:"优惠截止时间"`
|
||||
FirstTimePrice *float64 `json:"first_time_price" form:"first_time_price" label:"首次购买价格"`
|
||||
ReductionAmount *float64 `json:"reduction_amount" form:"reduction_amount" label:"首单立减金额"`
|
||||
}
|
||||
|
||||
// AddSystemMember 新增会员配置
|
||||
@ -20,5 +20,5 @@ type AddSystemMember struct {
|
||||
Price float64 `json:"price" form:"price" label:"价格(原价)" validate:"required,numeric,min=0"`
|
||||
DiscountPrice *float64 `json:"discount_price" form:"discount_price" label:"优惠价格" validate:"omitempty,numeric,min=0"`
|
||||
DiscountEndTime *string `json:"discount_end_time" form:"discount_end_time" label:"优惠截止时间"`
|
||||
FirstTimePrice *float64 `json:"first_time_price" form:"first_time_price" label:"首次购买价格"`
|
||||
ReductionAmount *float64 `json:"reduction_amount" form:"reduction_amount" label:"首单立减金额"`
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user