SliderWidget.class.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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 SliderWidget extends Controller{
  20. function slider_show(){
  21. if (!$slider_cache = S('slider_cache')) {
  22. $slider=M('plugins_slider')->where( array('type' => 'index_ad_head') )->field('image,url')->order('sort_order desc')->select();
  23. S('slider_cache', $slider);
  24. $slider_cache=$slider;
  25. }
  26. $this->slider=$slider_cache;
  27. $this->display('Widget:slider');
  28. }
  29. function slider_seller_show($seller_id)
  30. {
  31. if (!$slider_cache = S('slider_seller_cache_'.$seller_id) ) {
  32. $slider=M('seller_ad')->where( array('seller_id' => $seller_id) )->field('image,url')->order('ordersort desc,id asc')->select();
  33. S('slider_seller_cache_'.$seller_id, $slider);
  34. $slider_cache=$slider;
  35. }
  36. $this->slider=$slider_cache;
  37. $this->display('Widget:slider_seller');
  38. }
  39. /**
  40. 首页横条广告位
  41. **/
  42. function slider_show_list(){
  43. if (!$slider_cache = S('slider_list_cache')) {
  44. $slider=M('plugins_slider')->where( array('type' => 'index_ad_list') )->field('image,url')->order('sort_order desc,slider_id desc')->select();
  45. S('slider_list_cache', $slider);
  46. $slider_cache=$slider;
  47. }
  48. $this->slider=$slider_cache;
  49. $this->display('Widget:slider_list');
  50. }
  51. }