修改秒杀

This commit is contained in:
JACKYMYPERSON
2025-09-14 21:12:37 +08:00
parent db98ed80e2
commit 2ab7614ea0
8 changed files with 314 additions and 257 deletions

25
model/good/goods.go Normal file
View File

@@ -0,0 +1,25 @@
package good
import "time"
type Goods struct {
GID string `gorm:"column:gid"`
Stock int `gorm:"column:stock"`
StartTime time.Time `gorm:"column:start_time"`
EndTime time.Time `gorm:"column:end_time"`
}
// Order 订单模型,对应 orders_list 表
type Order struct {
OrderId string `gorm:"column:order_id"` // 关联商品ID
TradeTime time.Time `gorm:"column:trade_time"`
}
// 为模型指定数据库表名
func (Goods) TableName() string {
return "goods_list"
}
func (Order) TableName() string {
return "oders_list"
}

View File

@@ -4,3 +4,10 @@ type UserRequest struct {
UserID int `json:"user_id"`
Order string `json:"userorder"` // 对应商品标识stock10000 ~ stock10004
}
type OrderMessage struct {
OrderID string `json:"order_id"`
GoodsID string `json:"goods_id"`
UserID int `json:"user_id"`
Quantity int `json:"quantity"`
}