BaseMember.php 9.5 KB

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