BaseStore.php 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <?php
  2. /*
  3. * 店铺的类
  4. */
  5. namespace app\home\controller;
  6. use think\facade\View;
  7. use think\facade\Lang;
  8. /**
  9. * ============================================================================
  10. * DSMall多用户商城
  11. * ============================================================================
  12. * 版权所有 2014-2028 长沙德尚网络科技有限公司,并保留所有权利。
  13. * 网站地址: http://www.csdeshang.com
  14. * ----------------------------------------------------------------------------
  15. * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用 .
  16. * 不允许对程序代码以任何形式任何目的的再发布。
  17. * ============================================================================
  18. * 控制器
  19. */
  20. class BaseStore extends BaseHome {
  21. protected $store_info;
  22. public function initialize() {
  23. parent::initialize();
  24. Lang::load(base_path() . 'home/lang/'.config('lang.default_lang').'/baseseller.lang.php');
  25. //店铺模板路径
  26. $this->template_dir = 'default/store/default/' . strtolower(request()->controller()) . '/';
  27. View::assign('store_theme', 'default');
  28. //当方法为 store 进行执行
  29. if (in_array(request()->controller(),array('Store','StoreSpecial'))) {
  30. //输出会员信息
  31. $this->getMemberAndGradeInfo(false);
  32. $store_id = intval(input('param.store_id'));
  33. if ($store_id <= 0) {
  34. $this->error(lang('ds_store_close'));
  35. }
  36. $store_model = model('store');
  37. $store_info = $store_model->getStoreOnlineInfoByID($store_id);
  38. if (empty($store_info)) {
  39. $this->error(lang('ds_store_close'));
  40. } else {
  41. $this->store_info = $store_info;
  42. }
  43. $storejoinin_model=model('storejoinin');
  44. if(!$store_info['is_platform_store']){
  45. $storejoinin_info=$storejoinin_model->getOneStorejoinin(array('member_id'=>$store_info['member_id']));
  46. //营业执照
  47. if($storejoinin_info){
  48. $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']):'';
  49. }
  50. }
  51. $this->outputStoreInfo($this->store_info);
  52. $this->getStorenavigation($store_id);
  53. $this->outputSeoInfo($this->store_info);
  54. }
  55. }
  56. /**
  57. * 检查店铺开启状态
  58. *
  59. * @param int $store_id 店铺编号
  60. * @param string $msg 警告信息
  61. */
  62. protected function outputStoreInfo($store_info) {
  63. $store_model = model('store');
  64. //店铺分类
  65. $goodsclass_model = model('storegoodsclass');
  66. $goods_class_list = $goodsclass_model->getShowTreeList($store_info['store_id']);
  67. View::assign('goods_class_list', $goods_class_list);
  68. //热销排行
  69. $hot_sales = $store_model->getHotSalesList($store_info['store_id'], 5);
  70. View::assign('hot_sales', $hot_sales);
  71. //收藏排行
  72. $hot_collect = $store_model->getHotCollectList($store_info['store_id'], 5);
  73. View::assign('hot_collect', $hot_collect);
  74. View::assign('store_info', $store_info);
  75. View::assign('page_title', $store_info['store_name']);
  76. }
  77. protected function getStorenavigation($store_id) {
  78. $storenavigation_model = model('storenavigation');
  79. $store_navigation_list = $storenavigation_model->getStorenavigationList(array('storenav_store_id' => $store_id));
  80. View::assign('store_navigation_list', $store_navigation_list);
  81. }
  82. protected function outputSeoInfo($store_info) {
  83. $seo_param = array();
  84. $seo_param['shopname'] = $store_info['store_name'];
  85. $seo_param['key'] = $store_info['store_keywords'];
  86. $seo_param['description'] = $store_info['store_description'];
  87. //SEO 设置
  88. $this->_assign_seo(model('seo')->type('shop')->param($seo_param)->show());
  89. }
  90. }
  91. ?>