mirror of
https://github.com/MewoLab/AquaDX.git
synced 2026-02-11 04:47:26 +08:00
[O] Reformat GetUserMusic
This commit is contained in:
@@ -167,10 +167,11 @@ fun ChusanController.chusanInit() {
|
|||||||
|
|
||||||
"GetUserMusic".paged("userMusicList") {
|
"GetUserMusic".paged("userMusicList") {
|
||||||
// Compatibility: Older chusan uses boolean for isSuccess
|
// Compatibility: Older chusan uses boolean for isSuccess
|
||||||
fun checkAncient(d: List<UserMusicDetail>) =
|
fun checkAncient(d: List<UserMusicDetail>) = data["version"]?.double?.let { ver ->
|
||||||
data["version"]?.double?.let { if (it >= 2.15) d else d.map {
|
if (ver >= 2.15) d else d.map { entry ->
|
||||||
d.toJson().jsonMap().mut.apply { this["isSuccess"] = this["isSuccess"].truthy }
|
entry.toJson().jsonMap().mut.also { it["isSuccess"] = it["isSuccess"].truthy }
|
||||||
} } ?: d
|
}
|
||||||
|
} ?: d
|
||||||
|
|
||||||
db.userMusicDetail.findByUser_Card_ExtId(uid).groupBy { it.musicId }
|
db.userMusicDetail.findByUser_Card_ExtId(uid).groupBy { it.musicId }
|
||||||
.mapValues { mapOf("length" to it.value.size, "userMusicDetailList" to checkAncient(it.value)) }
|
.mapValues { mapOf("length" to it.value.size, "userMusicDetailList" to checkAncient(it.value)) }
|
||||||
|
|||||||
Reference in New Issue
Block a user