BaseMember.php 9.8 KB

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