diff --git a/services/Category.php b/services/Category.php index 1b1521e9fcad6a99c0b303c9e8df8d8b1cc4f112..f5c6f2e9d0be733dea26badfd7afd6a5e4a75689 100644 --- a/services/Category.php +++ b/services/Category.php @@ -221,4 +221,12 @@ class Category extends Service { return $this->_category->getFilterCategory($category_id, $parent_id); } + + /** + * 得到category model的全名. + */ + public function getChildCategory($category_id) + { + return $this->_category->getChildCategory($category_id); + } } diff --git a/services/category/CategoryMongodb.php b/services/category/CategoryMongodb.php index 0fdcd8e87e04eaa1679d35d26a82bc1f5510f419..6598da3cfda6e68376f32b6863c6df64abfe48d7 100644 --- a/services/category/CategoryMongodb.php +++ b/services/category/CategoryMongodb.php @@ -500,7 +500,10 @@ class CategoryMongodb extends Service implements CategoryInterface return $data; } - + public function getChildCategory($category_id) { + + return $this->getChildCate($category_id); + } protected function getChildCate($category_id) { //echo $category_id; @@ -521,6 +524,8 @@ class CategoryMongodb extends Service implements CategoryInterface 'name' => $currentName, 'url_key' => $currentUrlKey, 'parent_id' => $one['parent_id'], + 'thumbnail_image' => $one['thumbnail_image'], + 'image' => $one['image'], ]; } } diff --git a/services/category/CategoryMysqldb.php b/services/category/CategoryMysqldb.php index b72f49bf0dab64967fee07fe26297064ccb83e15..9c09e485ba0352d66147234193a6c4fef980c934 100644 --- a/services/category/CategoryMysqldb.php +++ b/services/category/CategoryMysqldb.php @@ -578,6 +578,11 @@ class CategoryMysqldb extends Service implements CategoryInterface return $data; } + + public function getChildCategory($category_id) { + + return $this->getChildCate($category_id); + } protected function getChildCate($category_id) { @@ -593,17 +598,19 @@ class CategoryMysqldb extends Service implements CategoryInterface $one =$this->unserializeData($one) ; $currentUrlKey = $one['url_key']; $currentName = $one['name']; - $currentId = (string) $one['_id']; - + $currentId = (string) $one['id']; + $arr[$currentId] = [ //'_id' => $currentId, 'name' => $currentName, 'url_key' => $currentUrlKey, 'parent_id' => $one['parent_id'], + 'thumbnail_image' => $one['thumbnail_image'], + 'image' => $one['image'], ]; } } - + return $arr; }