|
@@ -40,19 +40,19 @@ type ClassifyListItem struct {
|
|
|
|
|
|
// GetParent 获取一级分类列表
|
|
|
func (c *Classify) GetParent() (list []*Classify, err error) {
|
|
|
- err = global.DEFAULT_MYSQL.Model(c).Where("parent_id=0").Order("sort ASC,create_time ASC").Scan(&list).Error
|
|
|
+ err = global.DEFAULT_MYSQL.Model(c).Where("parent_id=0 and enabled=1").Order("sort ASC,create_time ASC").Scan(&list).Error
|
|
|
return
|
|
|
}
|
|
|
|
|
|
// GetChild 获取二级分类和三级分类列表
|
|
|
func (c *Classify) GetChild() (list []*Classify, err error) {
|
|
|
- err = global.DEFAULT_MYSQL.Model(c).Where("parent_id>0").Order("sort ASC,create_time ASC").Scan(&list).Error
|
|
|
+ err = global.DEFAULT_MYSQL.Model(c).Where("parent_id>0 and enabled=1 ").Order("sort ASC,create_time ASC").Scan(&list).Error
|
|
|
return
|
|
|
}
|
|
|
|
|
|
// GetChild 获取二级分类列表
|
|
|
func (c *Classify) GetSecondChild(parentId int) (list []*Classify, err error) {
|
|
|
- err = global.DEFAULT_MYSQL.Model(c).Where("parent_id=? and parent_id=root_id", parentId).Order("sort ASC,create_time ASC").Scan(&list).Error
|
|
|
+ err = global.DEFAULT_MYSQL.Model(c).Where("parent_id=? and parent_id=root_id and enabled=1", parentId).Order("sort ASC,create_time ASC").Scan(&list).Error
|
|
|
return
|
|
|
}
|
|
|
|