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