feat(admin): 重构管理员文章路由并添加导航功能
- 将管理员文章路由从 Article 方法改为 Index 方法 - 在 ArticleController 中实现 Index 方法,支持预加载文章分类数据并返回 JSON - 添加 ArticleCate 模型及对应数据表映射 - 扩展 Article 模型,关联 ArticleCate,实现文章与分类的关联查询 - 新增 Nav 模型及 NavController,提供导航数据接口 - 修改用户模型添加 JSON 标签,规范字段序列化 - 扩展数据库自动迁移,新增 Article、Nav 和 ArticleCate 表的自动创建功能
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
package model
|
||||
|
||||
type Article struct {
|
||||
Id int
|
||||
Title string
|
||||
CateId int
|
||||
State int
|
||||
Id int
|
||||
Title string
|
||||
CateId int
|
||||
State int
|
||||
ArticleCate ArticleCate `gorm:"foreignKey:CateId;references:State"`
|
||||
}
|
||||
|
||||
func (Article) TableName() string {
|
||||
|
||||
Reference in New Issue
Block a user