PlatformmobileController.class.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <?php
  2. /**
  3. * lionfish 商城系统
  4. *
  5. * ==========================================================================
  6. * @link http://www.liofis.com/
  7. * @copyright Copyright (c) 2015 liofis.com.
  8. * @license http://www.liofis.com/license.html License
  9. * ==========================================================================
  10. *
  11. * @author fish
  12. *
  13. */
  14. namespace Seller\Controller;
  15. class PlatformmobileController extends CommonController{
  16. protected $menu;
  17. protected function _initialize(){
  18. parent::_initialize();
  19. $menu = array(
  20. 'title' => '平台手机端',
  21. 'subtitle' => '平台手机端',
  22. 'route' => 'mptradecomponts/index',
  23. 'items' => array(
  24. array('title' => '设置', 'route' => 'platformmobile/config'), )
  25. );
  26. $perm_url = strtolower(CONTROLLER_NAME) .'/'. strtolower(ACTION_NAME);
  27. $this->assign('perm_url', $perm_url );
  28. //组件权限方法===begin
  29. if(SELLERUID != 1)
  30. {
  31. $seller_info = M('seller')->field('s_role_id')->where( array('s_id' => SELLERUID ) )->find();
  32. $perm_role = M('lionfish_comshop_perm_role')->where( array('id' => $seller_info['s_role_id']) )->find();
  33. $perms_str = $perm_role['perms2'];
  34. $items = [];
  35. $can_use_routearr = [];
  36. foreach( $menu['items'] as $val )
  37. {
  38. $val_route = str_replace('/','.', $val['route']);
  39. if( strpos($perms_str, '.'.$val_route) !== false )
  40. {
  41. $items[] = $val;
  42. $can_use_routearr[] = strtolower($val['route']);
  43. }
  44. }
  45. $menu['items'] = $items;
  46. if( empty($can_use_routearr) )
  47. {
  48. $this->redirect( 'application/index', [], 1,'您没有当前应用权限' );
  49. }else if( !in_array($perm_url , $can_use_routearr ) )
  50. {
  51. $this->redirect( $can_use_routearr[0] );
  52. }
  53. }
  54. //组件方法end
  55. $this->menu = $menu;
  56. $this->assign('menu', $menu );
  57. }
  58. public function config()
  59. {
  60. $_GPC = I('request.');
  61. //提交更新
  62. if(IS_POST)
  63. {
  64. //获取选中的会员id
  65. $data = array();
  66. $data['userids'] = $_GPC['limit_user_list'];
  67. $platform = array();
  68. $platform['platform_admin_member']= $data['userids'];
  69. $platform['isopen_admin_managefront']= $_GPC['isopen_admin_managefront'];
  70. D('Seller/Config')->update($platform);
  71. show_json(1, array('url' => $_SERVER['HTTP_REFERER']));
  72. }
  73. $data = D('Seller/Config')->get_all_config();
  74. //查询下会员id
  75. if(!empty($data['platform_admin_member'])){
  76. //in语句查询会员对应信息
  77. $list = array();
  78. if( !empty($data['platform_admin_member']) )
  79. {
  80. $list = M('lionfish_comshop_member')->field('member_id, username as nickname,avatar')->where('member_id in('.$data['platform_admin_member'].')')->select();
  81. }
  82. //组合
  83. foreach($list as $key => $vv){
  84. $userall =array(
  85. 'member_id' => $vv[member_id],
  86. 'nickname' => $vv[nickname],
  87. 'avatar' => tomedia($vv[avatar]),
  88. );
  89. $user_list[$key]=$userall;
  90. }
  91. }else{
  92. $user_list = array();
  93. }
  94. $data = D('Seller/Config')->get_all_config();
  95. $this->data = $data;
  96. $this->user_list = $user_list;
  97. $this->display();
  98. }
  99. }
  100. ?>