|
@@ -88,19 +88,6 @@ func UpdateCategory(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
|
return repo.RepoUpdateSetDoc(apictx.CreateRepoCtx(), repo.CollectionCategory, cate.Id.Hex(), &cate)
|
|
|
}
|
|
|
|
|
|
-// model模块下
|
|
|
-type Category struct {
|
|
|
- Id primitive.ObjectID `bson:"_id,omitempty" json:"_id"`
|
|
|
- Pid string `bson:"pid,omitempty" json:"pid"` // 分类的上层id // 默认为top
|
|
|
- Name string `bson:"name,omitempty" json:"name"`
|
|
|
- Sort *int `bson:"sort,omitempty" json:"sort"` // 排序,使用创建时间联合排序。排序按升序排,默认为0
|
|
|
- Type string `bson:"type,omitempty" json:"type"` // 分类类型,系列/课程/章节/知识点
|
|
|
- Scope string `bson:"scope,omitempty" json:"scope"` // 分类所属的数据库 模块唯一
|
|
|
- CreateTime time.Time `bson:"createTime,omitempty" json:"createTime"`
|
|
|
- UpdateTime time.Time `bson:"updateTime,omitempty" json:"updateTime"`
|
|
|
- Children []*Category `bson:"children,omitempty" json:"children"` // 存储树桩结构
|
|
|
-}
|
|
|
-
|
|
|
func CategoryParseList(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
|
// 查询所有数据
|
|
|
cates := []*model.Category{}
|