From 7c9e1b5b9ab2c1a67607f068e63a61793ae8da50 Mon Sep 17 00:00:00 2001 From: 3944Realms Date: Fri, 5 Jun 2026 11:54:33 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E7=99=BD=E5=90=8D?= =?UTF-8?q?=E5=8D=95=E7=8A=B6=E6=80=81=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/material_theme_project_new.xml | 4 ++- gradle.properties | 2 +- .../module/InvitationCodesModule.kt | 31 +++++++++++++------ 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/.idea/material_theme_project_new.xml b/.idea/material_theme_project_new.xml index 69f3723..601c128 100644 --- a/.idea/material_theme_project_new.xml +++ b/.idea/material_theme_project_new.xml @@ -3,7 +3,9 @@ diff --git a/gradle.properties b/gradle.properties index 78f8da7..7330c5f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,5 +3,5 @@ org.gradle.downloadSources=false org.gradle.parallel=true org.gradle.degree_of_parallelism=16 project_group=top.r3944realms.ltdmanager -project_version=1.19-SNAPSHOT +project_version=1.20-SNAPSHOT dg_lab_version=4.4.14.19 diff --git a/src/main/kotlin/top/r3944realms/ltdmanager/module/InvitationCodesModule.kt b/src/main/kotlin/top/r3944realms/ltdmanager/module/InvitationCodesModule.kt index 4948cee..b5b6d3b 100644 --- a/src/main/kotlin/top/r3944realms/ltdmanager/module/InvitationCodesModule.kt +++ b/src/main/kotlin/top/r3944realms/ltdmanager/module/InvitationCodesModule.kt @@ -208,7 +208,7 @@ class InvitationCodesModule( val placeholders = java.lang.String.join(",", Collections.nCopies(qqIds.size, "?")) // 修正SQL语句的表名引用 val sql = """ - SELECT q.player_id, q.effective, q.is_used, q.qq + SELECT q.player_id, q.effective, q.is_used, q.qq, q.status FROM ltd_manager_bot.qualified_user_info q WHERE q.qq IN ($placeholders) """.trimIndent() @@ -223,20 +223,33 @@ class InvitationCodesModule( pstmt.executeQuery().use { rs -> // 创建结果映射表 val resultMap = mutableMapOf>() - + var invalidMap = mutableMapOf() while (rs.next()) { + val state = rs.getInt("status") val qq = rs.getLong("qq") - val playerId = rs.getLong("player_id") - // 处理可能的null值 - val playerIdValue = if (rs.wasNull()) null else playerId - val effective = rs.getBoolean("effective") - val isUsed = rs.getBoolean("is_used") - - resultMap[qq] = Triple(playerIdValue, effective, isUsed) + invalidMap[qq] = when (state) { + 1 -> { + val playerId = rs.getLong("player_id") + // 处理可能的null值 + val playerIdValue = if (rs.wasNull()) null else playerId + val effective = rs.getBoolean("effective") + val isUsed = rs.getBoolean("is_used") + resultMap[qq] = Triple(playerIdValue, effective, isUsed) + null + } + 2 -> "白名单在审核中,请耐心等待" + 3 -> "白名单不通过,无权获得邀请码" + else -> "无效状态,请联系管理员,错误状态码: $state" + } } // 分类处理每个消息 for (msg in msgs) { + var invalidMsg = invalidMap[msg.userId] + if (invalidMsg != null) { //无效时这里有值 + sendFailedMessage(napCatClient, msg.userId, msg.realId, msg.time, invalidMsg) + return + } val result = resultMap[msg.userId] when {