iparule_list.auto_cache.php 958 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. class iparule_list_auto_cache extends auto_cache{
  3. private $key = "iparule:list";
  4. public function load($param)
  5. {
  6. $list = $GLOBALS['cache']->get($this->key);
  7. if($list === false)
  8. {
  9. //unserialize(
  10. $sql = "select id,name,iap_money as money,(iap_diamonds + gift_diamonds) as diamonds,gift_coins,iap_money,gift_diamonds,iap_diamonds from ".DB_PREFIX."recharge_rule where is_effect = 1 and is_delete = 0 and product_id != '' order by sort";
  11. $list = $GLOBALS['db']->getAll($sql,true,true);
  12. $GLOBALS['cache']->set($this->key,$list,3600, true);
  13. }
  14. foreach($list as $k=>$v){
  15. $list[$k]['name'] = '钻石'.$v['iap_diamonds'];
  16. if(intval($v['gift_diamonds'])>0){
  17. $list[$k]['name'] = '钻石'.$v['iap_diamonds']."(赠送".$v['gift_diamonds']."钻石)";
  18. }
  19. }
  20. return $list;
  21. }
  22. public function rm($param)
  23. {
  24. $GLOBALS['cache']->rm($this->key);
  25. }
  26. public function clear_all()
  27. {
  28. $GLOBALS['cache']->rm($this->key);
  29. }
  30. }
  31. ?>