代码推送

This commit is contained in:
2026-09-09 02:39:57 +08:00
parent a112893947
commit 5e47757c73
24 changed files with 1156 additions and 226 deletions

View File

@@ -14,25 +14,25 @@ type RestaurantCategory struct {
// Restaurant 餐厅模型(3 套外卖网站共用同一套数据)
type Restaurant struct {
ID uint `gorm:"primaryKey" json:"id"`
Name string `gorm:"size:100;not null" json:"name"`
Description string `gorm:"type:text" json:"description"`
CategoryID uint `gorm:"index" json:"category_id"`
CategoryName string `gorm:"size:50" json:"category_name"`
Cover string `gorm:"size:255" json:"cover"` // 封面图URL
Logo string `gorm:"size:255" json:"logo"` // Logo URL
Rating float64 `gorm:"type:decimal(2,1);default:4.5" json:"rating"`
Sales int `gorm:"default:0" json:"sales"` // 月销量
DeliveryFee float64 `gorm:"type:decimal(6,2);default:0" json:"delivery_fee"` // 配送费
MinOrder float64 `gorm:"type:decimal(6,2);default:0" json:"min_order"` // 起送价
DeliveryTime int `json:"delivery_time"` // 配送时间(分钟)
Distance string `gorm:"size:50" json:"distance"` // 距离
Tags string `gorm:"type:text" json:"tags"` // JSON: 标签数组
Notice string `gorm:"type:text" json:"notice"` // 公告
Status int `gorm:"default:1;not null" json:"status"` // 1=营业 0=休息
Sort int `gorm:"default:0" json:"sort"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
ID uint `gorm:"primaryKey" json:"id"`
Name string `gorm:"size:100;not null" json:"name"`
Description string `gorm:"type:text" json:"description"`
CategoryID uint `gorm:"index" json:"category_id"`
CategoryName string `gorm:"size:50" json:"category_name"`
Cover string `gorm:"size:255" json:"cover"` // 封面图URL
Logo string `gorm:"size:255" json:"logo"` // Logo URL
Rating float64 `gorm:"type:decimal(2,1);default:4.5" json:"rating"`
Sales int `gorm:"default:0" json:"sales"` // 月销量
DeliveryFee float64 `gorm:"type:decimal(6,2);default:0" json:"delivery_fee"` // 配送费
MinOrder float64 `gorm:"type:decimal(6,2);default:0" json:"min_order"` // 起送价
DeliveryTime int `json:"delivery_time"` // 配送时间(分钟)
Distance string `gorm:"size:50" json:"distance"` // 距离
Tags string `gorm:"type:text" json:"tags"` // JSON: 标签数组
Notice string `gorm:"type:text" json:"notice"` // 公告
Status int `gorm:"default:1;not null" json:"status"` // 1=营业 0=休息
Sort int `gorm:"default:0" json:"sort"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
// MenuCategory 菜品分类(属于某个餐厅)
@@ -47,19 +47,19 @@ type MenuCategory struct {
// MenuItem 菜品模型
type MenuItem struct {
ID uint `gorm:"primaryKey" json:"id"`
RestaurantID uint `gorm:"index;not null" json:"restaurant_id"`
CategoryID uint `gorm:"index" json:"category_id"` // 菜品分类ID
Name string `gorm:"size:100;not null" json:"name"`
Description string `gorm:"type:text" json:"description"`
Price float64 `gorm:"type:decimal(8,2);not null" json:"price"`
OriginalPrice float64 `gorm:"type:decimal(8,2)" json:"original_price"`
Image string `gorm:"size:255" json:"image"`
Rating float64 `gorm:"type:decimal(2,1);default:5.0" json:"rating"`
Sales int `gorm:"default:0" json:"sales"`
Tags string `gorm:"type:text" json:"tags"` // JSON: 标签数组
Sort int `gorm:"default:0" json:"sort"`
Status int `gorm:"default:1;not null" json:"status"` // 1=上架
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
ID uint `gorm:"primaryKey" json:"id"`
RestaurantID uint `gorm:"index;not null" json:"restaurant_id"`
CategoryID uint `gorm:"index" json:"category_id"` // 菜品分类ID
Name string `gorm:"size:100;not null" json:"name"`
Description string `gorm:"type:text" json:"description"`
Price float64 `gorm:"type:decimal(8,2);not null" json:"price"`
OriginalPrice float64 `gorm:"type:decimal(8,2)" json:"original_price"`
Image string `gorm:"size:255" json:"image"`
Rating float64 `gorm:"type:decimal(2,1);default:5.0" json:"rating"`
Sales int `gorm:"default:0" json:"sales"`
Tags string `gorm:"type:text" json:"tags"` // JSON: 标签数组
Sort int `gorm:"default:0" json:"sort"`
Status int `gorm:"default:1;not null" json:"status"` // 1=上架
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}