This commit is contained in:
Flatlogic Bot 2026-02-22 08:42:26 +00:00
parent bb14c2ece7
commit accdd4c3dc
3 changed files with 15 additions and 8 deletions

View File

@ -242,15 +242,15 @@ if ($action === 'admin_get_all') {
SUM(v.is_unread) as unread_count, SUM(v.is_unread) as unread_count,
MAX(v.has_recharge) as has_recharge, MAX(v.has_recharge) as has_recharge,
CASE CASE
WHEN m.message LIKE '<img%' THEN '[图片消息]' WHEN MAX(m.message) LIKE '<img%' THEN '[图片消息]'
WHEN (m.message IS NULL OR m.message = '') AND MAX(v.has_recharge) = 1 THEN '[充值申请]' WHEN (MAX(m.message) IS NULL OR MAX(m.message) = '') AND MAX(v.has_recharge) = 1 THEN '[充值申请]'
ELSE COALESCE(m.message, '新会话') ELSE COALESCE(MAX(m.message), '新会话')
END as message, END as message,
COALESCE(m.created_at, MAX(v.last_activity)) as created_at, COALESCE(MAX(m.created_at), MAX(v.last_activity)) as created_at,
COALESCE(u.username, u.email, CONCAT('访客 ', COALESCE(NULLIF(MAX(v.effective_ip), ''), '0.0.0.0'))) as username, COALESCE(MAX(u.username), MAX(u.email), CONCAT('访客 ', COALESCE(NULLIF(MAX(v.effective_ip), ''), '0.0.0.0'))) as username,
IFNULL(u.uid, '---') as uid, IFNULL(MAX(u.uid), '---') as uid,
IFNULL(u.registration_ip, '---') as registration_ip, IFNULL(MAX(u.registration_ip), '---') as registration_ip,
IFNULL(r.remark, '') as remark, IFNULL(MAX(r.remark), '') as remark,
IFNULL(MAX(v.user_time), '---') as user_time IFNULL(MAX(v.user_time), '---') as user_time
FROM ( FROM (
SELECT SELECT

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -108,6 +108,13 @@ function ensureSchema() {
} }
} }
// --- messages table ---
$stmt = $db->query("DESCRIBE messages");
$columns = $stmt->fetchAll(PDO::FETCH_COLUMN);
if (!in_array('is_read', $columns)) {
$db->exec("ALTER TABLE messages ADD COLUMN is_read TINYINT(1) DEFAULT 0");
}
// --- chat_visitors table --- // --- chat_visitors table ---
$stmt = $db->query("SHOW INDEX FROM chat_visitors WHERE Key_name = 'session_id_unique'"); $stmt = $db->query("SHOW INDEX FROM chat_visitors WHERE Key_name = 'session_id_unique'");
if (!$stmt->fetch()) { if (!$stmt->fetch()) {