人人商城

group.ctrl.php 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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 ($do == 'display') {
  11. $_W['page']['title'] = '副创始人组列表 - 副创始人组 - 副创始人管理';
  12. $pageindex = max(1, intval($_GPC['page']));
  13. $pagesize = 10;
  14. $condition = '' ;
  15. $params = array();
  16. $name = safe_gpc_string($_GPC['name']);
  17. if (!empty($name)) {
  18. $condition .= "WHERE name LIKE :name";
  19. $params[':name'] = "%{$name}%";
  20. }
  21. $lists = pdo_fetchall("SELECT * FROM " . tablename('users_founder_group') . $condition . " LIMIT " . ($pageindex - 1) * $pagesize . "," . $pagesize, $params);
  22. $lists = user_group_format($lists);
  23. $total = pdo_fetchcolumn("SELECT COUNT(*) FROM " . tablename('users_founder_group') . $condition, $params);
  24. $pager = pagination($total, $pageindex, $pagesize);
  25. template('founder/group');
  26. }
  27. if ($do == 'post') {
  28. $id = intval($_GPC['id']);
  29. if (!empty($id)) {
  30. $group_info = pdo_get('users_founder_group', array('id' => $id));
  31. $group_info['package'] = iunserializer($group_info['package']);
  32. if (!empty($group_info['package']) && in_array(-1, $group_info['package'])) {
  33. $group_info['check_all'] = true;
  34. }
  35. }
  36. $packages = uni_groups();
  37. if (!empty($packages)) {
  38. foreach ($packages as $uni_group_id => &$package_info) {
  39. if (!empty($group_info['package']) && in_array($uni_group_id, $group_info['package'])) {
  40. $package_info['checked'] = true;
  41. } else {
  42. $package_info['checked'] = false;
  43. }
  44. }
  45. unset($package_info);
  46. }
  47. if (checksubmit('submit')) {
  48. $founder_user_group = array(
  49. 'id' => intval($_GPC['id']),
  50. 'name' => safe_gpc_string($_GPC['name']),
  51. 'package' => safe_gpc_array($_GPC['package']),
  52. 'maxaccount' => intval($_GPC['maxaccount']),
  53. 'maxwxapp' => intval($_GPC['maxwxapp']),
  54. 'maxwebapp' => intval($_GPC['maxwebapp']),
  55. 'maxphoneapp' => intval($_GPC['maxphoneapp']),
  56. 'maxxzapp' => intval($_GPC['maxxzapp']),
  57. 'maxaliapp' => intval($_GPC['maxaliapp']),
  58. 'timelimit' => intval($_GPC['timelimit'])
  59. );
  60. $user_group = user_save_founder_group($founder_user_group);
  61. if (is_error($user_group)) {
  62. itoast($user_group['message'], '', '');
  63. }
  64. cache_clean(cache_system_key('user_modules'));
  65. itoast('用户组更新成功!', url('founder/group'), 'success');
  66. }
  67. template('founder/group-post');
  68. }
  69. if ($do == 'del') {
  70. $id = intval($_GPC['id']);
  71. $result = pdo_delete('users_founder_group', array('id' => $id));
  72. if(!empty($result)){
  73. itoast('删除成功!', url('founder/group/'), 'success');
  74. }else {
  75. itoast('删除失败!请稍候重试!', url('founder/group'), 'error');
  76. }
  77. exit;
  78. }