BaseStoreSns.php 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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 BaseStoreSns extends BaseHome {
  17. const MAX_RECORDNUM = 20; // 允许插入新记录的最大次数,sns页面该常量是一样的。
  18. public function initialize() {
  19. parent::initialize();
  20. Lang::load(base_path() . 'home/lang/'.config('lang.default_lang').'/baseseller.lang.php');
  21. $this->template_dir = 'default/store/default/' . strtolower(request()->controller()) . '/';
  22. View::assign('store_theme','default');
  23. View::assign('max_recordnum', self::MAX_RECORDNUM);
  24. // 自定义导航条
  25. $this->getStorenavigation();
  26. //查询会员信息
  27. $this->getMemberAndGradeInfo(false);
  28. }
  29. // 自定义导航条
  30. protected function getStorenavigation() {
  31. $storenavigation_model = model('storenavigation');
  32. $store_navigation_list = $storenavigation_model->getStorenavigationList(array('storenav_store_id' => intval(input('param.sid'))));
  33. View::assign('store_navigation_list', $store_navigation_list);
  34. }
  35. protected function getStoreInfo($store_id) {
  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. }
  64. ?>