Category.php 627 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. namespace app\api\controller;
  3. use app\api\model\Category as CategoryModel;
  4. use app\api\model\WxappCategory as WxappCategoryModel;
  5. /**
  6. * 商品分类控制器
  7. * Class Goods
  8. * @package app\api\controller
  9. */
  10. class Category extends Controller
  11. {
  12. /**
  13. * 分类页面
  14. * @return array
  15. * @throws \think\exception\DbException
  16. */
  17. public function index()
  18. {
  19. // 分类模板
  20. $templet = WxappCategoryModel::detail();
  21. // 商品分类列表
  22. $list = array_values(CategoryModel::getCacheTree());
  23. return $this->renderSuccess(compact('templet', 'list'));
  24. }
  25. }