问题优惠过期时间
This commit is contained in:
parent
978dadf14e
commit
4b8671a765
@ -3,7 +3,6 @@ package dto
|
||||
import (
|
||||
"fmt"
|
||||
"hepa-calc-api/api/model"
|
||||
"time"
|
||||
)
|
||||
|
||||
// QuestionDto 问题表
|
||||
@ -20,7 +19,7 @@ type QuestionDto struct {
|
||||
PayCount int `json:"pay_count"` // 支付次数(查看报告的人次)
|
||||
Price float64 `json:"price"` // 价格(原价)
|
||||
DiscountPrice *float64 `json:"discount_price"` // 优惠价格
|
||||
DiscountEndTime *time.Time `json:"discount_end_time"` // 优惠截止时间
|
||||
DiscountEndTime *model.LocalTime `json:"discount_end_time"` // 优惠截止时间
|
||||
QuestionBrief string `json:"question_brief"` // 问题介绍
|
||||
QuestionExplain string `json:"question_explain"` // 问题解释/科普
|
||||
CreatedAt model.LocalTime `json:"created_at"` // 创建时间
|
||||
|
||||
@ -20,7 +20,7 @@ type Question struct {
|
||||
PayCount int `gorm:"column:pay_count;type:int(5);default:0;comment:支付次数(查看报告的人次)" json:"pay_count"`
|
||||
Price float64 `gorm:"column:price;type:decimal(10,2) unsigned;default:0.00;comment:价格(原价)" json:"price"`
|
||||
DiscountPrice *float64 `gorm:"column:discount_price;type:decimal(10,2);comment:优惠价格" json:"discount_price"`
|
||||
DiscountEndTime *time.Time `gorm:"column:discount_end_time;type:datetime;comment:优惠截止时间" json:"discount_end_time"`
|
||||
DiscountEndTime *LocalTime `gorm:"column:discount_end_time;type:datetime;comment:优惠截止时间" json:"discount_end_time"`
|
||||
QuestionBrief string `gorm:"column:question_brief;type:text;comment:问题介绍" json:"question_brief"`
|
||||
QuestionExplain string `gorm:"column:question_explain;type:text;comment:问题解释/科普" json:"question_explain"`
|
||||
Model
|
||||
|
||||
@ -200,9 +200,11 @@ func (r *QuestionService) CheckQuestion(m *model.Question) (bool, error) {
|
||||
}
|
||||
|
||||
// HandleQuestionDiscountPrice 处理问题优惠价格
|
||||
func (r *QuestionService) HandleQuestionDiscountPrice(discountPrice *float64, discountEndTime *time.Time) (p *float64) {
|
||||
func (r *QuestionService) HandleQuestionDiscountPrice(discountPrice *float64, discountEndTime *model.LocalTime) (p *float64) {
|
||||
// 优惠价格
|
||||
if discountPrice != nil {
|
||||
discountEndTime := time.Time(*discountEndTime)
|
||||
|
||||
// 检测是否超出优惠时间
|
||||
now := time.Now()
|
||||
if discountEndTime.Before(now) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user