修改了立减金额
This commit is contained in:
@@ -6,7 +6,6 @@ import (
|
||||
"hepa-calc-api/api/dto"
|
||||
"hepa-calc-api/api/responses"
|
||||
"hepa-calc-api/api/service"
|
||||
"math"
|
||||
)
|
||||
|
||||
type SystemMember struct{}
|
||||
@@ -29,7 +28,7 @@ func (b *SystemMember) GetSystemMember(c *gin.Context) {
|
||||
isBuy := userService.CheckUserBuyMember(userId)
|
||||
if isBuy == true {
|
||||
for _, member := range systemMembers {
|
||||
member.FirstTimePrice = nil
|
||||
member.ReductionAmount = nil
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,20 +63,17 @@ func (b *SystemMember) GetSystemMemberLeast(c *gin.Context) {
|
||||
}
|
||||
|
||||
for _, member := range systemMembers {
|
||||
if member.FirstTimePrice == nil {
|
||||
if member.ReductionAmount == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
amount := member.Price - *member.FirstTimePrice
|
||||
amount = math.Round(amount*100) / 100
|
||||
|
||||
if reductionAmount == nil {
|
||||
reductionAmount = &amount
|
||||
reductionAmount = member.ReductionAmount
|
||||
continue
|
||||
}
|
||||
|
||||
if amount < *reductionAmount {
|
||||
reductionAmount = &amount
|
||||
if *member.ReductionAmount < *reductionAmount {
|
||||
reductionAmount = member.ReductionAmount
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user