subTagClound.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. require_once 'conn.php';
  3. checkLogin();
  4. // 检查当前用户是否为组长
  5. $isLeader = false;
  6. $userInfoQuery = "SELECT em_role, em_permission_role_id FROM employee WHERE id = " . $_SESSION['employee_id'];
  7. $userResult = $conn->query($userInfoQuery);
  8. if ($userResult && $userRow = $userResult->fetch_assoc()) {
  9. // 只有 em_permission_role_id=2 表示该用户是组长
  10. $isLeader = ($userRow['em_permission_role_id'] == 2);
  11. }
  12. // 如果不是组长,直接跳转到客户列表页面
  13. if (!$isLeader) {
  14. header('Location: customers.php');
  15. exit;
  16. }
  17. ?>
  18. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  19. <html xmlns="http://www.w3.org/1999/xhtml">
  20. <head>
  21. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  22. <title>管理区域</title>
  23. <link rel="stylesheet" href="css/common.css" type="text/css" />
  24. <link rel="stylesheet" href="css/alert.css" type="text/css" />
  25. <script src="system/js/jquery-1.7.2.min.js"></script>
  26. <script src="js/js.js"></script>
  27. <style>
  28. body {
  29. margin: 0;
  30. padding: 20px;
  31. background: #fff;
  32. }
  33. #man_zone {
  34. margin-left: 0;
  35. }
  36. </style>
  37. </head>
  38. <body class="clear">
  39. <?php // require_once 'panel.php'; ?>
  40. <div id="man_zone">
  41. <?php
  42. // 获取所有em_role等于当前用户employee_id的员工
  43. $employeeResult = $conn->query("SELECT id, em_user FROM employee WHERE em_role=" . $_SESSION['employee_id']);
  44. if ($employeeResult) {
  45. while ($employeeRow = $employeeResult->fetch_assoc()) {
  46. ?>
  47. <div class="tagclound">
  48. <h1 class="tagCloundHead2"><?= htmlspecialcharsFix($employeeRow['em_user']) ?>的客户画像:</h1>
  49. <div class="tagArea">
  50. <?php
  51. // 对每个员工,查询其添加的所有标签
  52. $tagResult = $conn->query("SELECT tagName, COUNT(id) as count FROM tagtable WHERE employeeId=" . $employeeRow['id'] . " GROUP BY tagName");
  53. if ($tagResult) {
  54. while ($tagRow = $tagResult->fetch_assoc()) {
  55. echo '<a href="subTag.php?employeeId=' . $employeeRow['id'] . '&tagName=' . urlencode($tagRow['tagName']) . '">' .
  56. htmlspecialcharsFix($tagRow['tagName']) . '(' . $tagRow['count'] . ')</a>';
  57. }
  58. }
  59. ?>
  60. </div>
  61. </div>
  62. <?php
  63. }
  64. }
  65. ?>
  66. </div>
  67. </body>
  68. </html>