[F] Data import fix (#153)

This commit is contained in:
Menci
2025-07-05 00:45:09 +08:00
committed by GitHub
parent d79a4e5499
commit e3486042a5
4 changed files with 30 additions and 22 deletions

View File

@@ -17,6 +17,7 @@ import kotlin.reflect.full.declaredMemberProperties
import icu.samnyan.aqua.net.Fedy
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.context.annotation.Lazy
import org.springframework.beans.factory.ObjectProvider
/**
* @author samnyan (privateamusement@protonmail.com)
@@ -40,7 +41,7 @@ class Maimai2ServletController(
val net: Maimai2,
): MeowApi(serialize = { _, resp -> if (resp is String) resp else resp.toJson() }) {
@Autowired(required = false) @Lazy var fedy: Fedy? = null
@Autowired @Lazy lateinit var fedy: Fedy
companion object {
private val log = logger()
@@ -94,9 +95,7 @@ class Maimai2ServletController(
val ctx = RequestContext(req, data.mut)
serialize(api, handlers[api]!!(ctx) ?: noop).also {
log.info("$token : $api > ${it.truncate(500)}")
if (api == "UpsertUserAllApi") {
fedy?.onUpserted("mai2", data["userId"])
}
if (api == "UpsertUserAllApi") { fedy.onUpserted("mai2", data["userId"]) }
}
}
} catch (e: Exception) {