新增首次购买价格字段

This commit is contained in:
wucongxing8150 2024-08-13 14:18:10 +08:00
parent 068830fff7
commit 36ae49ef4e
4 changed files with 7 additions and 4 deletions

View File

@ -1,7 +1,6 @@
package controller
import (
"fmt"
"github.com/gin-gonic/gin"
"hepa-calc-api/api/dao"
"hepa-calc-api/api/dto"
@ -27,9 +26,9 @@ func (b *SystemMember) GetSystemMember(c *gin.Context) {
// 检测用户是否购买过会员
userService := service.UserService{}
isBuy := userService.CheckUserBuyMember(userId)
if isBuy == true {
if isBuy == false {
for _, member := range systemMembers {
fmt.Println(member)
member.FirstTimePrice = nil
}
}

View File

@ -58,7 +58,7 @@ type OrderMemberRecentListDto struct {
UserId string `json:"user_id"` // 用户id
SystemMemberId string `json:"system_member_id"` // 会员id
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
UserName string `json:"user_name"` // 用户id
UserName string `json:"user_name"` // 用户名称
MemberDays uint `json:"member_days"` // 会员天数
TimeDesc string `json:"time_desc"` // 时间描述
}

View File

@ -12,6 +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"` // 首次购买价格
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
UpdatedAt model.LocalTime `json:"updated_at"` // 更新时间
}
@ -29,6 +30,7 @@ func GetSystemMemberListDto(m []*model.SystemMember) []*SystemMemberDto {
Price: v.Price,
DiscountPrice: v.DiscountPrice,
DiscountEndTime: v.DiscountEndTime,
FirstTimePrice: v.FirstTimePrice,
CreatedAt: v.CreatedAt,
UpdatedAt: v.UpdatedAt,
}
@ -49,6 +51,7 @@ func GetSystemMemberDto(m *model.SystemMember) *SystemMemberDto {
Price: m.Price,
DiscountPrice: m.DiscountPrice,
DiscountEndTime: m.DiscountEndTime,
FirstTimePrice: m.FirstTimePrice,
CreatedAt: m.CreatedAt,
UpdatedAt: m.UpdatedAt,
}

View File

@ -13,6 +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"`
Model
}