Index.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace addons\shop\controller;
  3. use addons\shop\model\Block;
  4. use addons\shop\model\Category;
  5. use addons\shop\model\Goods;
  6. use think\Config;
  7. /**
  8. * 商城首页控制器
  9. * Class Index
  10. * @package addons\shop\controller
  11. */
  12. class Index extends Base
  13. {
  14. protected $noNeedLogin = '*';
  15. protected $noNeedRight = '*';
  16. public function _initialize()
  17. {
  18. parent::_initialize();
  19. }
  20. /**
  21. * 首页
  22. */
  23. public function index()
  24. {
  25. // 判断是否跳转移动端
  26. $this->checkredirect('index');
  27. $config = get_addon_config('shop');
  28. //设置TKD
  29. Config::set('shop.title', $config['title'] ?: '首页');
  30. Config::set('shop.keywords', $config['keywords']);
  31. Config::set('shop.description', $config['description']);
  32. $this->view->assign('indexCategoryList', Category::getIndexCategoryList());
  33. $this->view->assign('indexGoodsList', Goods::getIndexGoodsList());
  34. $this->view->assign('indexFocusList', Block::getBlockListByName('indexfocus'));
  35. return $this->view->fetch('/index');
  36. }
  37. }