添加优惠券功能,实现价格计算

This commit is contained in:
2025-04-19 14:59:19 +08:00
parent 999d0b0a1d
commit 058c4f4313
9 changed files with 581 additions and 19 deletions

34
web/models/coupon.gen.go Normal file
View File

@@ -0,0 +1,34 @@
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package models
import (
"platform/web/common"
"time"
"gorm.io/gorm"
)
const TableNameCoupon = "coupon"
// Coupon mapped from table <coupon>
type Coupon struct {
ExpireAt time.Time `gorm:"column:expire_at" json:"expire_at"`
CreatedAt common.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP" json:"created_at"`
UpdatedAt common.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP" json:"updated_at"`
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at" json:"deleted_at"`
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true" json:"id"`
UserID int32 `gorm:"column:user_id" json:"user_id"`
Status int32 `gorm:"column:status;not null" json:"status"`
Code string `gorm:"column:code;not null" json:"code"`
Remark string `gorm:"column:remark" json:"remark"`
Amount float64 `gorm:"column:amount;not null" json:"amount"`
MinAmount float64 `gorm:"column:min_amount;not null" json:"min_amount"`
}
// TableName Coupon's table name
func (*Coupon) TableName() string {
return TableNameCoupon
}