From bb176071330e6204f7c8dbf2dea1816400574f7b Mon Sep 17 00:00:00 2001 From: wucongxing8150 <815046773@qq.com> Date: Mon, 9 Sep 2024 11:14:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=BA=86=E9=A6=96=E5=8D=95?= =?UTF-8?q?=E7=AB=8B=E5=87=8F=E9=87=91=E9=A2=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/controller/Public.go | 1 - api/controller/SystemMember.go | 24 ++++++++++++------------ api/dto/SystemMember.go | 6 +++--- api/model/SystemMember.go | 2 +- api/requests/SystemMember.go | 4 ++-- 5 files changed, 18 insertions(+), 19 deletions(-) diff --git a/api/controller/Public.go b/api/controller/Public.go index b4d6c53..7a17325 100644 --- a/api/controller/Public.go +++ b/api/controller/Public.go @@ -246,7 +246,6 @@ func (b *Public) GetIndexData(c *gin.Context) { date := time.Time(user.CreatedAt).Format("2006-01-02") results[date]++ } - } // 新增算算数 diff --git a/api/controller/SystemMember.go b/api/controller/SystemMember.go index 8054760..f2d2f26 100644 --- a/api/controller/SystemMember.go +++ b/api/controller/SystemMember.go @@ -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 } } @@ -229,10 +229,10 @@ func (b *SystemMember) AddSystemMember(c *gin.Context) { }() systemMember := &model.SystemMember{ - MemberDays: req.MemberDays, - Price: req.Price, - DiscountPrice: req.DiscountPrice, - FirstTimePrice: req.FirstTimePrice, + MemberDays: req.MemberDays, + Price: req.Price, + DiscountPrice: req.DiscountPrice, + ReductionAmount: req.ReductionAmount, } // 处理优惠截止时间 diff --git a/api/dto/SystemMember.go b/api/dto/SystemMember.go index 191fce4..e468d1b 100644 --- a/api/dto/SystemMember.go +++ b/api/dto/SystemMember.go @@ -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, } diff --git a/api/model/SystemMember.go b/api/model/SystemMember.go index 50d017c..5d533f9 100644 --- a/api/model/SystemMember.go +++ b/api/model/SystemMember.go @@ -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 } diff --git a/api/requests/SystemMember.go b/api/requests/SystemMember.go index 24b727b..f173b40 100644 --- a/api/requests/SystemMember.go +++ b/api/requests/SystemMember.go @@ -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:"首单立减金额"` }