Category.php 736 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. /**
  3. *
  4. * @copyright ©2020 点小铺
  5. * @author hanj
  6. * @link: https://dyuit.com
  7. * Created by VSCode
  8. */
  9. namespace app\api\controller;
  10. use app\api\model\Category as CategoryModel;
  11. use app\api\model\WxappCategory as WxappCategoryModel;
  12. /**
  13. * 商品分类控制器
  14. * Class Goods
  15. * @package app\api\controller
  16. */
  17. class Category extends Controller
  18. {
  19. /**
  20. * 分类页面
  21. * @return array
  22. * @throws \think\exception\DbException
  23. */
  24. public function index()
  25. {
  26. // 分类模板
  27. $templet = WxappCategoryModel::detail();
  28. // 商品分类列表
  29. $list = array_values(CategoryModel::getCacheTree());
  30. return $this->renderSuccess(compact('templet', 'list'));
  31. }
  32. }