Showpintuan.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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 Showpintuan extends BaseMall
  16. {
  17. public function initialize()
  18. {
  19. parent::initialize();
  20. Lang::load(base_path() . 'home/lang/' . config('lang.default_lang') . '/pintuan.lang.php');
  21. }
  22. /**
  23. * 拼团列表页
  24. */
  25. public function index()
  26. {
  27. $ppintuan_model = model('ppintuan');
  28. $condition = array(
  29. array('pintuan_state', '=', 1),
  30. array('pintuan_starttime', '<', TIMESTAMP),
  31. array('pintuan_end_time', '>', TIMESTAMP),
  32. );
  33. $cache_key = 'pintuan' . md5(serialize($condition)) . '-' . intval(input('param.page'));
  34. $result = rcache($cache_key);
  35. if (empty($result)) {
  36. $pintuan_list = $ppintuan_model->getPintuanList($condition, 10, 'pintuan_state desc, pintuan_end_time desc');
  37. foreach ($pintuan_list as $key => $pintuan) {
  38. $pintuan_list[$key]['pintuan_image'] = goods_cthumb($pintuan['pintuan_image'], 240);
  39. $pintuan_list[$key]['pintuan_zhe_price'] = round($pintuan['pintuan_goods_price'] * $pintuan['pintuan_zhe'] / 10, 2);
  40. $pintuan_list[$key]['pintuan_url'] = urlencode(config('ds_config.h5_site_url') . "/pages/home/goodsdetail/Goodsdetail?goods_id=" . $pintuan['pintuan_goods_id'] . "&pintuan_id=" . $pintuan['pintuan_id']);
  41. }
  42. $result['pintuan_list'] = $pintuan_list;
  43. $result['show_page'] = $ppintuan_model->page_info->render();
  44. wcache($cache_key, $result);
  45. }
  46. // halt($result['pintuan_list']);
  47. View::assign('pintuan_list', $result['pintuan_list']);
  48. View::assign('show_page', $result['show_page']);
  49. // 当前位置导航
  50. View::assign('nav_link_list', array(array('title' => lang('homepage'), 'link' => (string) url('home/Index/index')), array('title' => lang('pintuan_list'))));
  51. //SEO 设置
  52. $seo = array(
  53. 'html_title' => config('ds_config.site_name') . '-' . lang('pintuan_list'),
  54. 'seo_keywords' => lang('pintuan_list'),
  55. 'seo_description' => lang('pintuan_list'),
  56. );
  57. $this->_assign_seo($seo);
  58. return View::fetch($this->template_dir . 'index');
  59. }
  60. }