SliderWidget.class.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. /**
  3. * 狮子鱼社区团购系统
  4. *
  5. *
  6. * @author fish
  7. *
  8. */
  9. namespace Home\Widget;
  10. use Think\Controller;
  11. /**
  12. * 轮播器
  13. */
  14. class SliderWidget extends Controller{
  15. function slider_show(){
  16. if (!$slider_cache = S('slider_cache')) {
  17. $slider=M('plugins_slider')->where( array('type' => 'index_ad_head') )->field('image,url')->order('sort_order desc')->select();
  18. S('slider_cache', $slider);
  19. $slider_cache=$slider;
  20. }
  21. $this->slider=$slider_cache;
  22. $this->display('Widget:slider');
  23. }
  24. function slider_seller_show($seller_id)
  25. {
  26. if (!$slider_cache = S('slider_seller_cache_'.$seller_id) ) {
  27. $slider=M('seller_ad')->where( array('seller_id' => $seller_id) )->field('image,url')->order('ordersort desc,id asc')->select();
  28. S('slider_seller_cache_'.$seller_id, $slider);
  29. $slider_cache=$slider;
  30. }
  31. $this->slider=$slider_cache;
  32. $this->display('Widget:slider_seller');
  33. }
  34. /**
  35. 首页横条广告位
  36. **/
  37. function slider_show_list(){
  38. if (!$slider_cache = S('slider_list_cache')) {
  39. $slider=M('plugins_slider')->where( array('type' => 'index_ad_list') )->field('image,url')->order('sort_order desc,slider_id desc')->select();
  40. S('slider_list_cache', $slider);
  41. $slider_cache=$slider;
  42. }
  43. $this->slider=$slider_cache;
  44. $this->display('Widget:slider_list');
  45. }
  46. }