BaseStore.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <?php
  2. /*
  3. * 店铺的类
  4. */
  5. namespace app\home\controller;
  6. use think\facade\View;
  7. use think\facade\Lang;
  8. /**
  9. * ============================================================================
  10. *
  11. * ============================================================================
  12. * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
  13. * 网站地址: https://www.valimart.net/
  14. * ----------------------------------------------------------------------------
  15. *
  16. * ============================================================================
  17. * 控制器
  18. */
  19. class BaseStore extends BaseHome {
  20. protected $store_info;
  21. public function initialize() {
  22. parent::initialize();
  23. Lang::load(base_path() . 'home/lang/'.config('lang.default_lang').'/baseseller.lang.php');
  24. //店铺模板路径
  25. $this->template_dir = 'default/store/default/' . strtolower(request()->controller()) . '/';
  26. View::assign('store_theme', 'default');
  27. //当方法为 store 进行执行
  28. if (in_array(request()->controller(),array('Store','StoreSpecial'))) {
  29. //输出会员信息
  30. $this->getMemberAndGradeInfo(false);
  31. $store_id = intval(input('param.store_id'));
  32. if ($store_id <= 0) {
  33. $this->error(lang('ds_store_close'));
  34. }
  35. $store_model = model('store');
  36. $store_info = $store_model->getStoreOnlineInfoByID($store_id);
  37. if (empty($store_info)) {
  38. $this->error(lang('ds_store_close'));
  39. } else {
  40. $this->store_info = $store_info;
  41. }
  42. $storejoinin_model=model('storejoinin');
  43. if(!$store_info['is_platform_store']){
  44. $storejoinin_info=$storejoinin_model->getOneStorejoinin(array('member_id'=>$store_info['member_id']));
  45. //营业执照
  46. if($storejoinin_info){
  47. $this->store_info['business_licence_number_electronic']=($storejoinin_info['business_licence_number_electronic'] && $storejoinin_info['store_type']==0)?get_store_joinin_imageurl($storejoinin_info['business_licence_number_electronic']):'';
  48. }
  49. }
  50. $this->outputStoreInfo($this->store_info);
  51. $this->getStorenavigation($store_id);
  52. $this->outputSeoInfo($this->store_info);
  53. }
  54. }
  55. /**
  56. * 检查店铺开启状态
  57. *
  58. * @param int $store_id 店铺编号
  59. * @param string $msg 警告信息
  60. */
  61. protected function outputStoreInfo($store_info) {
  62. $store_model = model('store');
  63. //店铺分类
  64. $goodsclass_model = model('storegoodsclass');
  65. $goods_class_list = $goodsclass_model->getShowTreeList($store_info['store_id']);
  66. View::assign('goods_class_list', $goods_class_list);
  67. //热销排行
  68. $hot_sales = $store_model->getHotSalesList($store_info['store_id'], 5);
  69. View::assign('hot_sales', $hot_sales);
  70. //收藏排行
  71. $hot_collect = $store_model->getHotCollectList($store_info['store_id'], 5);
  72. View::assign('hot_collect', $hot_collect);
  73. View::assign('store_info', $store_info);
  74. View::assign('page_title', $store_info['store_name']);
  75. }
  76. protected function getStorenavigation($store_id) {
  77. $storenavigation_model = model('storenavigation');
  78. $store_navigation_list = $storenavigation_model->getStorenavigationList(array('storenav_store_id' => $store_id));
  79. View::assign('store_navigation_list', $store_navigation_list);
  80. }
  81. protected function outputSeoInfo($store_info) {
  82. $seo_param = array();
  83. $seo_param['shopname'] = $store_info['store_name'];
  84. $seo_param['key'] = $store_info['store_keywords'];
  85. $seo_param['description'] = $store_info['store_description'];
  86. //SEO 设置
  87. $this->_assign_seo(model('seo')->type('shop')->param($seo_param)->show());
  88. }
  89. }
  90. ?>