cache_nav_list.auto_cache.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. +<?php
  2. //导航
  3. class cache_nav_list_auto_cache extends auto_cache{
  4. public function load($param)
  5. {
  6. $param=array();
  7. $key = $this->build_key(__CLASS__,$param);
  8. $GLOBALS['cache']->set_dir(APP_ROOT_PATH."public/runtime/data/".__CLASS__."/");
  9. $nav_list = $GLOBALS['cache']->get($key);
  10. if($nav_list === false)
  11. {
  12. $nav_list = $GLOBALS['db']->getAll("select * from ".DB_PREFIX."nav where is_effect = 1 order by sort asc");
  13. $nav_list_item=array();
  14. foreach ($nav_list as $k=>$v)
  15. {
  16. if(app_conf("INVEST_STATUS")==0)
  17. {
  18. //开启“产品”和“股权”众筹
  19. $nav_list_item[$k]=$v;
  20. }
  21. elseif (app_conf("INVEST_STATUS")==1)
  22. {
  23. //只开启“产品”众筹
  24. if($v['u_param']!="type=1"){
  25. $nav_list_item[$k]=$v;
  26. }
  27. }
  28. elseif (app_conf("INVEST_STATUS")==2)
  29. {
  30. //只开启“股权”众筹
  31. if($v['u_module']!="deals" || $v['u_param']=="type=1"){
  32. $nav_list_item[$k]=$v;
  33. }
  34. }elseif(app_conf("INVEST_STATUS")==3){
  35. //关闭“产品”和“股权”众筹
  36. if($v['u_module']!="deals" || $v['u_action']=="house" || $v['u_action']=="gently"){
  37. $nav_list_item[$k]=$v;
  38. }
  39. }
  40. if($v['u_module']=='index'&&($v['u_action']==''||$v['u_action']=='index')){
  41. $nav_list_item[$k]['u_action'] = DEFAULT_ACTION_NAME;
  42. }
  43. }
  44. $nav_list = format_nav_list($nav_list_item);
  45. unset($nav_list_item);
  46. $GLOBALS['cache']->set_dir(APP_ROOT_PATH."public/runtime/data/".__CLASS__."/");
  47. $GLOBALS['cache']->set($key,$nav_list);
  48. }
  49. return $nav_list;
  50. }
  51. public function rm($param)
  52. {
  53. $key = $this->build_key(__CLASS__,$param);
  54. $GLOBALS['cache']->set_dir(APP_ROOT_PATH."public/runtime/data/".__CLASS__."/");
  55. $GLOBALS['cache']->rm($key);
  56. }
  57. public function clear_all()
  58. {
  59. $GLOBALS['cache']->set_dir(APP_ROOT_PATH."public/runtime/data/".__CLASS__."/");
  60. $GLOBALS['cache']->clear();
  61. }
  62. }
  63. ?>