BaseMember.php 10 KB

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