人人商城

foundergroup.ctrl.php 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. /**
  3. * [WeEngine System] Copyright (c) 2014 WE7.CC
  4. * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
  5. */
  6. defined('IN_IA') or exit('Access Denied');
  7. load()->model('user');
  8. $dos = array('display', 'post', 'del');
  9. $do = !empty($_GPC['do']) ? $_GPC['do'] : 'display';
  10. if ($_W['role'] != ACCOUNT_MANAGE_NAME_FOUNDER) {
  11. itoast('无权限操作!', referer(), 'error');
  12. }
  13. if ($do == 'display') {
  14. uni_user_permission_check('system_user_vice_group');
  15. $_W['page']['title'] = '副创始人组列表 - 副创始人组 - 副创始人管理';
  16. $name = trim($_GPC['name']);
  17. if (!empty($name)) {
  18. $condition['name LIKE'] = "%{$name}%";
  19. }
  20. $lists = pdo_getall('users_founder_group', $condition);
  21. $lists = user_group_format($lists);
  22. template('founder/founder-group');
  23. }
  24. if ($do == 'post') {
  25. uni_user_permission_check('system_founder_group_post');
  26. $id = intval($_GPC['id']);
  27. if (!empty($id)) {
  28. $group_info = pdo_get('users_founder_group', array('id' => $id));
  29. $group_info['package'] = iunserializer($group_info['package']);
  30. if (!empty($group_info['package']) && in_array(-1, $group_info['package'])) {
  31. $group_info['check_all'] = true;
  32. }
  33. }
  34. $packages = uni_groups();
  35. if (!empty($packages)) {
  36. foreach ($packages as $uni_group_id => &$package_info) {
  37. if (!empty($group_info['package']) && in_array($uni_group_id, $group_info['package'])) {
  38. $package_info['checked'] = true;
  39. } else {
  40. $package_info['checked'] = false;
  41. }
  42. }
  43. unset($package_info);
  44. }
  45. if (checksubmit('submit')) {
  46. $founder_user_group = array(
  47. 'id' => intval($_GPC['id']),
  48. 'name' => $_GPC['name'],
  49. 'package' => $_GPC['package'],
  50. 'maxaccount' => intval($_GPC['maxaccount']),
  51. 'maxwxapp' => intval($_GPC['maxwxapp']),
  52. 'timelimit' => intval($_GPC['timelimit'])
  53. );
  54. $user_group = user_save_founder_group($founder_user_group);
  55. if (is_error($user_group)) {
  56. itoast($user_group['message'], '', '');
  57. }
  58. itoast('用户组更新成功!', url('founder/foundergroup'), 'success');
  59. }
  60. template('founder/founder-group-post');
  61. }
  62. if ($do == 'del') {
  63. uni_user_permission_check('system_founder_group_del');
  64. $id = intval($_GPC['id']);
  65. $result = pdo_delete('users_founder_group', array('id' => $id));
  66. if(!empty($result)){
  67. itoast('删除成功!', url('founder/foundergroup/'), 'success');
  68. }else {
  69. itoast('删除失败!请稍候重试!', url('founder/foundergroup'), 'error');
  70. }
  71. exit;
  72. }