MenuWidget.class.php 581 B

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