1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- <?php
- require_once 'conn.php';
- checkLogin();
- ?>
- <!DOCTYPE html>
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>管理区域</title>
- <link rel="stylesheet" href="css/common.css" type="text/css" />
- <link rel="stylesheet" href="css/alert.css" type="text/css" />
- <script src="system/js/jquery-1.7.2.min.js"></script>
- <script src="js/js.js"></script>
- </head>
- <body class="clear">
- <?php require_once 'panel.php'; ?>
- <div id="man_zone">
- <div class="searchForm homeSearch">
- <form method="post" action="/searchResult.php" accept-charset="UTF-8">
- <input class="keywords" id="keyword" name="keywords" placeholder="请输入联系人 / 电话 / 邮箱 / 微信 / WhatsApp.." >
- <input class="searchSubmit" type="submit" value="客户检索">
- </form>
- </div>
- </div>
- <?php
- $sql = "SELECT cs_code, em_user, cs_claimdate FROM customer
- LEFT JOIN employee ON customer.cs_belong = employee.id
- WHERE customer.id IN (
- SELECT cs_id FROM claimRecord
- WHERE isread = 0 AND originalEmp = ?
- )";
- $stmt = $conn->prepare($sql);
- $stmt->bind_param("s", $_SESSION['employee_name']);
- $stmt->execute();
- $result = $stmt->get_result();
- if ($result->num_rows > 0) {
- ?>
- <div class="modal" id="modal">
- <div class="modal-wraper">
- <div class="modal-content">
- <div class="popup-title">距离上次登录之后,以下客户已经被认领</div>
- <div class="popup-content">
- <ul>
- <?php while ($row = $result->fetch_assoc()) { ?>
- <li>
- <span class="prominent"><?= textUncode($row['cs_code']) ?></span> 被
- <span class="prominent"><?= textUncode($row['em_user']) ?></span> 于
- <span><?= textUncode($row['cs_claimdate']) ?></span> 认领
- </li>
- <?php } ?>
- </ul>
- </div>
- <div class="close" onclick="closePopup()">已读</div>
- </div>
- </div>
- </div>
- <?php
- }
- // Update claim records
- $update_sql = "UPDATE claimRecord SET isread = 1
- WHERE originalEmp = ? AND isread = 0";
- $update_stmt = $conn->prepare($update_sql);
- $update_stmt->bind_param("s", $_SESSION['employee_name']);
- $update_stmt->execute();
- $stmt->close();
- $update_stmt->close();
- ?>
- <script>
- // 检查是否首次登陆或是否过期
- const em = localStorage.getItem('em');
- const currentTime = new Date().getTime();
- const expirationTime = 24 * 60 * 60 * 1000; // 24小时的有效时间
- console.log(em);
- if (!em || em !== 'em<?= $_SESSION["employee_id"] ?>') {
- // 如果是首次登陆或已过期,显示弹窗
- $("#modal").addClass("active");
- setTimeout(function() {
- $("#modal").find(".modal-content").addClass("active");
- }, 0);
- // 存储当前时间戳
- localStorage.setItem('em', 'em<?= $_SESSION["employee_id"] ?>');
- }
- // 关闭弹窗的函数
- function closePopup() {
- $("#modal").removeClass("active");
- }
- </script>
- </body>
- </html>
|