BaseMember.php 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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 BaseMember extends BaseHome {
  20. protected $member_info = array(); // 会员信息
  21. public function initialize() {
  22. parent::initialize();
  23. Lang::load(base_path() . 'home/lang/'.config('lang.default_lang').'/basemember.lang.php');
  24. /*非登录状态*/
  25. if (!session('is_login')) {
  26. $ref_url = request_uri();
  27. if(!strpos($ref_url, '://')){
  28. $ref_url=str_replace('/index.php', '', BASE_SITE_URL).$ref_url;
  29. }
  30. session('ref_url',$ref_url);
  31. $this->redirect(url('Login/login'));
  32. }
  33. //会员中心模板路径
  34. $this->template_dir = 'default/member/' . strtolower(request()->controller()) . '/';
  35. $this->member_info = $this->getMemberAndGradeInfo(true);
  36. if($this->member_info['member_nickname'] != session('member_nickname')){
  37. session('member_nickname',$this->member_info['member_nickname']);
  38. }
  39. View::assign('member_info', $this->member_info);
  40. }
  41. /**
  42. * 当前选中的栏目
  43. */
  44. protected function setMemberCurItem($curitem = '') {
  45. View::assign('member_item', $this->getMemberItemList());
  46. View::assign('curitem', $curitem);
  47. }
  48. /**
  49. * 当前选中的子菜单
  50. */
  51. protected function setMemberCurMenu($cursubmenu = '') {
  52. $member_menu = $this->getMemberMenuList();
  53. View::assign('member_menu', $member_menu);
  54. $curmenu = '';
  55. foreach ($member_menu as $key => $menu) {
  56. foreach ($menu['submenu'] as $subkey => $submenu) {
  57. if ($submenu['name'] == $cursubmenu) {
  58. $curmenu = $menu['name'];
  59. $nav = $submenu['text'];
  60. }
  61. }
  62. }
  63. // 面包屑
  64. $nav_link = array();
  65. $nav_link[] = array('title' => lang('homepage'), 'link' => HOME_SITE_URL);
  66. if ($curmenu == '') {
  67. $nav_link[] = array('title' => lang('ds_user_center'));
  68. } else {
  69. $nav_link[] = array('title' => lang('ds_user_center'), 'link' => (string)url('Member/index'));
  70. $nav_link[] = array('title' => $nav);
  71. }
  72. View::assign('nav_link_list', $nav_link);
  73. //当前一级菜单
  74. View::assign('curmenu', $curmenu);
  75. //当前二级菜单
  76. View::assign('cursubmenu', $cursubmenu);
  77. }
  78. /*
  79. * 获取卖家栏目列表,针对控制器下的栏目
  80. */
  81. protected function getMemberItemList() {
  82. return array();
  83. }
  84. /*
  85. * 获取卖家菜单列表
  86. */
  87. private function getMemberMenuList() {
  88. $menu_list = array(
  89. 'trade' =>
  90. array(
  91. 'name' => 'trade',
  92. 'ico' => '&#xe71f;',
  93. 'text' => lang('ds_trade_manage'),
  94. 'url' => (string)url('Memberorder/index'),
  95. 'submenu' => array(
  96. array('name' => 'member_order', 'text' => lang('ds_real_order'), 'url' => (string)url('Memberorder/index'),),
  97. array('name' => 'member_vr_order', 'text' =>lang('ds_virtual_orders'), 'url' => (string)url('Membervrorder/index'),),
  98. array('name' => 'member_arrivalnotice', 'text' => lang('ds_arrivalnotice'), 'url' => (string)url('MemberArrivalnotice/index'),),
  99. array('name' => 'member_evaluate', 'text' => lang('ds_trading_evaluation'), 'url' => (string)url('Memberevaluate/index'),),
  100. array('name' => 'member_pointorder', 'text' => lang('ds_member_pointorder'), 'url' => (string)url('Memberpointorder/index'),),
  101. )
  102. ),
  103. 'info' =>
  104. array(
  105. 'name' => 'info',
  106. 'ico' => '&#xe702;',
  107. 'text' => lang('ds_info_management'),
  108. 'url' => (string)url('Memberinformation/index'),
  109. 'submenu' => array(
  110. array('name' => 'member_auth', 'text' =>lang('member_auth'), 'url' => (string)url('MemberAuth/index'),),
  111. array('name' => 'member_information', 'text' => lang('ds_account_information'), 'url' => (string)url('Memberinformation/index'),),
  112. array('name' => 'member_security', 'text' =>lang('ds_account_security'), 'url' => (string)url('Membersecurity/index'),),
  113. array('name' => 'member_address', 'text' => lang('ds_member_path_address'), 'url' => (string)url('Memberaddress/index'),),
  114. array('name' => 'member_bank', 'text' => lang('ds_member_path_bank'), 'url' => (string)url('Memberbank/index'),),
  115. array('name' => 'member_invoice', 'text' => lang('ds_member_invoice'), 'url' => (string)url('Memberinvoice/index'),),
  116. array('name' => 'member_message', 'text' => lang('ds_my_news'), 'url' => (string)url('Membermessage/message'),),
  117. array('name' => 'member_favorites', 'text' => lang('ds_member_path_favorites'), 'url' => (string)url('Memberfavorites/fglist'),),
  118. array('name' => 'member_snsfriend', 'text' => lang('ds_my_good_friend'), 'url' => (string)url('Membersnsfriend/index'),),
  119. array('name' => 'member_goodsbrowse', 'text' => lang('ds_my_footprint'), 'url' => (string)url('Membergoodsbrowse/listinfo'),),
  120. array('name' => 'member_connect', 'text' => lang('ds_third_party_account_login'), 'url' => (string)url('Memberconnect/qqbind'),),
  121. )
  122. ),
  123. 'assets' =>
  124. array(
  125. 'name' => 'assets',
  126. 'ico' => '&#xe6e2;',
  127. 'text' => lang('ds_assets_management'),
  128. 'url' => (string)url('Memberinformation/index'),
  129. 'submenu' => array(
  130. array('name' => 'predeposit', 'text' => lang('ds_account_balance'), 'url' => (string)url('Predeposit/index'),),
  131. array('name' => 'member_points', 'text' => lang('ds_member_points_manage'), 'url' => (string)url('Memberpoints/index'),),
  132. array('name' => 'member_voucher', 'text' => lang('ds_member_path_myvoucher'), 'url' => (string)url('Membervoucher/storevoucher'),),
  133. )
  134. ),
  135. 'server' =>
  136. array(
  137. 'name' => 'server',
  138. 'ico' => '&#xe73f;',
  139. 'text' => lang('ds_customer_service'),
  140. 'url' => (string)url('Memberrefund/index'),
  141. 'submenu' => array(
  142. array('name' => 'member_refund', 'text' => lang('ds_refund_and_return'), 'url' => (string)url('Memberrefund/index'),),
  143. array('name' => 'member_complain', 'text' => lang('ds_trade_complaints'), 'url' => (string)url('Membercomplain/index'),),
  144. array('name' => 'member_consult', 'text' => lang('ds_commodity_consulting'), 'url' => (string)url('Memberconsult/index'),),
  145. array('name' => 'member_inform', 'text' => lang('ds_violation_to_report'), 'url' => (string)url('Memberinform/index'),),
  146. array('name' => 'member_mallconsult', 'text' => lang('ds_platform_for_customer_service'), 'url' => (string)url('Membermallconsult/index'),),
  147. array('name' => 'member_feedback', 'text' => lang('ds_feed_back'), 'url' => (string)url('Memberfeedback/index'),),
  148. )
  149. ),
  150. );
  151. if (config('ds_config.inviter_open')) {
  152. //查看是否已是分销会员
  153. $inviter_model = model('inviter');
  154. $inviter_info = $inviter_model->getInviterInfo('i.inviter_id=' . session('member_id'));
  155. if ($inviter_info && $inviter_info['inviter_state'] == 1) {
  156. $menu_list['inviter'] = array(
  157. 'name' => 'inviter',
  158. 'ico' => '&#xe6ed;',
  159. 'text' => lang('ds_member_distribution'),
  160. 'url' => (string)url('Memberinviter/index'),
  161. 'submenu' => array(
  162. array('name' => 'inviter_poster', 'text' => lang('ds_distribution_information'), 'url' => (string)url('Memberinviter/index'),),
  163. array('name' => 'inviter_user', 'text' => lang('ds_distribution_member'), 'url' => (string)url('Memberinviter/user'),),
  164. array('name' => 'inviter_order', 'text' => lang('ds_distribution_commission'), 'url' => (string)url('Memberinviter/order'),),
  165. )
  166. );
  167. } else {
  168. $menu_list['inviter'] = array(
  169. 'name' => 'inviter',
  170. 'ico' => '&#xe6ed;',
  171. 'text' => lang('ds_member_distribution'),
  172. 'url' => (string)url('Memberinviter/add'),
  173. 'submenu' => array(
  174. array('name' => 'inviter_add', 'text' => lang('ds_become_member'), 'url' => (string)url('Memberinviter/add'),),
  175. )
  176. );
  177. }
  178. }
  179. if(config('ds_config.flea_isuse')){
  180. $menu_list['info']['submenu'][]=array('name' => 'member_flea', 'text' => lang('ds_member_path_flea'), 'url' => (string)url('Memberflea/index'),);
  181. }
  182. return $menu_list;
  183. }
  184. }
  185. ?>