MenuWidget.class.php 876 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. /**
  3. * 狮子鱼社区团购系统
  4. *
  5. * ==========================================================================
  6. * @link http://www.liofis.com/
  7. * @copyright Copyright (c) 2015 liofis.com.
  8. * @license http://www.liofis.com/license.html License
  9. * ==========================================================================
  10. *
  11. * @author fish
  12. *
  13. */
  14. namespace Home\Widget;
  15. use Think\Controller;
  16. /**
  17. * 导航
  18. */
  19. class MenuWidget extends Controller{
  20. function menu_show($type){
  21. if (!$menu_cache = S('menu_cache')) {
  22. $hashids = new \Lib\Hashids(C('PWD_KEY'), C('URL_ID'));
  23. $menu=M('goods_category')->select();
  24. foreach ($menu as $k => $v) {
  25. $menu[$k]['id']=$hashids->encode($v['id']);
  26. }
  27. S('menu_cache', $menu);
  28. $menu_cache=$menu;
  29. }
  30. $this->menu=$menu_cache;
  31. $this->type=$type;
  32. $this->display('Widget:menu');
  33. }
  34. }