Showbargain.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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 Showbargain extends BaseMall
  13. {
  14. public function initialize()
  15. {
  16. parent::initialize();
  17. Lang::load(base_path() . 'home/lang/' . config('lang.default_lang') . '/bargain.lang.php');
  18. }
  19. /**
  20. * 砍价列表页
  21. */
  22. public function index()
  23. {
  24. $pbargain_model = model('pbargain');
  25. $condition = array();
  26. $cache_key = 'bargain' . md5(serialize($condition)) . '-' . intval(input('param.page'));
  27. $result = rcache($cache_key);
  28. if (empty($result)) {
  29. $bargain_list = $pbargain_model->getOnlineBargainList($condition, 12);
  30. foreach ($bargain_list as $key => $bargain) {
  31. $bargain_list[$key]['bargain_goods_image_url'] = goods_cthumb($bargain['bargain_goods_image'], 480, $bargain['store_id']);
  32. $bargain_list[$key]['bargain_url'] = urlencode(config('ds_config.h5_site_url') . "/pages/home/goodsdetail/Goodsdetail?goods_id=" . $bargain['bargain_goods_id'] . "&bargain_id=" . $bargain['bargain_id']);
  33. }
  34. $result['bargain_list'] = $bargain_list;
  35. $result['show_page'] = $pbargain_model->page_info->render();
  36. wcache($cache_key, $result);
  37. }
  38. // halt($result['bargain_list']);
  39. View::assign('bargain_list', $result['bargain_list']);
  40. View::assign('show_page', $result['show_page']);
  41. // 当前位置导航
  42. View::assign('nav_link_list', array(array('title' => lang('homepage'), 'link' => (string)url('home/Index/index')), array('title' => lang('bargain_list'))));
  43. //SEO 设置
  44. $seo = array(
  45. 'html_title' => config('ds_config.site_name') . '-' . lang('bargain_list'),
  46. 'seo_keywords' => lang('bargain_list'),
  47. 'seo_description' => lang('bargain_list'),
  48. );
  49. $this->_assign_seo($seo);
  50. return View::fetch($this->template_dir . 'index');
  51. }
  52. }