Showbargain.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. namespace app\home\controller;
  3. use think\facade\View;
  4. use think\facade\Lang;
  5. /**
  6. * ============================================================================
  7. * DSMall多用户商城
  8. * ============================================================================
  9. * 版权所有 2014-2028 长沙德尚网络科技有限公司,并保留所有权利。
  10. * 网站地址: http://www.csdeshang.com
  11. * ----------------------------------------------------------------------------
  12. * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用 .
  13. * 不允许对程序代码以任何形式任何目的的再发布。
  14. * ============================================================================
  15. * 控制器
  16. */
  17. class Showbargain extends BaseMall
  18. {
  19. public function initialize()
  20. {
  21. parent::initialize();
  22. Lang::load(base_path() . 'home/lang/'.config('lang.default_lang').'/bargain.lang.php');
  23. }
  24. /**
  25. * 砍价列表页
  26. */
  27. public function index()
  28. {
  29. $pbargain_model = model('pbargain');
  30. $condition = array();
  31. $cache_key = 'bargain' . md5(serialize($condition)) . '-' . intval(input('param.page'));
  32. $result = rcache($cache_key);
  33. if (empty($result)) {
  34. $bargain_list = $pbargain_model->getOnlineBargainList($condition, 12);
  35. foreach ($bargain_list as $key => $bargain) {
  36. $bargain_list[$key]['bargain_goods_image_url'] = goods_cthumb($bargain['bargain_goods_image'], 480, $bargain['store_id']);
  37. $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']);
  38. }
  39. $result['bargain_list'] = $bargain_list;
  40. $result['show_page'] = $pbargain_model->page_info->render();
  41. wcache($cache_key, $result);
  42. }
  43. // halt($result['bargain_list']);
  44. View::assign('bargain_list', $result['bargain_list']);
  45. View::assign('show_page', $result['show_page']);
  46. // 当前位置导航
  47. View::assign('nav_link_list', array(array('title' => lang('homepage'), 'link' => (string)url('home/Index/index')),array('title'=>lang('bargain_list'))));
  48. //SEO 设置
  49. $seo = array(
  50. 'html_title'=>config('ds_config.site_name').'-'.lang('bargain_list'),
  51. 'seo_keywords'=>lang('bargain_list'),
  52. 'seo_description'=>lang('bargain_list'),
  53. );
  54. $this->_assign_seo($seo);
  55. return View::fetch($this->template_dir.'index');
  56. }
  57. }