[+] Game music popularity for chusan

pull/109/head
Azalea 2025-01-12 05:54:15 -05:00
parent ef8cb7e0ee
commit 208fb8cf73
2 changed files with 13 additions and 2 deletions

View File

@ -6,6 +6,7 @@ import icu.samnyan.aqua.net.utils.simpleDescribe
import icu.samnyan.aqua.sega.allnet.TokenChecker
import icu.samnyan.aqua.sega.chusan.handler.chusanInit
import icu.samnyan.aqua.sega.chusan.model.Chu3Repos
import icu.samnyan.aqua.sega.general.GameMusicPopularity
import icu.samnyan.aqua.sega.general.MeowApi
import icu.samnyan.aqua.sega.general.RequestContext
import icu.samnyan.aqua.sega.util.jackson.BasicMapper
@ -28,7 +29,8 @@ class ChusanController(
val db: Chu3Repos,
val us: AquaUserServices,
val versionHelper: ChusanVersionHelper,
val props: ChusanProps
val props: ChusanProps,
val pop: GameMusicPopularity,
): MeowApi({ api, resp ->
if (resp is String) resp
else (if ("CM" in api) cmMapper else mapper).write(resp)

View File

@ -16,8 +16,17 @@ fun ChusanController.chusanInit() {
cmApiInit()
upsertApiInit()
// Game music popularity
"GetGameRanking" {
val type = parsing { data["type"]!!.int }
// TODO: figure out what type does
mapOf("type" to type, "length" to 0, "gameRankingList" to (pop.ranking["chusan"] ?: listOf()).map {
mapOf("id" to it.musicId, "point" to it.weight)
})
}
// Stub handlers
"GetGameRanking" { """{"type":"${data["type"]}","length":"0","gameRankingList":[]}""" }
"GetGameIdlist" { """{"type":"${data["type"]}","length":"0","gameIdlistList":[]}""" }
"GetTeamCourseSetting" { """{"userId":"${data["userId"]}","length":"0","nextIndex":"0","teamCourseSettingList":[]}""" }