- ReorderCategories

This commit is contained in:
gazebo
2018-09-18 22:58:15 +08:00
parent 7e0a58d801
commit 8593e8b44b
2 changed files with 14 additions and 3 deletions

View File

@@ -74,7 +74,12 @@ func ReorderCategories(parentID int, categoryIDs []int, userName string) (err er
parentCat := &model.SkuCategory{}
parentCat.ID = parentID
db := dao.GetDB()
if err = dao.GetEntity(db, parentCat); err == nil {
if parentID != 0 {
err = dao.GetEntity(db, parentCat)
} else {
parentCat = nil
}
if err == nil {
if err = dao.GetEntities(db, &cats, utils.Params2Map(model.FieldParentID, parentID), false); err == nil {
catsLen := len(cats)
if catsLen != len(categoryIDs) {