Showbargain.php 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. namespace app\home\controller;
  3. use think\facade\View;
  4. use think\facade\Lang;
  5. /**
  6. * ============================================================================
  7. *
  8. * ============================================================================
  9. * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
  10. * 网站地址: https://www.valimart.net/
  11. * ----------------------------------------------------------------------------
  12. *
  13. * ============================================================================
  14. * 控制器
  15. */
  16. class Showbargain extends BaseMall
  17. {
  18. public function initialize()
  19. {
  20. parent::initialize();
  21. Lang::load(base_path() . 'home/lang/'.config('lang.default_lang').'/bargain.lang.php');
  22. }
  23. /**
  24. * 砍价列表页
  25. */
  26. public function index()
  27. {
  28. $pbargain_model = model('pbargain');
  29. $condition = array();
  30. $cache_key = 'bargain' . md5(serialize($condition)) . '-' . intval(input('param.page'));
  31. $result = rcache($cache_key);
  32. if (empty($result)) {
  33. $bargain_list = $pbargain_model->getOnlineBargainList($condition, 12);
  34. foreach ($bargain_list as $key => $bargain) {
  35. $bargain_list[$key]['bargain_goods_image_url'] = goods_cthumb($bargain['bargain_goods_image'], 480, $bargain['store_id']);
  36. $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']);
  37. }
  38. $result['bargain_list'] = $bargain_list;
  39. $result['show_page'] = $pbargain_model->page_info->render();
  40. wcache($cache_key, $result);
  41. }
  42. // halt($result['bargain_list']);
  43. View::assign('bargain_list', $result['bargain_list']);
  44. View::assign('show_page', $result['show_page']);
  45. // 当前位置导航
  46. View::assign('nav_link_list', array(array('title' => lang('homepage'), 'link' => (string)url('home/Index/index')),array('title'=>lang('bargain_list'))));
  47. //SEO 设置
  48. $seo = array(
  49. 'html_title'=>config('ds_config.site_name').'-'.lang('bargain_list'),
  50. 'seo_keywords'=>lang('bargain_list'),
  51. 'seo_description'=>lang('bargain_list'),
  52. );
  53. $this->_assign_seo($seo);
  54. return View::fetch($this->template_dir.'index');
  55. }
  56. }