Showpintuan.php 2.8 KB

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