修改秒杀
This commit is contained in:
25
model/good/goods.go
Normal file
25
model/good/goods.go
Normal 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"
|
||||
}
|
||||
@@ -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"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user