BaseStoreSns.php 2.8 KB

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