PlatformmobileController.class.php 3.3 KB

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