BaseStoreSns.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. class BaseStoreSns extends BaseHome
  13. {
  14. const MAX_RECORDNUM = 20; // 允许插入新记录的最大次数,sns页面该常量是一样的。
  15. public function initialize()
  16. {
  17. parent::initialize();
  18. Lang::load(base_path() . 'home/lang/' . config('lang.default_lang') . '/baseseller.lang.php');
  19. $this->template_dir = 'default/store/default/' . strtolower(request()->controller()) . '/';
  20. View::assign('store_theme', 'default');
  21. View::assign('max_recordnum', self::MAX_RECORDNUM);
  22. // 自定义导航条
  23. $this->getStorenavigation();
  24. //查询会员信息
  25. $this->getMemberAndGradeInfo(false);
  26. }
  27. // 自定义导航条
  28. protected function getStorenavigation()
  29. {
  30. $storenavigation_model = model('storenavigation');
  31. $store_navigation_list = $storenavigation_model->getStorenavigationList(array('storenav_store_id' => intval(input('param.sid'))));
  32. View::assign('store_navigation_list', $store_navigation_list);
  33. }
  34. protected function getStoreInfo($store_id)
  35. {
  36. //得到店铺等级信息
  37. $store_info = model('store')->getStoreInfoByID($store_id);
  38. if (empty($store_info)) {
  39. $this->error(lang('store_sns_store_not_exists'));
  40. }
  41. //处理地区信息
  42. $area_array = array();
  43. $area_array = explode("\t", $store_info["area_info"]);
  44. $map_city = lang('store_sns_city');
  45. $city = '';
  46. if (strpos($area_array[0], $map_city) !== false) {
  47. $city = $area_array[0];
  48. } else {
  49. $city = isset($area_array[1]) ? $area_array[1] : '';
  50. }
  51. $store_info['city'] = $city;
  52. $storejoinin_model = model('storejoinin');
  53. if (!$store_info['is_platform_store']) {
  54. $storejoinin_info = $storejoinin_model->getOneStorejoinin(array('member_id' => $store_info['member_id']));
  55. //营业执照
  56. if ($storejoinin_info) {
  57. $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']) : '';
  58. }
  59. }
  60. View::assign('store_theme', $store_info['store_theme']);
  61. View::assign('store_info', $store_info);
  62. }
  63. }