feat: 添加白名单状态验证
This commit is contained in:
parent
7ec5cb559e
commit
7c9e1b5b9a
|
|
@ -3,7 +3,9 @@
|
||||||
<component name="MaterialThemeProjectNewConfig">
|
<component name="MaterialThemeProjectNewConfig">
|
||||||
<option name="metadata">
|
<option name="metadata">
|
||||||
<MTProjectMetadataState>
|
<MTProjectMetadataState>
|
||||||
<option name="userId" value="43b882ab:19e8e7ab67a:-7ff2" />
|
<option name="migrated" value="true" />
|
||||||
|
<option name="pristineConfig" value="false" />
|
||||||
|
<option name="userId" value="-ef169b8:19dcecdb453:-7ffe" />
|
||||||
</MTProjectMetadataState>
|
</MTProjectMetadataState>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
|
|
|
||||||
|
|
@ -3,5 +3,5 @@ org.gradle.downloadSources=false
|
||||||
org.gradle.parallel=true
|
org.gradle.parallel=true
|
||||||
org.gradle.degree_of_parallelism=16
|
org.gradle.degree_of_parallelism=16
|
||||||
project_group=top.r3944realms.ltdmanager
|
project_group=top.r3944realms.ltdmanager
|
||||||
project_version=1.19-SNAPSHOT
|
project_version=1.20-SNAPSHOT
|
||||||
dg_lab_version=4.4.14.19
|
dg_lab_version=4.4.14.19
|
||||||
|
|
|
||||||
|
|
@ -208,7 +208,7 @@ class InvitationCodesModule(
|
||||||
val placeholders = java.lang.String.join(",", Collections.nCopies(qqIds.size, "?"))
|
val placeholders = java.lang.String.join(",", Collections.nCopies(qqIds.size, "?"))
|
||||||
// 修正SQL语句的表名引用
|
// 修正SQL语句的表名引用
|
||||||
val 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
|
FROM ltd_manager_bot.qualified_user_info q
|
||||||
WHERE q.qq IN ($placeholders)
|
WHERE q.qq IN ($placeholders)
|
||||||
""".trimIndent()
|
""".trimIndent()
|
||||||
|
|
@ -223,20 +223,33 @@ class InvitationCodesModule(
|
||||||
pstmt.executeQuery().use { rs ->
|
pstmt.executeQuery().use { rs ->
|
||||||
// 创建结果映射表
|
// 创建结果映射表
|
||||||
val resultMap = mutableMapOf<Long, Triple<Long?, Boolean?, Boolean?>>()
|
val resultMap = mutableMapOf<Long, Triple<Long?, Boolean?, Boolean?>>()
|
||||||
|
var invalidMap = mutableMapOf<Long, String?>()
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
|
val state = rs.getInt("status")
|
||||||
val qq = rs.getLong("qq")
|
val qq = rs.getLong("qq")
|
||||||
|
invalidMap[qq] = when (state) {
|
||||||
|
1 -> {
|
||||||
val playerId = rs.getLong("player_id")
|
val playerId = rs.getLong("player_id")
|
||||||
// 处理可能的null值
|
// 处理可能的null值
|
||||||
val playerIdValue = if (rs.wasNull()) null else playerId
|
val playerIdValue = if (rs.wasNull()) null else playerId
|
||||||
val effective = rs.getBoolean("effective")
|
val effective = rs.getBoolean("effective")
|
||||||
val isUsed = rs.getBoolean("is_used")
|
val isUsed = rs.getBoolean("is_used")
|
||||||
|
|
||||||
resultMap[qq] = Triple(playerIdValue, effective, isUsed)
|
resultMap[qq] = Triple(playerIdValue, effective, isUsed)
|
||||||
|
null
|
||||||
|
}
|
||||||
|
2 -> "白名单在审核中,请耐心等待"
|
||||||
|
3 -> "白名单不通过,无权获得邀请码"
|
||||||
|
else -> "无效状态,请联系管理员,错误状态码: $state"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 分类处理每个消息
|
// 分类处理每个消息
|
||||||
for (msg in msgs) {
|
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]
|
val result = resultMap[msg.userId]
|
||||||
|
|
||||||
when {
|
when {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user