代码推送

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

@@ -0,0 +1,17 @@
package model
import "time"
// AccessLog 网站访问日志
type AccessLog struct {
ID uint `gorm:"primaryKey" json:"id"`
IP string `gorm:"size:45;index" json:"ip"`
Path string `gorm:"size:500;index" json:"path"`
Method string `gorm:"size:10" json:"method"`
UserAgent string `gorm:"size:500" json:"user_agent"`
Referer string `gorm:"size:500" json:"referer"`
Location string `gorm:"size:255" json:"location"` // IP 归属地
Status int `json:"status"`
Cost int `json:"cost"` // 耗时(毫秒)
CreatedAt time.Time `gorm:"index" json:"created_at"`
}

View File

@@ -19,19 +19,19 @@ type App struct {
Description string `gorm:"type:text" json:"description"`
CategoryID uint `gorm:"index" json:"category_id"`
CategoryName string `gorm:"size:50" json:"category_name"`
Icon string `gorm:"size:255" json:"icon"` // 应用图标URL
Developer string `gorm:"size:100" json:"developer"` // 开发者
Icon string `gorm:"size:255" json:"icon"` // 应用图标URL
Developer string `gorm:"size:100" json:"developer"` // 开发者
Rating float64 `gorm:"type:decimal(2,1);default:5.0" json:"rating"`
Reviews int `gorm:"default:0" json:"reviews"` // 评价数
Downloads int `gorm:"default:0" json:"downloads"` // 下载量
Size string `gorm:"size:50" json:"size"` // 应用大小
Version string `gorm:"size:50" json:"version"` // 版本号
UpdateDate string `gorm:"size:20" json:"update_date"` // 更新日期
Platform string `gorm:"size:100" json:"platform"` // 平台
Price string `gorm:"size:50" json:"price"` // 价格(免费/付费)
Tags string `gorm:"type:text" json:"tags"` // JSON: 标签数组
Screenshots string `gorm:"type:text" json:"screenshots"` // JSON: 截图描述数组
Features string `gorm:"type:text" json:"features"` // JSON: 特性列表
Reviews int `gorm:"default:0" json:"reviews"` // 评价数
Downloads int `gorm:"default:0" json:"downloads"` // 下载量
Size string `gorm:"size:50" json:"size"` // 应用大小
Version string `gorm:"size:50" json:"version"` // 版本号
UpdateDate string `gorm:"size:20" json:"update_date"` // 更新日期
Platform string `gorm:"size:100" json:"platform"` // 平台
Price string `gorm:"size:50" json:"price"` // 价格(免费/付费)
Tags string `gorm:"type:text" json:"tags"` // JSON: 标签数组
Screenshots string `gorm:"type:text" json:"screenshots"` // JSON: 截图描述数组
Features string `gorm:"type:text" json:"features"` // JSON: 特性列表
IsFeatured bool `gorm:"default:false" json:"is_featured"` // 精选
IsNew bool `gorm:"default:false" json:"is_new"` // 新上架
Sort int `gorm:"default:0" json:"sort"`

View File

@@ -8,9 +8,9 @@ type Company struct {
Name string `gorm:"size:100;not null" json:"name"`
Logo string `gorm:"size:255" json:"logo"`
Slogan string `gorm:"size:255" json:"slogan"`
Description string `gorm:"type:text" json:"description"` // 关于我们
Vision string `gorm:"type:text" json:"vision"` // 愿景
Mission string `gorm:"type:text" json:"mission"` // 使命
Description string `gorm:"type:text" json:"description"` // 关于我们
Vision string `gorm:"type:text" json:"vision"` // 愿景
Mission string `gorm:"type:text" json:"mission"` // 使命
Phone string `gorm:"size:30" json:"phone"`
Email string `gorm:"size:100" json:"email"`
Address string `gorm:"size:255" json:"address"`
@@ -41,8 +41,8 @@ type EnterpriseService struct {
ID uint `gorm:"primaryKey" json:"id"`
Title string `gorm:"size:100;not null" json:"title"`
Description string `gorm:"type:text" json:"description"`
Icon string `gorm:"size:50" json:"icon"` // 图标标识
Image string `gorm:"size:255" json:"image"` // 图片URL
Icon string `gorm:"size:50" json:"icon"` // 图标标识
Image string `gorm:"size:255" json:"image"` // 图片URL
Features string `gorm:"type:text" json:"features"` // JSON: 特性列表
Sort int `gorm:"default:0" json:"sort"`
CreatedAt time.Time `json:"created_at"`

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"`
}

View File

@@ -14,28 +14,28 @@ type GameCategory struct {
// Game 游戏模型(3 套游戏网站共用同一套数据)
type Game struct {
ID uint `gorm:"primaryKey" json:"id"`
Name string `gorm:"size:200;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
Developer string `gorm:"size:100" json:"developer"` // 开发商
Publisher string `gorm:"size:100" json:"publisher"` // 发行商
Rating float64 `gorm:"type:decimal(2,1);default:5.0" json:"rating"`
Plays int `gorm:"default:0" json:"plays"` // 游玩次数
Downloads int `gorm:"default:0" json:"downloads"` // 下载量
Size string `gorm:"size:50" json:"size"` // 游戏大小
Version string `gorm:"size:50" json:"version"` // 版本号
ReleaseDate string `gorm:"size:20" json:"release_date"` // 发行日期
Platform string `gorm:"size:100" json:"platform"` // 平台
Tags string `gorm:"type:text" json:"tags"` // JSON: 标签数组
Screenshots string `gorm:"type:text" json:"screenshots"` // JSON: 截图描述数组
Features string `gorm:"type:text" json:"features"` // JSON: 特性列表
IsHot bool `gorm:"default:false" json:"is_hot"` // 热门
IsNew bool `gorm:"default:false" json:"is_new"` // 新游
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"`
Name string `gorm:"size:200;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
Developer string `gorm:"size:100" json:"developer"` // 开发商
Publisher string `gorm:"size:100" json:"publisher"` // 发行商
Rating float64 `gorm:"type:decimal(2,1);default:5.0" json:"rating"`
Plays int `gorm:"default:0" json:"plays"` // 游玩次数
Downloads int `gorm:"default:0" json:"downloads"` // 下载量
Size string `gorm:"size:50" json:"size"` // 游戏大小
Version string `gorm:"size:50" json:"version"` // 版本号
ReleaseDate string `gorm:"size:20" json:"release_date"` // 发行日期
Platform string `gorm:"size:100" json:"platform"` // 平台
Tags string `gorm:"type:text" json:"tags"` // JSON: 标签数组
Screenshots string `gorm:"type:text" json:"screenshots"` // JSON: 截图描述数组
Features string `gorm:"type:text" json:"features"` // JSON: 特性列表
IsHot bool `gorm:"default:false" json:"is_hot"` // 热门
IsNew bool `gorm:"default:false" json:"is_new"` // 新游
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"`
}

View File

@@ -15,23 +15,23 @@ type MusicCategory struct {
// Song 歌曲模型(3 套音乐网站共用同一套数据)
type Song struct {
ID uint `gorm:"primaryKey" json:"id"`
Title string `gorm:"size:200;not null" json:"title"` // 歌曲名
Artist string `gorm:"size:100;not null" json:"artist"` // 歌手
Album string `gorm:"size:200" json:"album"` // 专辑
Title string `gorm:"size:200;not null" json:"title"` // 歌曲名
Artist string `gorm:"size:100;not null" json:"artist"` // 歌手
Album string `gorm:"size:200" json:"album"` // 专辑
CategoryID uint `gorm:"index" json:"category_id"`
CategoryName string `gorm:"size:50" json:"category_name"` // 曲风
Cover string `gorm:"size:255" json:"cover"` // 封面URL
Duration int `gorm:"default:0" json:"duration"` // 时长(秒)
PlayCount int `gorm:"default:0" json:"play_count"` // 播放量
LikeCount int `gorm:"default:0" json:"like_count"` // 收藏量
Lyrics string `gorm:"type:text" json:"lyrics"` // 歌词
ReleaseDate string `gorm:"size:20" json:"release_date"` // 发行日期
Language string `gorm:"size:50" json:"language"` // 语种
Tags string `gorm:"type:text" json:"tags"` // JSON: 标签数组
IsHot bool `gorm:"default:false" json:"is_hot"` // 热门
IsNew bool `gorm:"default:false" json:"is_new"` // 新歌
CategoryName string `gorm:"size:50" json:"category_name"` // 曲风
Cover string `gorm:"size:255" json:"cover"` // 封面URL
Duration int `gorm:"default:0" json:"duration"` // 时长(秒)
PlayCount int `gorm:"default:0" json:"play_count"` // 播放量
LikeCount int `gorm:"default:0" json:"like_count"` // 收藏量
Lyrics string `gorm:"type:text" json:"lyrics"` // 歌词
ReleaseDate string `gorm:"size:20" json:"release_date"` // 发行日期
Language string `gorm:"size:50" json:"language"` // 语种
Tags string `gorm:"type:text" json:"tags"` // JSON: 标签数组
IsHot bool `gorm:"default:false" json:"is_hot"` // 热门
IsNew bool `gorm:"default:false" json:"is_new"` // 新歌
Sort int `gorm:"default:0" json:"sort"`
Status int `gorm:"default:1;not null" json:"status"` // 1=上架
Status int `gorm:"default:1;not null" json:"status"` // 1=上架
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}

View File

@@ -10,8 +10,8 @@ import (
type User struct {
ID uint `gorm:"primaryKey" json:"id"`
Username string `gorm:"size:50;uniqueIndex;not null" json:"username"`
Password string `gorm:"size:255;not null" json:"-"` // bcrypt 哈希,不返回前端
Phone string `gorm:"size:20;index" json:"phone"` // 手机号
Password string `gorm:"size:255;not null" json:"-"` // bcrypt 哈希,不返回前端
Phone string `gorm:"size:20;index" json:"phone"` // 手机号
Role string `gorm:"size:20;default:user;not null" json:"role"` // admin | user
Avatar string `gorm:"size:255" json:"avatar"` // 头像 URL
Status int `gorm:"default:1;not null" json:"status"` // 1=正常 0=禁用