[+] Implement GetUserNetBattleData

pull/99/head^2
Azalea 2025-01-05 02:20:15 -05:00
parent 89e682df3d
commit 4820c38bce
1 changed files with 15 additions and 9 deletions

View File

@ -28,7 +28,15 @@ fun ChusanController.chusanInit() {
"GetUserRegion" { """{"userId":"${data["userId"]}","length":"0","userRegionList":[]}""" } "GetUserRegion" { """{"userId":"${data["userId"]}","length":"0","userRegionList":[]}""" }
"GetUserPrintedCard" { """{"userId":"${data["userId"]}","length":0,"nextIndex":-1,"userPrintedCardList":[]}""" } "GetUserPrintedCard" { """{"userId":"${data["userId"]}","length":0,"nextIndex":-1,"userPrintedCardList":[]}""" }
"GetUserSymbolChatSetting" { """{"userId":"${data["userId"]}","length":"0","symbolChatInfoList":[]}""" } "GetUserSymbolChatSetting" { """{"userId":"${data["userId"]}","length":"0","symbolChatInfoList":[]}""" }
"GetUserNetBattleData" { """{"userId":"${data["userId"]}","userNetBattleData":{"recentNBSelectMusicList":[],"recentNBMusicList":[]}}""" }
// Net battle data
"GetUserNetBattleData" {
val misc = db.userMisc.findSingleByUser_Card_ExtId(uid)()
mapOf("userId" to uid, "userNetBattleData" to mapOf(
"recentNBSelectMusicList" to (misc?.recentNbSelect ?: empty),
"recentNBMusicList" to (misc?.recentNbMusic ?: empty),
))
}
"GetUserNetBattleRankingInfo" { """{"userId":"${data["userId"]}","length":"0","userNetBattleRankingInfoList":{}}""" } "GetUserNetBattleRankingInfo" { """{"userId":"${data["userId"]}","length":"0","userNetBattleRankingInfoList":{}}""" }
// User handlers // User handlers
@ -111,14 +119,12 @@ fun ChusanController.chusanInit() {
"GetUserFavoriteItem".pagedWithKind("userFavoriteItemList") { "GetUserFavoriteItem".pagedWithKind("userFavoriteItemList") {
val kind = parsing { data["kind"]!!.int } val kind = parsing { data["kind"]!!.int }
mapOf("kind" to kind) grabs { mapOf("kind" to kind) grabs {
// TODO: Actually store this info at UpsertUserAll val misc = db.userMisc.findSingleByUser_Card_ExtId(uid)()
val fav = when (kind) { when (kind) {
1 -> "favorite_music" 1 -> misc?.favMusic ?: empty
3 -> "favorite_chara" 3 -> empty // TODO: Favorite character
else -> null else -> empty
}?.let { db.userGeneralData.findByUser_Card_ExtIdAndPropertyKey(uid, it)() }?.propertyValue }
fav?.ifBlank { null }?.split(",")?.map { it.int } ?: emptyList()
} }
} }