瀏覽代碼

fix 修复分类目录因数据错误

mengmingtian 8 年之前
父節點
當前提交
04f37fa3f4
共有 1 個文件被更改,包括 1 次插入2 次删除
  1. 1 2
      src/api/controller/catalog.js

+ 1 - 2
src/api/controller/catalog.js

@@ -12,7 +12,7 @@ export default class extends Base {
     let categoryId = this.get('id');
 
     let model = this.model('category');
-    let data = await model.limit(10).select();
+    let data = await model.limit(10).where({parent_id: 0}).select();
 
     let currentCategory = null;
     if (categoryId) {
@@ -44,7 +44,6 @@ export default class extends Base {
     if (categoryId) {
       currentCategory = await model.where({'id' : categoryId}).find();
     }
-
     //获取子分类数据
     if (currentCategory && currentCategory.id) {
       currentCategory.subCategoryList = await model.where({'parent_id': currentCategory.id}).select();