PresalegoodsController.class.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. /**
  3. * lionfish 商城系统
  4. *
  5. *
  6. * @author fish
  7. *
  8. */
  9. namespace Home\Controller;
  10. class PresalegoodsController extends CommonController {
  11. protected function _initialize()
  12. {
  13. parent::_initialize();
  14. }
  15. public function index(){
  16. $presale_index_info = [];
  17. //1、顶部幻灯片
  18. $slider_list = M('lionfish_comshop_adv')->where( array('enabled' => 1,'type' => 'presale') )->order('displayorder desc, id desc')->select();
  19. if(!empty($slider_list))
  20. {
  21. foreach($slider_list as $key => $val)
  22. {
  23. $val['image'] = tomedia($val['thumb']);
  24. $slider_list[$key] = $val;
  25. }
  26. $presale_index_info['has_slider'] = 1;
  27. }else{
  28. $slider_list = array();
  29. $presale_index_info['has_slider'] = 0;
  30. }
  31. $presale_index_info['slider_list'] = $slider_list;
  32. //2、分享标题 分享图片
  33. $presale_share_title = D('Home/Front')->get_config_by_name('presale_share_title');
  34. $presale_share_img = D('Home/Front')->get_config_by_name('presale_share_img');
  35. $presale_publish = D('Home/Front')->get_config_by_name('presale_publish');
  36. $presale_index_info['presale_share_title'] = empty($presale_share_title) ? '' : $presale_share_title;
  37. $presale_index_info['presale_share_img'] = empty($presale_share_img) ? '' : tomedia($presale_share_img);
  38. $presale_index_info['presale_publish'] = empty($presale_publish) ? '' : htmlspecialchars_decode($presale_publish);
  39. //presale_layout 布局 0 左右布局, 1 横向布局
  40. $presale_layout = D('Home/Front')->get_config_by_name('presale_layout');
  41. $presale_layout = empty($presale_layout) ? 0 : 1;
  42. $presale_index_info['presale_layout'] = $presale_layout;
  43. echo json_encode( ['code' => 0, 'data' => $presale_index_info ] );
  44. die();
  45. }
  46. /**
  47. * @author yj
  48. * @desc 获取商品列表有分页
  49. */
  50. public function load_goods_list()
  51. {
  52. $result = D('Home/PresaleGoods')->getIndexPresaleGoods(0);
  53. echo json_encode( $result );
  54. die();
  55. }
  56. }