Pointshop.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. namespace app\home\controller;
  3. use think\facade\View;
  4. use think\facade\Lang;
  5. /**
  6. *
  7. *
  8. * ----------------------------------------------------------------------------
  9. *
  10. * 控制器
  11. */
  12. class Pointshop extends BasePointShop
  13. {
  14. public function initialize()
  15. {
  16. parent::initialize(); // TODO: Change the autogenerated stub
  17. Lang::load(base_path() . 'home/lang/' . config('lang.default_lang') . '/pointprod.lang.php');
  18. Lang::load(base_path() . 'home/lang/' . config('lang.default_lang') . '/voucher.lang.php');
  19. }
  20. public function index()
  21. {
  22. //查询会员及其附属信息
  23. parent::pointshopMInfo();
  24. //开启代金券功能后查询推荐的热门店铺代金券列表和平台代金券
  25. if (config('ds_config.voucher_allow') == 1) {
  26. //热门店铺代金券
  27. $recommend_voucher = model('voucher')->getRecommendTemplate(6);
  28. View::assign('recommend_voucher', $recommend_voucher);
  29. //平台代金券
  30. $where = array();
  31. $where[] = array('mallvouchertemplate_startdate', '<', TIMESTAMP);
  32. $where[] = array('mallvouchertemplate_enddate', '>', TIMESTAMP);
  33. $mallvoucherlist = model('mallvouchertemplate')->getMallvouchertemplateList($where, 6);
  34. View::assign('mallvoucherlist', $mallvoucherlist);
  35. }
  36. //开启积分兑换功能后查询推荐的热门兑换商品列表
  37. if (config('ds_config.pointprod_isuse') == 1) {
  38. //热门积分兑换商品
  39. $recommend_pointsprod = model('pointprod')->getRecommendPointProd(10);
  40. View::assign('recommend_pointsprod', $recommend_pointsprod);
  41. }
  42. //SEO
  43. $this->_assign_seo(model('seo')->type('point')->show());
  44. //分类导航
  45. $nav_link = array(
  46. 0 => array('title' => lang('homepage'), 'link' => HOME_SITE_URL),
  47. 1 => array('title' => lang('ds_pointprod'))
  48. );
  49. View::assign('nav_link_list', $nav_link);
  50. return View::fetch($this->template_dir . 'pointprod');
  51. }
  52. }