prop_list.auto_cache.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. class prop_list_auto_cache extends auto_cache{
  3. private $key = "prop:list";
  4. public function load($param)
  5. {
  6. $list = $GLOBALS['cache']->get($this->key);
  7. if($list === false)
  8. {
  9. $m_config = load_auto_cache("m_config");
  10. $sql = "select id,name,score,diamonds,icon,pc_icon,pc_gif,ticket,is_much,sort,is_red_envelope,is_animated,anim_type from ".DB_PREFIX."prop where is_effect = 1 order by sort desc";
  11. if($m_config['ios_check_version'] != ''){
  12. $sql = "select id,name,score,diamonds,icon,pc_icon,pc_gif,ticket,is_much,sort,is_red_envelope,is_animated,anim_type from ".DB_PREFIX."prop where is_effect = 1 and is_red_envelope<>1 order by sort desc";
  13. }
  14. $list = $GLOBALS['db']->getAll($sql,true,true);
  15. foreach ( $list as $k => $v )
  16. {
  17. $list[$k]['icon'] = get_spec_image($v['icon']);
  18. $list[$k]['ticket'] = intval($v['ticket']) ;
  19. $list[$k]['score_fromat'] = '+'.$v['score'].'经验值';
  20. }
  21. $GLOBALS['cache']->set($this->key,$list);
  22. }
  23. return $list;
  24. }
  25. public function rm($param)
  26. {
  27. $GLOBALS['cache']->rm($this->key);
  28. }
  29. public function clear_all()
  30. {
  31. $GLOBALS['cache']->rm($this->key);
  32. }
  33. }
  34. ?>