PresalegoodsController.class.php 2.4 KB

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