mirror of
https://github.com/MewoLab/AquaDX.git
synced 2025-12-14 11:56:15 +08:00
Compare commits
8 Commits
01d4262fff
...
38b8831efd
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
38b8831efd | ||
|
|
6767b62fd5 | ||
|
|
458146ae0c | ||
|
|
b2aef08c01 | ||
|
|
e7b96d4b24 | ||
|
|
b87ff18c69 | ||
|
|
f3cf6735e4 | ||
|
|
ccd6367875 |
@@ -1,25 +0,0 @@
|
|||||||
image: gradle:alpine
|
|
||||||
|
|
||||||
before_script:
|
|
||||||
- GRADLE_USER_HOME="$(pwd)/.gradle"
|
|
||||||
- export GRADLE_USER_HOME
|
|
||||||
|
|
||||||
build:
|
|
||||||
stage: build
|
|
||||||
script: gradle --build-cache assemble
|
|
||||||
cache:
|
|
||||||
key: "$CI_COMMIT_REF_NAME"
|
|
||||||
policy: push
|
|
||||||
paths:
|
|
||||||
- build
|
|
||||||
- .gradle
|
|
||||||
|
|
||||||
test:
|
|
||||||
stage: test
|
|
||||||
script: gradle check
|
|
||||||
cache:
|
|
||||||
key: "$CI_COMMIT_REF_NAME"
|
|
||||||
policy: pull
|
|
||||||
paths:
|
|
||||||
- build
|
|
||||||
- .gradle
|
|
||||||
@@ -4,6 +4,7 @@ import ext.*
|
|||||||
import icu.samnyan.aqua.net.db.AquaUserServices
|
import icu.samnyan.aqua.net.db.AquaUserServices
|
||||||
import icu.samnyan.aqua.net.utils.SUCCESS
|
import icu.samnyan.aqua.net.utils.SUCCESS
|
||||||
import icu.samnyan.aqua.sega.chusan.model.Chu3Repos
|
import icu.samnyan.aqua.sega.chusan.model.Chu3Repos
|
||||||
|
import icu.samnyan.aqua.sega.general.model.Card
|
||||||
import icu.samnyan.aqua.sega.general.model.CardStatus
|
import icu.samnyan.aqua.sega.general.model.CardStatus
|
||||||
import icu.samnyan.aqua.sega.general.model.sensitiveInfo
|
import icu.samnyan.aqua.sega.general.model.sensitiveInfo
|
||||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2Repos
|
import icu.samnyan.aqua.sega.maimai2.model.Mai2Repos
|
||||||
@@ -52,7 +53,7 @@ class BotController(
|
|||||||
secret.checkSecret()
|
secret.checkSecret()
|
||||||
|
|
||||||
// 1. Find user card
|
// 1. Find user card
|
||||||
val oc = (us.cardRepo.findByLuid(card)() ?: (404 - "Card not found")).maybeGhost()
|
val oc = (us.cardRepo.findByLuid(card) ?: (404 - "Card not found")).maybeGhost()
|
||||||
|
|
||||||
// 2. Change the status to migrated
|
// 2. Change the status to migrated
|
||||||
us.cardRepo.save(oc.apply {
|
us.cardRepo.save(oc.apply {
|
||||||
@@ -66,7 +67,7 @@ class BotController(
|
|||||||
fun clearMigrateFlag(@RP secret: Str, @RP card: Str): Any {
|
fun clearMigrateFlag(@RP secret: Str, @RP card: Str): Any {
|
||||||
secret.checkSecret()
|
secret.checkSecret()
|
||||||
|
|
||||||
val oc = (us.cardRepo.findByLuid(card)() ?: (404 - "Card not found")).maybeGhost()
|
val oc = (us.cardRepo.findByLuid(card) ?: (404 - "Card not found")).maybeGhost()
|
||||||
|
|
||||||
us.cardRepo.save(oc.apply {
|
us.cardRepo.save(oc.apply {
|
||||||
status = CardStatus.NORMAL
|
status = CardStatus.NORMAL
|
||||||
@@ -82,14 +83,14 @@ class BotController(
|
|||||||
secret.checkSecret()
|
secret.checkSecret()
|
||||||
|
|
||||||
// 1. Check if the card exist
|
// 1. Check if the card exist
|
||||||
var cards = listOfNotNull(
|
var cards: MutableList<Card> = listOfNotNull(
|
||||||
us.cardRepo.findByLuid(cardId)(),
|
us.cardRepo.findByLuid(cardId),
|
||||||
).mut
|
).mut
|
||||||
|
|
||||||
cardId.toLongOrNull()?.let {
|
cardId.toLongOrNull()?.let {
|
||||||
cards += listOfNotNull(
|
cards += listOfNotNull(
|
||||||
us.cardRepo.findById(it)(),
|
us.cardRepo.findById(it)(),
|
||||||
us.cardRepo.findByExtId(it)(),
|
us.cardRepo.findByExtId(it),
|
||||||
)
|
)
|
||||||
|
|
||||||
cards += listOfNotNull(
|
cards += listOfNotNull(
|
||||||
@@ -110,8 +111,8 @@ class BotController(
|
|||||||
|
|
||||||
return cards.map { card ->
|
return cards.map { card ->
|
||||||
// Find all games played by this card
|
// Find all games played by this card
|
||||||
val chu3 = chu3Db.userData.findByCard_ExtId(card.extId)()
|
val chu3 = chu3Db.userData.findByCard_ExtId(card.extId)
|
||||||
val mai2 = mai2Db.userData.findByCard_ExtId(card.extId)()
|
val mai2 = mai2Db.userData.findByCard_ExtId(card.extId)
|
||||||
val gamesDict = listOfNotNull(chu3, mai2).map {
|
val gamesDict = listOfNotNull(chu3, mai2).map {
|
||||||
// Find the keychip owner
|
// Find the keychip owner
|
||||||
val keychip = it.lastClientId
|
val keychip = it.lastClientId
|
||||||
|
|||||||
@@ -238,7 +238,7 @@ class CardGameService(
|
|||||||
"chu3" to getSummaryFor(chusan, card),
|
"chu3" to getSummaryFor(chusan, card),
|
||||||
"ongeki" to getSummaryFor(ongeki, card),
|
"ongeki" to getSummaryFor(ongeki, card),
|
||||||
"wacca" to getSummaryFor(wacca, card),
|
"wacca" to getSummaryFor(wacca, card),
|
||||||
"diva" to diva.findByPdId(card.extId).getOrNull()?.let {
|
"diva" to diva.findByPdId(card.extId)()?.let {
|
||||||
mapOf(
|
mapOf(
|
||||||
"name" to it.playerName,
|
"name" to it.playerName,
|
||||||
"rating" to it.level,
|
"rating" to it.level,
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ class Fedy(
|
|||||||
data class DataPullRes(val error: FedyErr? = null, val result: Any? = null)
|
data class DataPullRes(val error: FedyErr? = null, val result: Any? = null)
|
||||||
@API("/data/pull")
|
@API("/data/pull")
|
||||||
fun handleDataPull(@RH(KEY_HEADER) key: Str, @RT(REQ_PART) req: DataPullReq): DataPullRes = handleFedy(key) {
|
fun handleDataPull(@RH(KEY_HEADER) key: Str, @RT(REQ_PART) req: DataPullReq): DataPullRes = handleFedy(key) {
|
||||||
val card = cardRepo.findByExtId(req.extId).orElse(null)
|
val card = cardRepo.findByExtId(req.extId)
|
||||||
?: (404 - "Card with extId ${req.extId} not found")
|
?: (404 - "Card with extId ${req.extId} not found")
|
||||||
{
|
{
|
||||||
DataPullRes(result = when (req.game) {
|
DataPullRes(result = when (req.game) {
|
||||||
@@ -181,10 +181,9 @@ class Fedy(
|
|||||||
fun handleDataPush(@RH(KEY_HEADER) key: Str, @RT(REQ_PART) req: DataPushReq): Any = handleFedy(key) {
|
fun handleDataPush(@RH(KEY_HEADER) key: Str, @RT(REQ_PART) req: DataPushReq): Any = handleFedy(key) {
|
||||||
val extId = req.extId
|
val extId = req.extId
|
||||||
fun<UserData : IUserData, UserRepo : GenericUserDataRepo<UserData>> removeOldData(repo: UserRepo) {
|
fun<UserData : IUserData, UserRepo : GenericUserDataRepo<UserData>> removeOldData(repo: UserRepo) {
|
||||||
val oldData = repo.findByCard_ExtId(extId)
|
repo.findByCard_ExtId(extId)?.let { oldData ->
|
||||||
if (oldData.isPresent) {
|
|
||||||
log.info("Fedy: Deleting old data for $extId (${req.game})")
|
log.info("Fedy: Deleting old data for $extId (${req.game})")
|
||||||
repo.delete(oldData.get());
|
repo.delete(oldData);
|
||||||
repo.flush()
|
repo.flush()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -281,7 +280,7 @@ class Fedy(
|
|||||||
fun onCardLinked(luid: Str, oldExtId: Long?, ghostExtId: Long, migratedGames: List<Str>) = maybeNotifyAsync(FedyEvent(cardLinked = CardLinkedEvent(luid, oldExtId, ghostExtId, migratedGames)))
|
fun onCardLinked(luid: Str, oldExtId: Long?, ghostExtId: Long, migratedGames: List<Str>) = maybeNotifyAsync(FedyEvent(cardLinked = CardLinkedEvent(luid, oldExtId, ghostExtId, migratedGames)))
|
||||||
fun onCardUnlinked(luid: Str) = maybeNotifyAsync(FedyEvent(cardUnlinked = CardUnlinkedEvent(luid)))
|
fun onCardUnlinked(luid: Str) = maybeNotifyAsync(FedyEvent(cardUnlinked = CardUnlinkedEvent(luid)))
|
||||||
fun onDataUpdated(extId: Long, game: Str, removeOldData: Bool) = maybeNotifyAsync({
|
fun onDataUpdated(extId: Long, game: Str, removeOldData: Bool) = maybeNotifyAsync({
|
||||||
val card = cardRepo.findByExtId(extId).orElse(null) ?: return@maybeNotifyAsync null // Card not found, nothing to do
|
val card = cardRepo.findByExtId(extId) ?: return@maybeNotifyAsync null // Card not found, nothing to do
|
||||||
FedyEvent(dataUpdated = DataUpdatedEvent(extId, card.isGhost, game, removeOldData))
|
FedyEvent(dataUpdated = DataUpdatedEvent(extId, card.isGhost, game, removeOldData))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class Frontier(
|
|||||||
|
|
||||||
if (accessCode.length != 20) 400 - "Invalid access code"
|
if (accessCode.length != 20) 400 - "Invalid access code"
|
||||||
// if (!accessCode.startsWith("9900")) 400 - "Frontier access code must start with 9900"
|
// if (!accessCode.startsWith("9900")) 400 - "Frontier access code must start with 9900"
|
||||||
if (async { cardService.cardRepo.findByLuid(accessCode) }.isPresent) 400 - "Card already registered"
|
if (async { cardService.cardRepo.findByLuid(accessCode) } != null) 400 - "Card already registered"
|
||||||
|
|
||||||
val card = async { cardService.registerByAccessCode(accessCode) }
|
val card = async { cardService.registerByAccessCode(accessCode) }
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package icu.samnyan.aqua.net
|
package icu.samnyan.aqua.net
|
||||||
|
|
||||||
import ext.JACKSON
|
import ext.JACKSON
|
||||||
import ext.invoke
|
|
||||||
import ext.logger
|
import ext.logger
|
||||||
import ext.parse
|
import ext.parse
|
||||||
import icu.samnyan.aqua.net.db.AquaNetUserRepo
|
import icu.samnyan.aqua.net.db.AquaNetUserRepo
|
||||||
@@ -24,7 +23,7 @@ class Migrations(
|
|||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
fun migrate() {
|
fun migrate() {
|
||||||
val db = props.findByPropertyKey("migrations")() ?: PropertyEntry("migrations", "[]")
|
val db = props.findByPropertyKey("migrations") ?: PropertyEntry("migrations", "[]")
|
||||||
val p = JACKSON.parse<ArrayList<String>>(db.propertyValue)
|
val p = JACKSON.parse<ArrayList<String>>(db.propertyValue)
|
||||||
val old = p.size
|
val old = p.size
|
||||||
|
|
||||||
@@ -47,7 +46,7 @@ class Migrations(
|
|||||||
if (c.extId > max) {
|
if (c.extId > max) {
|
||||||
var new = c.extId and max
|
var new = c.extId and max
|
||||||
log.info("Removing signed bit: {${c.extId} -> $new} for ${c.luid}")
|
log.info("Removing signed bit: {${c.extId} -> $new} for ${c.luid}")
|
||||||
while (cardRepo.findByExtId(new).isPresent) {
|
while (cardRepo.findByExtId(new) != null) {
|
||||||
log.error("> Conflicting card found for ${c.luid}: $new")
|
log.error("> Conflicting card found for ${c.luid}: $new")
|
||||||
new++
|
new++
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ class AquaUserServices(
|
|||||||
|
|
||||||
suspend fun cardByName(username: Str) =
|
suspend fun cardByName(username: Str) =
|
||||||
if (username.startsWith("user")) username.substring(4).toLongOrNull()
|
if (username.startsWith("user")) username.substring(4).toLongOrNull()
|
||||||
?.let { cardRepo.findById(it).getOrNull() } ?: (404 - "Card not found")
|
?.let { cardRepo.findById(it)() } ?: (404 - "Card not found")
|
||||||
else byName(username) { it.ghostCard }
|
else byName(username) { it.ghostCard }
|
||||||
|
|
||||||
suspend fun <T> cardByName(username: Str, callback: suspend (Card) -> T) = callback(cardByName(username))
|
suspend fun <T> cardByName(username: Str, callback: suspend (Card) -> T) = callback(cardByName(username))
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ abstract class GameApiController<T : IUserData>(val name: String, userDataClass:
|
|||||||
}
|
}
|
||||||
|
|
||||||
@API("playlog")
|
@API("playlog")
|
||||||
fun playlog(@RP id: Long): IGenericGamePlaylog = playlogRepo.findById(id).getOrNull() ?: (404 - "Playlog not found")
|
fun playlog(@RP id: Long): IGenericGamePlaylog = playlogRepo.findById(id)() ?: (404 - "Playlog not found")
|
||||||
|
|
||||||
val userDetailFields by lazy { userDataClass.gettersMap().let { vm ->
|
val userDetailFields by lazy { userDataClass.gettersMap().let { vm ->
|
||||||
(settableFields.keys.toSet() + gettableFields)
|
(settableFields.keys.toSet() + gettableFields)
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import org.springframework.data.repository.NoRepositoryBean
|
|||||||
import org.springframework.transaction.PlatformTransactionManager
|
import org.springframework.transaction.PlatformTransactionManager
|
||||||
import org.springframework.transaction.support.TransactionTemplate
|
import org.springframework.transaction.support.TransactionTemplate
|
||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
import java.util.*
|
|
||||||
import kotlin.io.path.Path
|
import kotlin.io.path.Path
|
||||||
import kotlin.io.path.writeText
|
import kotlin.io.path.writeText
|
||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
@@ -43,7 +42,7 @@ interface IExportClass<UserModel: IUserData> {
|
|||||||
@NoRepositoryBean
|
@NoRepositoryBean
|
||||||
interface IUserRepo<UserModel, ThisModel>: JpaRepository<ThisModel, Long> {
|
interface IUserRepo<UserModel, ThisModel>: JpaRepository<ThisModel, Long> {
|
||||||
fun findByUser(user: UserModel): List<ThisModel>
|
fun findByUser(user: UserModel): List<ThisModel>
|
||||||
fun findSingleByUser(user: UserModel): Optional<ThisModel>
|
fun findSingleByUser(user: UserModel): ThisModel?
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -89,7 +88,7 @@ abstract class ImportController<ExportModel: IExportClass<UserModel>, UserModel:
|
|||||||
userData = userDataRepo.findByCard(c) ?: (404 - "User not found")
|
userData = userDataRepo.findByCard(c) ?: (404 - "User not found")
|
||||||
exportRepos.forEach { (f, u) ->
|
exportRepos.forEach { (f, u) ->
|
||||||
if (f returns List::class) f.set(this, u.findByUser(userData))
|
if (f returns List::class) f.set(this, u.findByUser(userData))
|
||||||
else u.findSingleByUser(userData)()?.let { f.set(this, it) }
|
else u.findSingleByUser(userData)?.let { f.set(this, it) }
|
||||||
}
|
}
|
||||||
customExporters.forEach { (f, exporter) ->
|
customExporters.forEach { (f, exporter) ->
|
||||||
exporter(userData, options)?.let { f.set(this, it) }
|
exporter(userData, options)?.let { f.set(this, it) }
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ open class BaseEntity(
|
|||||||
@NoRepositoryBean
|
@NoRepositoryBean
|
||||||
interface GenericUserDataRepo<T : IUserData> : JpaRepository<T, Long> {
|
interface GenericUserDataRepo<T : IUserData> : JpaRepository<T, Long> {
|
||||||
fun findByCard(card: Card): T?
|
fun findByCard(card: Card): T?
|
||||||
fun findByCard_ExtId(extId: Long): Optional<T>
|
fun findByCard_ExtId(extId: Long): T?
|
||||||
|
|
||||||
@Query("select e from #{#entityName} e where e.card.rankingBanned = false")
|
@Query("select e from #{#entityName} e where e.card.rankingBanned = false")
|
||||||
fun findAllNonBanned(): List<T>
|
fun findAllNonBanned(): List<T>
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import icu.samnyan.aqua.sega.maimai2.model.userdata.*
|
|||||||
import org.springframework.web.bind.annotation.RestController
|
import org.springframework.web.bind.annotation.RestController
|
||||||
import kotlin.reflect.full.declaredMembers
|
import kotlin.reflect.full.declaredMembers
|
||||||
|
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
@RestController
|
@RestController
|
||||||
@API("api/v2/game/mai2")
|
@API("api/v2/game/mai2")
|
||||||
class Mai2Import(
|
class Mai2Import(
|
||||||
@@ -61,7 +62,7 @@ class Mai2Import(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
Maimai2DataExport::userFavoriteMusicList to { user: Mai2UserDetail, _: ExportOptions ->
|
Maimai2DataExport::userFavoriteMusicList to { user: Mai2UserDetail, _: ExportOptions ->
|
||||||
repos.userGeneralData.findByUserAndPropertyKey(user, "favorite_music").orElse(null)
|
repos.userGeneralData.findByUserAndPropertyKey(user, "favorite_music")
|
||||||
?.propertyValue
|
?.propertyValue
|
||||||
?.takeIf { it.isNotEmpty() }
|
?.takeIf { it.isNotEmpty() }
|
||||||
?.split(",")
|
?.split(",")
|
||||||
@@ -78,7 +79,7 @@ class Mai2Import(
|
|||||||
if (favoriteMusicList.isNotEmpty()) {
|
if (favoriteMusicList.isNotEmpty()) {
|
||||||
val key = "favorite_music"
|
val key = "favorite_music"
|
||||||
// This field always imports as incremental, since the userGeneralData field (for backwards compatibility) is processed before this
|
// This field always imports as incremental, since the userGeneralData field (for backwards compatibility) is processed before this
|
||||||
val data = repos.userGeneralData.findByUserAndPropertyKey(user, key).orElse(null)
|
val data = repos.userGeneralData.findByUserAndPropertyKey(user, key)
|
||||||
?: Mai2UserGeneralData().apply { this.user = user; propertyKey = key }
|
?: Mai2UserGeneralData().apply { this.user = user; propertyKey = key }
|
||||||
repos.userGeneralData.save(data.apply {
|
repos.userGeneralData.save(data.apply {
|
||||||
propertyValue = favoriteMusicList.sortedBy { it.orderId }.map { it.id }.joinToString(",")
|
propertyValue = favoriteMusicList.sortedBy { it.orderId }.map { it.id }.joinToString(",")
|
||||||
|
|||||||
@@ -20,24 +20,18 @@ class Mai2MusicDetailImport(
|
|||||||
@PostMapping("import-music-detail")
|
@PostMapping("import-music-detail")
|
||||||
suspend fun importMusicDetail(@RP token: String, @RB data: List<Mai2UserMusicDetail>) = us.jwt.auth(token) { u ->
|
suspend fun importMusicDetail(@RP token: String, @RB data: List<Mai2UserMusicDetail>) = us.jwt.auth(token) { u ->
|
||||||
us.cardByName(u.username) { card ->
|
us.cardByName(u.username) { card ->
|
||||||
val user = repos.userData.findByCardExtId(card.extId).orElse(null) ?: (404 - "User not found")
|
val user = repos.userData.findByCardExtId(card.extId) ?: (404 - "User not found")
|
||||||
data.forEach { newMusic ->
|
data.forEach { newMusic ->
|
||||||
val musicRec = repos.userMusicDetail.findByUserAndMusicIdAndLevel(user, newMusic.musicId, newMusic.level)
|
newMusic.user = user
|
||||||
if (musicRec.isPresent) {
|
repos.userMusicDetail.findByUserAndMusicIdAndLevel(user, newMusic.musicId, newMusic.level)?.let { m ->
|
||||||
val music = musicRec.get()
|
|
||||||
newMusic.apply {
|
newMusic.apply {
|
||||||
id = music.id
|
id = m.id
|
||||||
this.user = user
|
achievement = achievement.coerceAtLeast(m.achievement)
|
||||||
achievement = achievement.coerceAtLeast(music.achievement)
|
scoreRank = scoreRank.coerceAtLeast(m.scoreRank)
|
||||||
scoreRank = scoreRank.coerceAtLeast(music.scoreRank)
|
comboStatus = comboStatus.coerceAtLeast(m.comboStatus)
|
||||||
comboStatus = comboStatus.coerceAtLeast(music.comboStatus)
|
syncStatus = syncStatus.coerceAtLeast(m.syncStatus)
|
||||||
syncStatus = syncStatus.coerceAtLeast(music.syncStatus)
|
deluxscoreMax = deluxscoreMax.coerceAtLeast(m.deluxscoreMax)
|
||||||
deluxscoreMax = deluxscoreMax.coerceAtLeast(music.deluxscoreMax)
|
playCount = playCount.coerceAtLeast(m.playCount)
|
||||||
playCount = playCount.coerceAtLeast(music.playCount)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
newMusic.apply {
|
|
||||||
this.user = user
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,9 +63,9 @@ class Maimai2(
|
|||||||
us.jwt.auth(t) { u ->
|
us.jwt.auth(t) { u ->
|
||||||
if (u.username == username) return@auth null
|
if (u.username == username) return@auth null
|
||||||
us.cardByName(u.username) { myCard ->
|
us.cardByName(u.username) { myCard ->
|
||||||
val user = repos.userData.findByCardExtId(card.extId).orElse(null) ?: (404 - "User not found")
|
val user = repos.userData.findByCardExtId(card.extId) ?: (404 - "User not found")
|
||||||
val myRival = repos.userGeneralData.findByUser_Card_ExtIdAndPropertyKey(myCard.extId, "favorite_rival")
|
val myRival = (repos.userGeneralData.findByUser_Card_ExtIdAndPropertyKey(myCard.extId, "favorite_rival")?.propertyValue?.split(',') ?: emptyList())
|
||||||
.map { it.propertyValue.split(',') }.orElse(emptyList()).filter { it.isNotEmpty() }.map { it.long() }
|
.filter { it.isNotEmpty() }.map { it.long() }
|
||||||
myRival.contains(user.id)
|
myRival.contains(user.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -137,7 +137,7 @@ class Maimai2(
|
|||||||
if (loginBonus.none { it.bonusId == bonusId }) {
|
if (loginBonus.none { it.bonusId == bonusId }) {
|
||||||
// create one
|
// create one
|
||||||
val newBonus = Mai2UserLoginBonus().apply {
|
val newBonus = Mai2UserLoginBonus().apply {
|
||||||
user = repos.userData.findByCardExtId(card.extId).orElse(null) ?: (404 - "User not found")
|
user = repos.userData.findByCardExtId(card.extId) ?: (404 - "User not found")
|
||||||
this.bonusId = bonusId
|
this.bonusId = bonusId
|
||||||
isCurrent = true
|
isCurrent = true
|
||||||
}
|
}
|
||||||
@@ -159,10 +159,10 @@ class Maimai2(
|
|||||||
suspend fun setRival(@RP token: String, @RP rivalUserName: String, @RP isAdd: Boolean) = us.jwt.auth(token) { u ->
|
suspend fun setRival(@RP token: String, @RP rivalUserName: String, @RP isAdd: Boolean) = us.jwt.auth(token) { u ->
|
||||||
us.cardByName(u.username) { myCard ->
|
us.cardByName(u.username) { myCard ->
|
||||||
val rivalCard = us.cardByName(rivalUserName) { it }
|
val rivalCard = us.cardByName(rivalUserName) { it }
|
||||||
val rivalUser = repos.userData.findByCardExtId(rivalCard.extId).orElse(null) ?: (404 - "User not found")
|
val rivalUser = repos.userData.findByCardExtId(rivalCard.extId) ?: (404 - "User not found")
|
||||||
val myRival = repos.userGeneralData.findByUser_Card_ExtIdAndPropertyKey(myCard.extId, "favorite_rival").orElse(null)
|
val myRival = repos.userGeneralData.findByUser_Card_ExtIdAndPropertyKey(myCard.extId, "favorite_rival")
|
||||||
?: Mai2UserGeneralData().apply {
|
?: Mai2UserGeneralData().apply {
|
||||||
user = repos.userData.findByCardExtId(myCard.extId).orElse(null) ?: (404 - "User not found")
|
user = repos.userData.findByCardExtId(myCard.extId) ?: (404 - "User not found")
|
||||||
propertyKey = "favorite_rival"
|
propertyKey = "favorite_rival"
|
||||||
}
|
}
|
||||||
val myRivalList = myRival.propertyValue.split(',').filter { it.isNotEmpty() }.mut
|
val myRivalList = myRival.propertyValue.split(',').filter { it.isNotEmpty() }.mut
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class Wacca(
|
|||||||
|
|
||||||
val data = userDataRepo.findByCard_ExtId(card.extId)
|
val data = userDataRepo.findByCard_ExtId(card.extId)
|
||||||
|
|
||||||
genericUserSummary(card, mapOf(), null, if (data.isPresent) data.get().favoriteSongs else null)
|
genericUserSummary(card, mapOf(), null, data?.favoriteSongs)
|
||||||
}
|
}
|
||||||
|
|
||||||
override val shownRanks: List<Pair<Int, String>> = waccaScores.filter { it.first > 85 * 10000 }
|
override val shownRanks: List<Pair<Int, String>> = waccaScores.filter { it.first > 85 * 10000 }
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package icu.samnyan.aqua.sega.aimedb
|
package icu.samnyan.aqua.sega.aimedb
|
||||||
|
|
||||||
import ext.invoke
|
|
||||||
import ext.logger
|
import ext.logger
|
||||||
import ext.toHex
|
import ext.toHex
|
||||||
import icu.samnyan.aqua.net.Fedy
|
import icu.samnyan.aqua.net.Fedy
|
||||||
@@ -127,7 +126,7 @@ class AimeDB(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getCard(accessCode: String) = us.cardRepo.findByLuid(accessCode)()?.maybeGhost()?.let { card ->
|
fun getCard(accessCode: String) = us.cardRepo.findByLuid(accessCode)?.maybeGhost()?.let { card ->
|
||||||
// Update card access time and return the extId
|
// Update card access time and return the extId
|
||||||
us.cardRepo.save(card.apply { accessTime = LocalDateTime.now() }).extId
|
us.cardRepo.save(card.apply { accessTime = LocalDateTime.now() }).extId
|
||||||
} ?: -1
|
} ?: -1
|
||||||
@@ -198,7 +197,7 @@ class AimeDB(
|
|||||||
var status = 0
|
var status = 0
|
||||||
var aimeId = 0L
|
var aimeId = 0L
|
||||||
|
|
||||||
if (us.cardRepo.findByLuid(luid).isEmpty) {
|
if (us.cardRepo.findByLuid(luid) == null) {
|
||||||
val card: Card = cardService.registerByAccessCode(luid)
|
val card: Card = cardService.registerByAccessCode(luid)
|
||||||
|
|
||||||
status = 1
|
status = 1
|
||||||
|
|||||||
@@ -60,11 +60,8 @@ class CardMakerController(
|
|||||||
return json
|
return json
|
||||||
}
|
}
|
||||||
|
|
||||||
fun gameConnect(modelKind: Int, modelVersion: Int, url: String) = mapOf(
|
fun gameConnect(modelKind: Int, modelVersion: Int, url: String) =
|
||||||
"modelKind" to modelKind,
|
mapOf("modelKind" to modelKind, "modelVersion" to modelVersion, "url" to url)
|
||||||
"modelVersion" to modelVersion,
|
|
||||||
"url" to url
|
|
||||||
)
|
|
||||||
|
|
||||||
@API("GetGameConnectApi")
|
@API("GetGameConnectApi")
|
||||||
fun getGameConnect(@ModelAttribute request: MutableMap<String, Any>): Any? {
|
fun getGameConnect(@ModelAttribute request: MutableMap<String, Any>): Any? {
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import java.nio.charset.StandardCharsets
|
|||||||
@RestControllerAdvice(basePackages = ["icu.samnyan.aqua.sega.cardmaker"])
|
@RestControllerAdvice(basePackages = ["icu.samnyan.aqua.sega.cardmaker"])
|
||||||
class CardMakerControllerAdvice {
|
class CardMakerControllerAdvice {
|
||||||
val logger = logger()
|
val logger = logger()
|
||||||
|
val mapper = ObjectMapper()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the map object from json string
|
* Get the map object from json string
|
||||||
@@ -25,7 +26,6 @@ class CardMakerControllerAdvice {
|
|||||||
val src = request.inputStream.readAllBytes()
|
val src = request.inputStream.readAllBytes()
|
||||||
val outputString = String(src, StandardCharsets.UTF_8).trim { it <= ' ' }
|
val outputString = String(src, StandardCharsets.UTF_8).trim { it <= ' ' }
|
||||||
logger.info("Request ${request.requestURI}: $outputString")
|
logger.info("Request ${request.requestURI}: $outputString")
|
||||||
val mapper = ObjectMapper()
|
|
||||||
return mapper.readValue(outputString, object : TypeReference<MutableMap<String, Any>>() {})
|
return mapper.readValue(outputString, object : TypeReference<MutableMap<String, Any>>() {})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -58,7 +58,7 @@ fun ChusanController.chusanInit() {
|
|||||||
"GetUserRecMusic".paged("userRecMusicList") {
|
"GetUserRecMusic".paged("userRecMusicList") {
|
||||||
// musicId: int, recMusicList: string
|
// musicId: int, recMusicList: string
|
||||||
// musicId cannot be the same with the id in recMusicList
|
// musicId cannot be the same with the id in recMusicList
|
||||||
val u = db.userData.findByCard_ExtId(uid)() ?: return@paged empty
|
val u = db.userData.findByCard_ExtId(uid) ?: return@paged empty
|
||||||
val list = (chusan.recommendedMusic[u.id] ?: ls()).filter { it != 1 }
|
val list = (chusan.recommendedMusic[u.id] ?: ls()).filter { it != 1 }
|
||||||
|
|
||||||
if (list.isEmpty()) empty
|
if (list.isEmpty()) empty
|
||||||
@@ -87,8 +87,8 @@ fun ChusanController.chusanInit() {
|
|||||||
|
|
||||||
// Net battle data
|
// Net battle data
|
||||||
"GetUserNetBattleData" api@ {
|
"GetUserNetBattleData" api@ {
|
||||||
val u = db.userData.findByCard_ExtId(uid)() ?: return@api null
|
val u = db.userData.findByCard_ExtId(uid) ?: return@api null
|
||||||
val misc = db.userMisc.findSingleByUser(u)()
|
val misc = db.userMisc.findSingleByUser(u)
|
||||||
val recent = db.netBattleLog.findTop20ByUserOrderByIdDesc(u)
|
val recent = db.netBattleLog.findTop20ByUserOrderByIdDesc(u)
|
||||||
mapOf("userId" to uid, "userNetBattleData" to mapOf(
|
mapOf("userId" to uid, "userNetBattleData" to mapOf(
|
||||||
"recentNBSelectMusicList" to (misc?.recentNbSelect ?: empty),
|
"recentNBSelectMusicList" to (misc?.recentNbSelect ?: empty),
|
||||||
@@ -106,7 +106,7 @@ fun ChusanController.chusanInit() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
db.userData.findByCard_ExtId(uid)()?.card?.aquaUser?.gameOptions?.run {
|
db.userData.findByCard_ExtId(uid)?.card?.aquaUser?.gameOptions?.run {
|
||||||
listOf(chusanSymbolChat1, chusanSymbolChat2, chusanSymbolChat3, chusanSymbolChat4)
|
listOf(chusanSymbolChat1, chusanSymbolChat2, chusanSymbolChat3, chusanSymbolChat4)
|
||||||
.flatMapIndexed { i, sym -> sym?.makeSymbols(i) ?: empty }
|
.flatMapIndexed { i, sym -> sym?.makeSymbols(i) ?: empty }
|
||||||
} ?: empty
|
} ?: empty
|
||||||
@@ -114,10 +114,10 @@ fun ChusanController.chusanInit() {
|
|||||||
|
|
||||||
// User handlers
|
// User handlers
|
||||||
"GetUserData" {
|
"GetUserData" {
|
||||||
db.userData.findByCard_ExtId(uid)()?.let{ u -> mapOf("userId" to uid, "userData" to u) }
|
db.userData.findByCard_ExtId(uid)?.let{ u -> mapOf("userId" to uid, "userData" to u) }
|
||||||
}
|
}
|
||||||
"GetUserOption" {
|
"GetUserOption" {
|
||||||
val userGameOption = db.userGameOption.findSingleByUser_Card_ExtId(uid)() ?: (400 - "User not found")
|
val userGameOption = db.userGameOption.findSingleByUser_Card_ExtId(uid) ?: (400 - "User not found")
|
||||||
mapOf("userId" to uid, "userGameOption" to userGameOption)
|
mapOf("userId" to uid, "userGameOption" to userGameOption)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,7 +141,7 @@ fun ChusanController.chusanInit() {
|
|||||||
parsing { UserCMissionResp().apply {
|
parsing { UserCMissionResp().apply {
|
||||||
missionId = parsing { data["missionId"]!!.int }
|
missionId = parsing { data["missionId"]!!.int }
|
||||||
} }.apply {
|
} }.apply {
|
||||||
db.userCMission.findByUser_Card_ExtIdAndMissionId(uid, missionId)()?.let {
|
db.userCMission.findByUser_Card_ExtIdAndMissionId(uid, missionId)?.let {
|
||||||
point = it.point
|
point = it.point
|
||||||
userCMissionProgressList = db.userCMissionProgress.findByUser_Card_ExtIdAndMissionId(uid, missionId)
|
userCMissionProgressList = db.userCMissionProgress.findByUser_Card_ExtIdAndMissionId(uid, missionId)
|
||||||
}
|
}
|
||||||
@@ -151,7 +151,7 @@ fun ChusanController.chusanInit() {
|
|||||||
// Introduced in LMN+
|
// Introduced in LMN+
|
||||||
"GetUserCMissionList" api@ {
|
"GetUserCMissionList" api@ {
|
||||||
val missions = parsing { (data["userCMissionList"] as List<JDict>).map { it["missionId"]!!.int } }
|
val missions = parsing { (data["userCMissionList"] as List<JDict>).map { it["missionId"]!!.int } }
|
||||||
val u = db.userData.findByCard_ExtId(uid)() ?: return@api null
|
val u = db.userData.findByCard_ExtId(uid) ?: return@api null
|
||||||
|
|
||||||
db.userCMission.findByUserAndMissionIdIn(u, missions).map {
|
db.userCMission.findByUserAndMissionIdIn(u, missions).map {
|
||||||
UserCMissionResp().apply {
|
UserCMissionResp().apply {
|
||||||
@@ -190,7 +190,7 @@ fun ChusanController.chusanInit() {
|
|||||||
val items = db.userItem.findAllByUser_Card_ExtIdAndItemKind(uid, kind).mut
|
val items = db.userItem.findAllByUser_Card_ExtIdAndItemKind(uid, kind).mut
|
||||||
|
|
||||||
// Check game options
|
// Check game options
|
||||||
db.userData.findByCard_ExtId(uid)()?.card?.aquaUser?.gameOptions?.let {
|
db.userData.findByCard_ExtId(uid)?.card?.aquaUser?.gameOptions?.let {
|
||||||
if (it.chusanInfinitePenguins && kind == 5) {
|
if (it.chusanInfinitePenguins && kind == 5) {
|
||||||
items.removeAll { it.itemId in penguins }
|
items.removeAll { it.itemId in penguins }
|
||||||
items.addAll(penguins.map { Chu3UserItem(kind, it, 999, true) })
|
items.addAll(penguins.map { Chu3UserItem(kind, it, 999, true) })
|
||||||
@@ -207,7 +207,7 @@ 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 {
|
||||||
val misc = db.userMisc.findSingleByUser_Card_ExtId(uid)()
|
val misc = db.userMisc.findSingleByUser_Card_ExtId(uid)
|
||||||
when (kind) {
|
when (kind) {
|
||||||
1 -> misc?.favMusic ?: empty
|
1 -> misc?.favMusic ?: empty
|
||||||
3 -> empty // TODO: Favorite character
|
3 -> empty // TODO: Favorite character
|
||||||
@@ -220,9 +220,9 @@ fun ChusanController.chusanInit() {
|
|||||||
"lastDataVersion,trophyId,classEmblemMedal,classEmblemBase,battleRankId").split(',').toSet()
|
"lastDataVersion,trophyId,classEmblemMedal,classEmblemBase,battleRankId").split(',').toSet()
|
||||||
|
|
||||||
"GetUserPreview" api@ {
|
"GetUserPreview" api@ {
|
||||||
val user = db.userData.findByCard_ExtId(uid)() ?: return@api null
|
val user = db.userData.findByCard_ExtId(uid) ?: return@api null
|
||||||
val chara = db.userCharacter.findByUserAndCharacterId(user, user.characterId)
|
val chara = db.userCharacter.findByUserAndCharacterId(user, user.characterId)
|
||||||
val option = db.userGameOption.findSingleByUser(user)()
|
val option = db.userGameOption.findSingleByUser(user)
|
||||||
val userDict = user.toJson().jsonMap().filterKeys { it in userPreviewKeys }
|
val userDict = user.toJson().jsonMap().filterKeys { it in userPreviewKeys }
|
||||||
|
|
||||||
val res = mutableMapOf(
|
val res = mutableMapOf(
|
||||||
@@ -262,7 +262,7 @@ fun ChusanController.chusanInit() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
"GetUserRecentRating".paged("userRecentRatingList") {
|
"GetUserRecentRating".paged("userRecentRatingList") {
|
||||||
db.userGeneralData.findByUser_Card_ExtIdAndPropertyKey(uid, "recent_rating_list")()
|
db.userGeneralData.findByUser_Card_ExtIdAndPropertyKey(uid, "recent_rating_list")
|
||||||
?.propertyValue?.some
|
?.propertyValue?.some
|
||||||
?.split(',')?.dropLastWhile { it.isEmpty() }?.map { it.split(':') }
|
?.split(',')?.dropLastWhile { it.isEmpty() }?.map { it.split(':') }
|
||||||
?.map { (musicId, level, score) -> UserRecentRating(musicId.int, level.int, "2000001", score.int) }
|
?.map { (musicId, level, score) -> UserRecentRating(musicId.int, level.int, "2000001", score.int) }
|
||||||
@@ -278,7 +278,7 @@ fun ChusanController.chusanInit() {
|
|||||||
|
|
||||||
"GetUserTeam" {
|
"GetUserTeam" {
|
||||||
val playDate = parsing { data["playDate"] as String }
|
val playDate = parsing { data["playDate"] as String }
|
||||||
val team = db.userData.findByCard_ExtId(uid)()?.card?.aquaUser?.gameOptions?.chusanTeamName?.some
|
val team = db.userData.findByCard_ExtId(uid)?.card?.aquaUser?.gameOptions?.chusanTeamName?.some
|
||||||
?: props.teamName?.some ?: "一緒に歌おう!"
|
?: props.teamName?.some ?: "一緒に歌おう!"
|
||||||
|
|
||||||
mapOf(
|
mapOf(
|
||||||
@@ -349,7 +349,7 @@ fun ChusanController.chusanInit() {
|
|||||||
// TODO: Test login bonus
|
// TODO: Test login bonus
|
||||||
"GameLogin" {
|
"GameLogin" {
|
||||||
// fun process() {
|
// fun process() {
|
||||||
// val u = db.userData.findByCard_ExtId(uid)() ?: return
|
// val u = db.userData.findByCard_ExtId(uid) ?: return
|
||||||
// db.userData.save(u.apply { lastLoginDate = LocalDateTime.now() })
|
// db.userData.save(u.apply { lastLoginDate = LocalDateTime.now() })
|
||||||
//
|
//
|
||||||
// if (!props.loginBonusEnable) return
|
// if (!props.loginBonusEnable) return
|
||||||
@@ -357,7 +357,7 @@ fun ChusanController.chusanInit() {
|
|||||||
//
|
//
|
||||||
// bonusList.forEach { preset ->
|
// bonusList.forEach { preset ->
|
||||||
// // Check if a user already has some progress and if not, add the login bonus entry
|
// // Check if a user already has some progress and if not, add the login bonus entry
|
||||||
// val bonus = db.userLoginBonus.findLoginBonus(uid.int, 1, preset.id)()
|
// val bonus = db.userLoginBonus.findLoginBonus(uid.int, 1, preset.id)
|
||||||
// ?: UserLoginBonus(1, uid.int, preset.id).let { db.userLoginBonus.save(it) }
|
// ?: UserLoginBonus(1, uid.int, preset.id).let { db.userLoginBonus.save(it) }
|
||||||
// if (bonus.isFinished) return@forEach
|
// if (bonus.isFinished) return@forEach
|
||||||
//
|
//
|
||||||
@@ -377,10 +377,10 @@ fun ChusanController.chusanInit() {
|
|||||||
// if (preset.id < 3000) bCount = 1
|
// if (preset.id < 3000) bCount = 1
|
||||||
// else finished = true
|
// else finished = true
|
||||||
// }
|
// }
|
||||||
// db.gameLoginBonus.findByRequiredDays(1, preset.id, bCount)()?.let {
|
// db.gameLoginBonus.findByRequiredDays(1, preset.id, bCount)?.let {
|
||||||
// db.userItem.save(UserItem(6, it.presentId, it.itemNum).apply { user = u })
|
// db.userItem.save(UserItem(6, it.presentId, it.itemNum).apply { user = u })
|
||||||
// }
|
// }
|
||||||
// val toSave = db.userLoginBonus.findLoginBonus(uid.int, 1, preset.id)()
|
// val toSave = db.userLoginBonus.findLoginBonus(uid.int, 1, preset.id)
|
||||||
// ?: UserLoginBonus().apply { user = uid.int; presetId = preset.id; version = 1 }
|
// ?: UserLoginBonus().apply { user = uid.int; presetId = preset.id; version = 1 }
|
||||||
//
|
//
|
||||||
// db.userLoginBonus.save(toSave.apply {
|
// db.userLoginBonus.save(toSave.apply {
|
||||||
@@ -394,7 +394,7 @@ fun ChusanController.chusanInit() {
|
|||||||
// }
|
// }
|
||||||
// process()
|
// process()
|
||||||
|
|
||||||
val user = db.userData.findByCard_ExtId(uid)()
|
val user = db.userData.findByCard_ExtId(uid)
|
||||||
|
|
||||||
if (user?.card?.status == CardStatus.MIGRATED_TO_MINATO) {
|
if (user?.card?.status == CardStatus.MIGRATED_TO_MINATO) {
|
||||||
"""{"returnCode":"0"}"""
|
"""{"returnCode":"0"}"""
|
||||||
|
|||||||
@@ -14,20 +14,20 @@ fun ChusanController.cmApiInit() {
|
|||||||
|
|
||||||
// CardMaker (TODO: Somebody test this, I don't have a card maker)
|
// CardMaker (TODO: Somebody test this, I don't have a card maker)
|
||||||
"CMGetUserData" {
|
"CMGetUserData" {
|
||||||
val user = db.userData.findByCard_ExtId(uid)() ?: (400 - "User not found")
|
val user = db.userData.findByCard_ExtId(uid) ?: (400 - "User not found")
|
||||||
user.userEmoney = UserEmoney()
|
user.userEmoney = UserEmoney()
|
||||||
mapOf("userId" to uid, "userData" to user, "userEmoney" to user.userEmoney)
|
mapOf("userId" to uid, "userData" to user, "userEmoney" to user.userEmoney)
|
||||||
}
|
}
|
||||||
|
|
||||||
"CMGetUserPreview" {
|
"CMGetUserPreview" {
|
||||||
val user = db.userData.findByCard_ExtId(uid)() ?: (400 - "User not found")
|
val user = db.userData.findByCard_ExtId(uid) ?: (400 - "User not found")
|
||||||
mapOf("userName" to user.userName, "level" to user.level, "medal" to user.medal, "lastDataVersion" to user.lastDataVersion, "isLogin" to false)
|
mapOf("userName" to user.userName, "level" to user.level, "medal" to user.medal, "lastDataVersion" to user.lastDataVersion, "isLogin" to false)
|
||||||
}
|
}
|
||||||
|
|
||||||
"CMUpsertUserGacha" api@ {
|
"CMUpsertUserGacha" api@ {
|
||||||
val (gachaId, placeId) = parsing { data["gachaId"]!!.int to data["placeId"]!!.int }
|
val (gachaId, placeId) = parsing { data["gachaId"]!!.int to data["placeId"]!!.int }
|
||||||
|
|
||||||
val u = db.userData.findByCard_ExtId(uid)() ?: return@api null
|
val u = db.userData.findByCard_ExtId(uid) ?: return@api null
|
||||||
val upsertUserGacha = parsing { mapper.convert<UpsertUserGacha>(data["cmUpsertUserGacha"]!!) }
|
val upsertUserGacha = parsing { mapper.convert<UpsertUserGacha>(data["cmUpsertUserGacha"]!!) }
|
||||||
|
|
||||||
upsertUserGacha.gameGachaCardList?.let { lst ->
|
upsertUserGacha.gameGachaCardList?.let { lst ->
|
||||||
@@ -99,7 +99,7 @@ fun ChusanController.cmApiInit() {
|
|||||||
val userCardPrintState = cmMapper.convert<UserCardPrintState>(parsing { data["userCardPrintState"]!! })
|
val userCardPrintState = cmMapper.convert<UserCardPrintState>(parsing { data["userCardPrintState"]!! })
|
||||||
val userItemList = cmMapper.convert<List<Chu3UserItem>>(parsing { data["userItemList"]!! })
|
val userItemList = cmMapper.convert<List<Chu3UserItem>>(parsing { data["userItemList"]!! })
|
||||||
|
|
||||||
val u = db.userData.findByCard_ExtId(uid)() ?: return@api null
|
val u = db.userData.findByCard_ExtId(uid) ?: return@api null
|
||||||
|
|
||||||
db.userItem.saveAll(
|
db.userItem.saveAll(
|
||||||
userItemList.mapApply {
|
userItemList.mapApply {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import icu.samnyan.aqua.sega.general.model.UserRecentRating
|
|||||||
fun ChusanController.upsertApiInit() {
|
fun ChusanController.upsertApiInit() {
|
||||||
"UpsertUserChargelog" {
|
"UpsertUserChargelog" {
|
||||||
val charge = parsing { mapper.convert<UserCharge>(data["userCharge"] as JDict) }
|
val charge = parsing { mapper.convert<UserCharge>(data["userCharge"] as JDict) }
|
||||||
charge.user = db.userData.findByCard_ExtId(uid)() ?: (400 - "User not found")
|
charge.user = db.userData.findByCard_ExtId(uid) ?: (400 - "User not found")
|
||||||
charge.id = db.userCharge.findByUser_Card_ExtIdAndChargeId(uid, charge.chargeId)?.id ?: 0
|
charge.id = db.userCharge.findByUser_Card_ExtIdAndChargeId(uid, charge.chargeId)?.id ?: 0
|
||||||
db.userCharge.save(charge)
|
db.userCharge.save(charge)
|
||||||
"""{"returnCode":"1"}"""
|
"""{"returnCode":"1"}"""
|
||||||
@@ -21,10 +21,10 @@ fun ChusanController.upsertApiInit() {
|
|||||||
|
|
||||||
req.run {
|
req.run {
|
||||||
// UserData
|
// UserData
|
||||||
val oldUser = db.userData.findByCard_ExtId(uid)()
|
val oldUser = db.userData.findByCard_ExtId(uid)
|
||||||
val u = (userData?.get(0) ?: return@api null).apply {
|
val u = (userData?.get(0) ?: return@api null).apply {
|
||||||
id = oldUser?.id ?: 0
|
id = oldUser?.id ?: 0
|
||||||
card = oldUser?.card ?: us.cardRepo.findByExtId(uid).expect("Card not found")
|
card = oldUser?.card ?: us.cardRepo.findByExtId(uid) ?: (404 - "Card not found")
|
||||||
|
|
||||||
val version = data["version"] as? String ?: "0.00"
|
val version = data["version"] as? String ?: "0.00"
|
||||||
val versionNumber = version.toDoubleOrNull() ?: 0.0
|
val versionNumber = version.toDoubleOrNull() ?: 0.0
|
||||||
@@ -66,12 +66,12 @@ fun ChusanController.upsertApiInit() {
|
|||||||
userRatingBaseNextList to "rating_next_list",
|
userRatingBaseNextList to "rating_next_list",
|
||||||
userRatingBaseNewList to "rating_new_list"
|
userRatingBaseNewList to "rating_new_list"
|
||||||
).filter { it.first != null }.forEach { (list, key) ->
|
).filter { it.first != null }.forEach { (list, key) ->
|
||||||
val d = db.userGeneralData.findByUserAndPropertyKey(u, key)()
|
val d = db.userGeneralData.findByUserAndPropertyKey(u, key)
|
||||||
?: UserGeneralData().apply { user = u; propertyKey = key }
|
?: UserGeneralData().apply { user = u; propertyKey = key }
|
||||||
db.userGeneralData.save(d.apply { propertyValue = list!!.str() })
|
db.userGeneralData.save(d.apply { propertyValue = list!!.str() })
|
||||||
}
|
}
|
||||||
|
|
||||||
val misc = db.userMisc.findSingleByUser(u)() ?: Chu3UserMisc().apply { user = u }
|
val misc = db.userMisc.findSingleByUser(u) ?: Chu3UserMisc().apply { user = u }
|
||||||
|
|
||||||
// Favorites
|
// Favorites
|
||||||
userFavoriteMusicList?.filter { it.musicId != -1 }?.ifEmpty { null }?.let { list ->
|
userFavoriteMusicList?.filter { it.musicId != -1 }?.ifEmpty { null }?.let { list ->
|
||||||
@@ -113,7 +113,7 @@ fun ChusanController.upsertApiInit() {
|
|||||||
// List data
|
// List data
|
||||||
userGameOption?.get(0)?.let { obj ->
|
userGameOption?.get(0)?.let { obj ->
|
||||||
db.userGameOption.saveAndFlush(obj.apply {
|
db.userGameOption.saveAndFlush(obj.apply {
|
||||||
id = db.userGameOption.findSingleByUser(u)()?.id ?: 0 }) }
|
id = db.userGameOption.findSingleByUser(u)?.id ?: 0 }) }
|
||||||
|
|
||||||
userMapAreaList?.let { list ->
|
userMapAreaList?.let { list ->
|
||||||
db.userMap.saveAll(list.distinctBy { it.mapAreaId }.mapApply {
|
db.userMap.saveAll(list.distinctBy { it.mapAreaId }.mapApply {
|
||||||
@@ -137,7 +137,7 @@ fun ChusanController.upsertApiInit() {
|
|||||||
|
|
||||||
userChargeList?.let { list ->
|
userChargeList?.let { list ->
|
||||||
db.userCharge.saveAll(list.distinctBy { it.chargeId }.mapApply {
|
db.userCharge.saveAll(list.distinctBy { it.chargeId }.mapApply {
|
||||||
id = db.userCharge.findByUserAndChargeId(u, chargeId)()?.id ?: 0 }) }
|
id = db.userCharge.findByUserAndChargeId(u, chargeId)?.id ?: 0 }) }
|
||||||
|
|
||||||
userCourseList?.let { list ->
|
userCourseList?.let { list ->
|
||||||
db.userCourse.saveAll(list.distinctBy { it.courseId }.mapApply {
|
db.userCourse.saveAll(list.distinctBy { it.courseId }.mapApply {
|
||||||
@@ -155,7 +155,7 @@ fun ChusanController.upsertApiInit() {
|
|||||||
// userLoginBonusList?.let { list ->
|
// userLoginBonusList?.let { list ->
|
||||||
// db.userLoginBonus.saveAll(list.distinctBy { it["presetId"] as String }.map {
|
// db.userLoginBonus.saveAll(list.distinctBy { it["presetId"] as String }.map {
|
||||||
// val id = it["presetId"]!!.int
|
// val id = it["presetId"]!!.int
|
||||||
// (db.userLoginBonus.findLoginBonus(uid.int, 1, id)() ?: UserLoginBonus()).apply {
|
// (db.userLoginBonus.findLoginBonus(uid.int, 1, id) ?: UserLoginBonus()).apply {
|
||||||
// user = u.id.toInt()
|
// user = u.id.toInt()
|
||||||
// presetId = id
|
// presetId = id
|
||||||
// lastUpdateDate = LocalDateTime.now()
|
// lastUpdateDate = LocalDateTime.now()
|
||||||
@@ -165,7 +165,7 @@ fun ChusanController.upsertApiInit() {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
req.userCMissionList?.forEach { d ->
|
req.userCMissionList?.forEach { d ->
|
||||||
(db.userCMission.findByUser_Card_ExtIdAndMissionId(uid, d.missionId)()
|
(db.userCMission.findByUser_Card_ExtIdAndMissionId(uid, d.missionId)
|
||||||
?: UserCMission().apply {
|
?: UserCMission().apply {
|
||||||
missionId = d.missionId
|
missionId = d.missionId
|
||||||
user = u
|
user = u
|
||||||
@@ -173,7 +173,7 @@ fun ChusanController.upsertApiInit() {
|
|||||||
).apply { point = d.point }.also { db.userCMission.save(it) }
|
).apply { point = d.point }.also { db.userCMission.save(it) }
|
||||||
|
|
||||||
d.userCMissionProgressList?.forEach inner@ { p ->
|
d.userCMissionProgressList?.forEach inner@ { p ->
|
||||||
(db.userCMissionProgress.findByUser_Card_ExtIdAndMissionIdAndOrder(uid, d.missionId, p.order)()
|
(db.userCMissionProgress.findByUser_Card_ExtIdAndMissionIdAndOrder(uid, d.missionId, p.order)
|
||||||
?: UserCMissionProgress().apply {
|
?: UserCMissionProgress().apply {
|
||||||
missionId = d.missionId
|
missionId = d.missionId
|
||||||
order = p.order
|
order = p.order
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import java.util.*
|
|||||||
@NoRepositoryBean
|
@NoRepositoryBean
|
||||||
interface Chu3UserLinked<T> : IUserRepo<Chu3UserData, T> {
|
interface Chu3UserLinked<T> : IUserRepo<Chu3UserData, T> {
|
||||||
fun findByUser_Card_ExtId(extId: Long): List<T>
|
fun findByUser_Card_ExtId(extId: Long): List<T>
|
||||||
fun findSingleByUser_Card_ExtId(extId: Long): Optional<T>
|
fun findSingleByUser_Card_ExtId(extId: Long): T?
|
||||||
fun findByUser_Card_ExtId(extId: Long, pageable: Pageable): Page<T>
|
fun findByUser_Card_ExtId(extId: Long, pageable: Pageable): Page<T>
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,11 +37,11 @@ interface Chu3UserLoginBonusRepo : JpaRepository<UserLoginBonus, Long> {
|
|||||||
value = "select * from chusan_user_login_bonus where user = ?1 and version = ?2 and preset_id = ?3 limit 1",
|
value = "select * from chusan_user_login_bonus where user = ?1 and version = ?2 and preset_id = ?3 limit 1",
|
||||||
nativeQuery = true
|
nativeQuery = true
|
||||||
)
|
)
|
||||||
fun findLoginBonus(userId: Int, version: Int, presetId: Long): Optional<UserLoginBonus>
|
fun findLoginBonus(userId: Int, version: Int, presetId: Long): UserLoginBonus?
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Chu3UserActivityRepo : Chu3UserLinked<Chu3UserActivity> {
|
interface Chu3UserActivityRepo : Chu3UserLinked<Chu3UserActivity> {
|
||||||
fun findTopByUserAndActivityIdAndKindOrderByIdDesc(user: Chu3UserData, activityId: Int, kind: Int): Optional<Chu3UserActivity>
|
fun findTopByUserAndActivityIdAndKindOrderByIdDesc(user: Chu3UserData, activityId: Int, kind: Int): Chu3UserActivity?
|
||||||
fun findByUserAndActivityIdAndKind(user: Chu3UserData, activityId: Int, kind: Int): Chu3UserActivity?
|
fun findByUserAndActivityIdAndKind(user: Chu3UserData, activityId: Int, kind: Int): Chu3UserActivity?
|
||||||
|
|
||||||
fun findAllByUser_Card_ExtIdAndKind(extId: Long, kind: Int): List<Chu3UserActivity>
|
fun findAllByUser_Card_ExtIdAndKind(extId: Long, kind: Int): List<Chu3UserActivity>
|
||||||
@@ -54,17 +54,17 @@ interface Chu3UserCardPrintStateRepo : Chu3UserLinked<UserCardPrintState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface Chu3UserCharacterRepo : Chu3UserLinked<UserCharacter> {
|
interface Chu3UserCharacterRepo : Chu3UserLinked<UserCharacter> {
|
||||||
fun findTopByUserAndCharacterIdOrderByIdDesc(user: Chu3UserData, characterId: Int): Optional<UserCharacter>
|
fun findTopByUserAndCharacterIdOrderByIdDesc(user: Chu3UserData, characterId: Int): UserCharacter?
|
||||||
fun findByUserAndCharacterId(user: Chu3UserData, characterId: Int): UserCharacter?
|
fun findByUserAndCharacterId(user: Chu3UserData, characterId: Int): UserCharacter?
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Chu3UserChargeRepo : Chu3UserLinked<UserCharge> {
|
interface Chu3UserChargeRepo : Chu3UserLinked<UserCharge> {
|
||||||
fun findByUserAndChargeId(extId: Chu3UserData, chargeId: Int): Optional<UserCharge>
|
fun findByUserAndChargeId(extId: Chu3UserData, chargeId: Int): UserCharge?
|
||||||
fun findByUser_Card_ExtIdAndChargeId(ext: Long, chargeId: Int): UserCharge?
|
fun findByUser_Card_ExtIdAndChargeId(ext: Long, chargeId: Int): UserCharge?
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Chu3UserCourseRepo : Chu3UserLinked<UserCourse> {
|
interface Chu3UserCourseRepo : Chu3UserLinked<UserCourse> {
|
||||||
fun findTopByUserAndCourseIdOrderByIdDesc(user: Chu3UserData, courseId: Int): Optional<UserCourse>
|
fun findTopByUserAndCourseIdOrderByIdDesc(user: Chu3UserData, courseId: Int): UserCourse?
|
||||||
fun findByUserAndCourseId(user: Chu3UserData, courseId: Int): UserCourse?
|
fun findByUserAndCourseId(user: Chu3UserData, courseId: Int): UserCourse?
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,25 +73,25 @@ interface Chu3UserDataRepo : GenericUserDataRepo<Chu3UserData> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface Chu3UserDuelRepo : Chu3UserLinked<UserDuel> {
|
interface Chu3UserDuelRepo : Chu3UserLinked<UserDuel> {
|
||||||
fun findTopByUserAndDuelIdOrderByIdDesc(user: Chu3UserData, duelId: Int): Optional<UserDuel>
|
fun findTopByUserAndDuelIdOrderByIdDesc(user: Chu3UserData, duelId: Int): UserDuel?
|
||||||
fun findByUserAndDuelId(user: Chu3UserData, duelId: Int): UserDuel?
|
fun findByUserAndDuelId(user: Chu3UserData, duelId: Int): UserDuel?
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Chu3UserGachaRepo : Chu3UserLinked<UserGacha> {
|
interface Chu3UserGachaRepo : Chu3UserLinked<UserGacha> {
|
||||||
fun findByUserAndGachaId(extId: Chu3UserData, gachaId: Int): Optional<UserGacha>
|
fun findByUserAndGachaId(extId: Chu3UserData, gachaId: Int): UserGacha?
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Chu3UserGameOptionRepo : Chu3UserLinked<UserGameOption>
|
interface Chu3UserGameOptionRepo : Chu3UserLinked<UserGameOption>
|
||||||
|
|
||||||
interface Chu3UserGeneralDataRepo : Chu3UserLinked<UserGeneralData> {
|
interface Chu3UserGeneralDataRepo : Chu3UserLinked<UserGeneralData> {
|
||||||
fun findByUserAndPropertyKey(user: Chu3UserData, key: String): Optional<UserGeneralData>
|
fun findByUserAndPropertyKey(user: Chu3UserData, key: String): UserGeneralData?
|
||||||
|
|
||||||
fun findByUser_Card_ExtIdAndPropertyKey(extId: Long, key: String): Optional<UserGeneralData>
|
fun findByUser_Card_ExtIdAndPropertyKey(extId: Long, key: String): UserGeneralData?
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Chu3UserItemRepo : Chu3UserLinked<Chu3UserItem> {
|
interface Chu3UserItemRepo : Chu3UserLinked<Chu3UserItem> {
|
||||||
fun findAllByUser(user: Chu3UserData): List<Chu3UserItem>
|
fun findAllByUser(user: Chu3UserData): List<Chu3UserItem>
|
||||||
fun findTopByUserAndItemIdAndItemKindOrderByIdDesc(user: Chu3UserData, itemId: Int, itemKind: Int): Optional<Chu3UserItem>
|
fun findTopByUserAndItemIdAndItemKindOrderByIdDesc(user: Chu3UserData, itemId: Int, itemKind: Int): Chu3UserItem?
|
||||||
fun findByUserAndItemIdAndItemKind(user: Chu3UserData, itemId: Int, itemKind: Int): Chu3UserItem?
|
fun findByUserAndItemIdAndItemKind(user: Chu3UserData, itemId: Int, itemKind: Int): Chu3UserItem?
|
||||||
|
|
||||||
fun findAllByUser_Card_ExtIdAndItemKind(extId: Long, itemKind: Int, pageable: Pageable): Page<Chu3UserItem>
|
fun findAllByUser_Card_ExtIdAndItemKind(extId: Long, itemKind: Int, pageable: Pageable): Page<Chu3UserItem>
|
||||||
@@ -106,7 +106,7 @@ interface Chu3UserMapRepo : Chu3UserLinked<UserMap> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface Chu3UserMusicDetailRepo : Chu3UserLinked<UserMusicDetail>, GenericUserMusicRepo<UserMusicDetail> {
|
interface Chu3UserMusicDetailRepo : Chu3UserLinked<UserMusicDetail>, GenericUserMusicRepo<UserMusicDetail> {
|
||||||
fun findTopByUserAndMusicIdAndLevelOrderByIdDesc(user: Chu3UserData, musicId: Int, level: Int): Optional<UserMusicDetail>
|
fun findTopByUserAndMusicIdAndLevelOrderByIdDesc(user: Chu3UserData, musicId: Int, level: Int): UserMusicDetail?
|
||||||
fun findByUserAndMusicIdAndLevel(user: Chu3UserData, musicId: Int, level: Int): UserMusicDetail?
|
fun findByUserAndMusicIdAndLevel(user: Chu3UserData, musicId: Int, level: Int): UserMusicDetail?
|
||||||
|
|
||||||
fun findByUser_Card_ExtIdAndMusicId(extId: Long, musicId: Int): List<UserMusicDetail>
|
fun findByUser_Card_ExtIdAndMusicId(extId: Long, musicId: Int): List<UserMusicDetail>
|
||||||
@@ -119,7 +119,7 @@ interface Chu3UserPlaylogRepo : GenericPlaylogRepo<UserPlaylog>, Chu3UserLinked<
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface Chu3UserCMissionRepo : Chu3UserLinked<UserCMission> {
|
interface Chu3UserCMissionRepo : Chu3UserLinked<UserCMission> {
|
||||||
fun findByUser_Card_ExtIdAndMissionId(extId: Long, missionId: Int): Optional<UserCMission>
|
fun findByUser_Card_ExtIdAndMissionId(extId: Long, missionId: Int): UserCMission?
|
||||||
fun findByUserAndMissionIdIn(user: Chu3UserData, missionIds: Collection<Int>): List<UserCMission>
|
fun findByUserAndMissionIdIn(user: Chu3UserData, missionIds: Collection<Int>): List<UserCMission>
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,7 +127,7 @@ interface Chu3UserCMissionProgressRepo : Chu3UserLinked<UserCMissionProgress> {
|
|||||||
fun findByUser_Card_ExtIdAndMissionId(extId: Long, missionId: Int): List<UserCMissionProgress>
|
fun findByUser_Card_ExtIdAndMissionId(extId: Long, missionId: Int): List<UserCMissionProgress>
|
||||||
fun findByUserAndMissionId(user: Chu3UserData, missionId: Int): List<UserCMissionProgress>
|
fun findByUserAndMissionId(user: Chu3UserData, missionId: Int): List<UserCMissionProgress>
|
||||||
|
|
||||||
fun findByUser_Card_ExtIdAndMissionIdAndOrder(extId: Long, missionId: Int, order: Int): Optional<UserCMissionProgress>
|
fun findByUser_Card_ExtIdAndMissionIdAndOrder(extId: Long, missionId: Int, order: Int): UserCMissionProgress?
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Chu3NetBattleLogRepo : Chu3UserLinked<Chu3NetBattleLog> {
|
interface Chu3NetBattleLogRepo : Chu3UserLinked<Chu3NetBattleLog> {
|
||||||
@@ -171,7 +171,7 @@ interface Chu3GameLoginBonusRepo : JpaRepository<GameLoginBonus, Int> {
|
|||||||
value = "select * from chusan_game_login_bonus where version = ?1 and preset_id = ?2 and need_login_day_count = ?3 limit 1",
|
value = "select * from chusan_game_login_bonus where version = ?1 and preset_id = ?2 and need_login_day_count = ?3 limit 1",
|
||||||
nativeQuery = true
|
nativeQuery = true
|
||||||
)
|
)
|
||||||
fun findByRequiredDays(version: Int, presetId: Int, requiredDays: Int): Optional<GameLoginBonus>
|
fun findByRequiredDays(version: Int, presetId: Int, requiredDays: Int): GameLoginBonus?
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Chu3UserRegionsRepo: Chu3UserLinked<UserRegions> {
|
interface Chu3UserRegionsRepo: Chu3UserLinked<UserRegions> {
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
package icu.samnyan.aqua.sega.diva.controller;
|
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author samnyan (privateamusement@protonmail.com)
|
|
||||||
*/
|
|
||||||
@ControllerAdvice(basePackages = "icu.samnyan.aqua.sega.diva")
|
|
||||||
public class DivaControllerAdvice {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
package icu.samnyan.aqua.sega.diva.handler.operation;
|
|
||||||
|
|
||||||
import icu.samnyan.aqua.sega.diva.handler.BaseHandler;
|
|
||||||
import icu.samnyan.aqua.sega.diva.model.request.BaseRequest;
|
|
||||||
import icu.samnyan.aqua.sega.diva.model.response.operation.PingResponse;
|
|
||||||
import icu.samnyan.aqua.sega.general.dao.PropertyEntryRepository;
|
|
||||||
import icu.samnyan.aqua.sega.general.model.PropertyEntry;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author samnyan (privateamusement@protonmail.com)
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class PingHandler extends BaseHandler {
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(PingHandler.class);
|
|
||||||
private final PropertyEntryRepository propertyEntryRepository;
|
|
||||||
|
|
||||||
public String handle(BaseRequest request) {
|
|
||||||
|
|
||||||
PropertyEntry news = propertyEntryRepository.findByPropertyKey("diva_news").orElseGet(() -> new PropertyEntry("diva_news", "xxx"));
|
|
||||||
PropertyEntry warning = propertyEntryRepository.findByPropertyKey("diva_warning").orElseGet(() -> new PropertyEntry("diva_warning", "xxx"));
|
|
||||||
|
|
||||||
PingResponse response = new PingResponse(
|
|
||||||
request.getCmd(),
|
|
||||||
request.getReq_id(),
|
|
||||||
"ok",
|
|
||||||
news.getPropertyValue(),
|
|
||||||
warning.getPropertyValue()
|
|
||||||
);
|
|
||||||
|
|
||||||
String resp = this.build(mapper.toMap(response));
|
|
||||||
logger.info("Response: {}", resp);
|
|
||||||
|
|
||||||
return resp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package icu.samnyan.aqua.sega.diva.handler.operation
|
||||||
|
|
||||||
|
import ext.logger
|
||||||
|
import icu.samnyan.aqua.sega.diva.handler.BaseHandler
|
||||||
|
import icu.samnyan.aqua.sega.diva.model.request.BaseRequest
|
||||||
|
import icu.samnyan.aqua.sega.diva.model.response.operation.PingResponse
|
||||||
|
import icu.samnyan.aqua.sega.general.dao.PropertyEntryRepository
|
||||||
|
import icu.samnyan.aqua.sega.general.model.PropertyEntry
|
||||||
|
import org.springframework.stereotype.Component
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author samnyan (privateamusement@protonmail.com)
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
class PingHandler(val rp: PropertyEntryRepository) : BaseHandler() {
|
||||||
|
val logger = logger()
|
||||||
|
|
||||||
|
fun handle(request: BaseRequest): String? {
|
||||||
|
val news: PropertyEntry = rp.findByPropertyKey("diva_news") ?: PropertyEntry("diva_news", "xxx")
|
||||||
|
val warning: PropertyEntry = rp.findByPropertyKey("diva_warning") ?: PropertyEntry("diva_warning", "xxx")
|
||||||
|
|
||||||
|
val response = PingResponse(
|
||||||
|
request.cmd,
|
||||||
|
request.req_id,
|
||||||
|
"ok",
|
||||||
|
news.propertyValue,
|
||||||
|
warning.propertyValue
|
||||||
|
)
|
||||||
|
|
||||||
|
val resp = this.build(mapper.toMap(response))
|
||||||
|
logger.info("Response: {}", resp)
|
||||||
|
|
||||||
|
return resp
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,13 +3,12 @@ package icu.samnyan.aqua.sega.general.dao
|
|||||||
import icu.samnyan.aqua.sega.general.model.Card
|
import icu.samnyan.aqua.sega.general.model.Card
|
||||||
import org.springframework.data.jpa.repository.JpaRepository
|
import org.springframework.data.jpa.repository.JpaRepository
|
||||||
import org.springframework.stereotype.Repository
|
import org.springframework.stereotype.Repository
|
||||||
import java.util.*
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author samnyan (privateamusement@protonmail.com)
|
* @author samnyan (privateamusement@protonmail.com)
|
||||||
*/
|
*/
|
||||||
@Repository("SegaCardRepository")
|
@Repository("SegaCardRepository")
|
||||||
interface CardRepository : JpaRepository<Card, Long> {
|
interface CardRepository : JpaRepository<Card, Long> {
|
||||||
fun findByExtId(extId: Long): Optional<Card>
|
fun findByExtId(extId: Long): Card?
|
||||||
fun findByLuid(luid: String): Optional<Card>
|
fun findByLuid(luid: String): Card?
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,5 +10,5 @@ import java.util.*
|
|||||||
*/
|
*/
|
||||||
@Repository
|
@Repository
|
||||||
interface PropertyEntryRepository : JpaRepository<PropertyEntry, Long> {
|
interface PropertyEntryRepository : JpaRepository<PropertyEntry, Long> {
|
||||||
fun findByPropertyKey(key: String): Optional<PropertyEntry>
|
fun findByPropertyKey(key: String): PropertyEntry?
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,9 +6,7 @@ import icu.samnyan.aqua.sega.general.dao.CardRepository
|
|||||||
import icu.samnyan.aqua.sega.general.model.Card
|
import icu.samnyan.aqua.sega.general.model.Card
|
||||||
import org.springframework.stereotype.Service
|
import org.springframework.stereotype.Service
|
||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
import java.util.*
|
|
||||||
import java.util.concurrent.ThreadLocalRandom
|
import java.util.concurrent.ThreadLocalRandom
|
||||||
import kotlin.jvm.optionals.getOrNull
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author samnyan (privateamusement@protonmail.com)
|
* @author samnyan (privateamusement@protonmail.com)
|
||||||
@@ -22,7 +20,7 @@ class CardService(val cardRepo: CardRepository)
|
|||||||
* @param extId External ID
|
* @param extId External ID
|
||||||
* @return Optional of a Card
|
* @return Optional of a Card
|
||||||
*/
|
*/
|
||||||
fun getCardByExtId(extId: Long): Optional<Card> = cardRepo.findByExtId(extId)
|
fun getCardByExtId(extId: Long): Card? = cardRepo.findByExtId(extId)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a new card with access code
|
* Register a new card with access code
|
||||||
@@ -51,19 +49,19 @@ class CardService(val cardRepo: CardRepository)
|
|||||||
val idm = id.replace(":", "").replace(" ", "")
|
val idm = id.replace(":", "").replace(" ", "")
|
||||||
|
|
||||||
// Check case (1) and (4)
|
// Check case (1) and (4)
|
||||||
cardRepo.findByLuid(idm)?.getOrNull()?.let { return it }
|
cardRepo.findByLuid(idm)?.let { return it }
|
||||||
cardRepo.findByLuid(idm.padStart(20, '0'))?.getOrNull()?.let { return it }
|
cardRepo.findByLuid(idm.padStart(20, '0'))?.let { return it }
|
||||||
|
|
||||||
// Check case (2)
|
// Check case (2)
|
||||||
// Then convert to long, left pad zeros to make 20 digits, and look up
|
// Then convert to long, left pad zeros to make 20 digits, and look up
|
||||||
idm.toLongOrNull(16)?.let { idmLong ->
|
idm.toLongOrNull(16)?.let { idmLong ->
|
||||||
cardRepo.findByLuid("%020d".format(idmLong))?.getOrNull()?.let { return it }
|
cardRepo.findByLuid("%020d".format(idmLong))?.let { return it }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check case (3)
|
// Check case (3)
|
||||||
idm.padStart(16, '0').takeLast(12).let { "012E$it" }.let { idmMasked ->
|
idm.padStart(16, '0').takeLast(12).let { "012E$it" }.let { idmMasked ->
|
||||||
idmMasked.toLongOrNull(16)?.let { idmMaskedLong ->
|
idmMasked.toLongOrNull(16)?.let { idmMaskedLong ->
|
||||||
cardRepo.findByLuid("%020d".format(idmMaskedLong))?.getOrNull()?.let { return it }
|
cardRepo.findByLuid("%020d".format(idmMaskedLong))?.let { return it }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,7 +92,7 @@ class CardService(val cardRepo: CardRepository)
|
|||||||
|
|
||||||
fun randExtID(lower: Long = 0, upper: Long = 1e9.toLong() - 1): Long {
|
fun randExtID(lower: Long = 0, upper: Long = 1e9.toLong() - 1): Long {
|
||||||
var eid = ThreadLocalRandom.current().nextLong(lower, upper)
|
var eid = ThreadLocalRandom.current().nextLong(lower, upper)
|
||||||
while (cardRepo.findByExtId(eid).isPresent) {
|
while (cardRepo.findByExtId(eid) != null) {
|
||||||
eid = ThreadLocalRandom.current().nextLong(lower, upper)
|
eid = ThreadLocalRandom.current().nextLong(lower, upper)
|
||||||
}
|
}
|
||||||
return eid
|
return eid
|
||||||
|
|||||||
@@ -16,12 +16,12 @@ fun Maimai2ServletController.initApis() {
|
|||||||
|
|
||||||
"GetUserExtend" { mapOf(
|
"GetUserExtend" { mapOf(
|
||||||
"userId" to uid,
|
"userId" to uid,
|
||||||
"userExtend" to (db.userExtend.findSingleByUser_Card_ExtId(uid)() ?: (404 - "User not found"))
|
"userExtend" to (db.userExtend.findSingleByUser_Card_ExtId(uid) ?: (404 - "User not found"))
|
||||||
) }
|
) }
|
||||||
|
|
||||||
"GetUserData" { mapOf(
|
"GetUserData" { mapOf(
|
||||||
"userId" to uid,
|
"userId" to uid,
|
||||||
"userData" to (db.userData.findByCardExtId(uid)() ?: (404 - "User not found")),
|
"userData" to (db.userData.findByCardExtId(uid) ?: (404 - "User not found")),
|
||||||
"banState" to 0
|
"banState" to 0
|
||||||
) }
|
) }
|
||||||
|
|
||||||
@@ -56,7 +56,7 @@ fun Maimai2ServletController.initApis() {
|
|||||||
|
|
||||||
"GetUserOption" { mapOf(
|
"GetUserOption" { mapOf(
|
||||||
"userId" to uid,
|
"userId" to uid,
|
||||||
"userOption" to (db.userOption.findSingleByUser_Card_ExtId(uid)() ?: (404 - "User not found"))
|
"userOption" to (db.userOption.findSingleByUser_Card_ExtId(uid) ?: (404 - "User not found"))
|
||||||
) }
|
) }
|
||||||
|
|
||||||
"CreateToken" static { """{"Bearer":"meow"}""" }
|
"CreateToken" static { """{"Bearer":"meow"}""" }
|
||||||
@@ -75,7 +75,7 @@ fun Maimai2ServletController.initApis() {
|
|||||||
)
|
)
|
||||||
} }
|
} }
|
||||||
|
|
||||||
"CMGetUserPreview" { db.userData.findByCardExtId(uid)()?.let {
|
"CMGetUserPreview" { db.userData.findByCardExtId(uid)?.let {
|
||||||
mapOf(
|
mapOf(
|
||||||
"userId" to uid,
|
"userId" to uid,
|
||||||
"userName" to it.userName,
|
"userName" to it.userName,
|
||||||
@@ -87,8 +87,8 @@ fun Maimai2ServletController.initApis() {
|
|||||||
} ?: (404 - "User not found") }
|
} ?: (404 - "User not found") }
|
||||||
|
|
||||||
"GetUserPreview" {
|
"GetUserPreview" {
|
||||||
val d = db.userData.findByCardExtId(uid)() ?: (404 - "User not found")
|
val d = db.userData.findByCardExtId(uid) ?: (404 - "User not found")
|
||||||
val option = db.userOption.findSingleByUser_Card_ExtId(uid)()
|
val option = db.userOption.findSingleByUser_Card_ExtId(uid)
|
||||||
|
|
||||||
val res = mutableMapOf(
|
val res = mutableMapOf(
|
||||||
"userId" to uid,
|
"userId" to uid,
|
||||||
@@ -125,7 +125,7 @@ fun Maimai2ServletController.initApis() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
"UserLogin" {
|
"UserLogin" {
|
||||||
val d = db.userData.findByCardExtId(uid)()
|
val d = db.userData.findByCardExtId(uid)
|
||||||
|
|
||||||
val res = mutableMapOf(
|
val res = mutableMapOf(
|
||||||
"returnCode" to 1, "loginCount" to 1,
|
"returnCode" to 1, "loginCount" to 1,
|
||||||
@@ -204,7 +204,7 @@ fun Maimai2ServletController.initApis() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
"GetUserIntimate".unpaged {
|
"GetUserIntimate".unpaged {
|
||||||
val u = db.userData.findByCardExtId(uid)() ?: (404 - "User not found")
|
val u = db.userData.findByCardExtId(uid) ?: (404 - "User not found")
|
||||||
db.userIntimate.findByUser(u)
|
db.userIntimate.findByUser(u)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -241,7 +241,7 @@ fun Maimai2ServletController.initApis() {
|
|||||||
// Request: {userId}
|
// Request: {userId}
|
||||||
// Response: {userId, userKaleidxScopeList}
|
// Response: {userId, userKaleidxScopeList}
|
||||||
"GetUserKaleidxScope".unpaged {
|
"GetUserKaleidxScope".unpaged {
|
||||||
val u = db.userData.findByCardExtId(uid)() ?: (404 - "User not found")
|
val u = db.userData.findByCardExtId(uid) ?: (404 - "User not found")
|
||||||
val lst = db.userKaleidx.findByUser(u)
|
val lst = db.userKaleidx.findByUser(u)
|
||||||
.mapApply { isKeyFound = true }.toMutableList()
|
.mapApply { isKeyFound = true }.toMutableList()
|
||||||
|
|
||||||
@@ -349,7 +349,7 @@ fun Maimai2ServletController.initApis() {
|
|||||||
) }
|
) }
|
||||||
|
|
||||||
"GetUserRecommendSelectMusic" {
|
"GetUserRecommendSelectMusic" {
|
||||||
val user = db.userData.findByCard_ExtId(uid)() ?: (404 - "User not found")
|
val user = db.userData.findByCard_ExtId(uid) ?: (404 - "User not found")
|
||||||
mapOf(
|
mapOf(
|
||||||
"userId" to uid,
|
"userId" to uid,
|
||||||
"userRecommendSelectionMusicIdList" to (net.recommendedMusic[user.id] ?: empty)
|
"userRecommendSelectionMusicIdList" to (net.recommendedMusic[user.id] ?: empty)
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import icu.samnyan.aqua.sega.general.dao.CardRepository
|
|||||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2Repos
|
import icu.samnyan.aqua.sega.maimai2.model.Mai2Repos
|
||||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2ItemKind
|
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2ItemKind
|
||||||
import org.springframework.stereotype.Component
|
import org.springframework.stereotype.Component
|
||||||
import kotlin.jvm.optionals.getOrNull
|
|
||||||
|
|
||||||
@Component("Maimai2GetUserCharacterHandler")
|
@Component("Maimai2GetUserCharacterHandler")
|
||||||
class GetUserCharacterHandler(
|
class GetUserCharacterHandler(
|
||||||
@@ -30,7 +29,7 @@ class GetUserCharacterHandler(
|
|||||||
val userId = (request["userId"] as Number).toLong()
|
val userId = (request["userId"] as Number).toLong()
|
||||||
|
|
||||||
// Aqua Net game unlock feature
|
// Aqua Net game unlock feature
|
||||||
cardRepo.findByExtId(userId).getOrNull()?.aquaUser?.gameOptions?.let { opt ->
|
cardRepo.findByExtId(userId)?.aquaUser?.gameOptions?.let { opt ->
|
||||||
if (!opt.unlockChara or itemUnlock.isNullOrEmpty()) return@let
|
if (!opt.unlockChara or itemUnlock.isNullOrEmpty()) return@let
|
||||||
|
|
||||||
logger.info("Response: ${itemUnlock!!.size} Characters - All unlock")
|
logger.info("Response: ${itemUnlock!!.size} Characters - All unlock")
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
package icu.samnyan.aqua.sega.maimai2.handler
|
package icu.samnyan.aqua.sega.maimai2.handler
|
||||||
|
|
||||||
import ext.invoke
|
|
||||||
import icu.samnyan.aqua.sega.general.BaseHandler
|
import icu.samnyan.aqua.sega.general.BaseHandler
|
||||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2Repos
|
import icu.samnyan.aqua.sega.maimai2.model.Mai2Repos
|
||||||
import org.springframework.stereotype.Component
|
import org.springframework.stereotype.Component
|
||||||
import java.util.*
|
|
||||||
|
|
||||||
@Component("Maimai2GetUserFavoriteItemHandler")
|
@Component("Maimai2GetUserFavoriteItemHandler")
|
||||||
class GetUserFavoriteItemHandler(val repos: Mai2Repos) : BaseHandler {
|
class GetUserFavoriteItemHandler(val repos: Mai2Repos) : BaseHandler {
|
||||||
@@ -15,8 +13,8 @@ class GetUserFavoriteItemHandler(val repos: Mai2Repos) : BaseHandler {
|
|||||||
val items = when (kind) {
|
val items = when (kind) {
|
||||||
1 -> repos.userGeneralData.findByUser_Card_ExtIdAndPropertyKey(userId, "favorite_music")
|
1 -> repos.userGeneralData.findByUser_Card_ExtIdAndPropertyKey(userId, "favorite_music")
|
||||||
2 -> repos.userGeneralData.findByUser_Card_ExtIdAndPropertyKey(userId, "favorite_rival")
|
2 -> repos.userGeneralData.findByUser_Card_ExtIdAndPropertyKey(userId, "favorite_rival")
|
||||||
else -> Optional.empty()
|
else -> null
|
||||||
}()?.let { fav ->
|
}?.let { fav ->
|
||||||
val v = fav.propertyValue
|
val v = fav.propertyValue
|
||||||
if (v.isNotBlank()) v.split(",").filter { it.isNotEmpty() }.mapIndexed { i, record ->
|
if (v.isNotBlank()) v.split(",").filter { it.isNotEmpty() }.mapIndexed { i, record ->
|
||||||
mapOf("id" to record.toInt(), "orderId" to i) }
|
mapOf("id" to record.toInt(), "orderId" to i) }
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import icu.samnyan.aqua.sega.general.dao.CardRepository
|
|||||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2Repos
|
import icu.samnyan.aqua.sega.maimai2.model.Mai2Repos
|
||||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2ItemKind
|
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2ItemKind
|
||||||
import org.springframework.stereotype.Component
|
import org.springframework.stereotype.Component
|
||||||
import kotlin.jvm.optionals.getOrNull
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author samnyan (privateamusement@protonmail.com)
|
* @author samnyan (privateamusement@protonmail.com)
|
||||||
@@ -48,7 +47,7 @@ class GetUserItemHandler(
|
|||||||
val kindType = Mai2ItemKind.ALL[kind]?.name
|
val kindType = Mai2ItemKind.ALL[kind]?.name
|
||||||
|
|
||||||
// Aqua Net game unlock feature
|
// Aqua Net game unlock feature
|
||||||
cardRepo.findByExtId(userId).getOrNull()?.aquaUser?.gameOptions?.let { opt ->
|
cardRepo.findByExtId(userId)?.aquaUser?.gameOptions?.let { opt ->
|
||||||
val items = when {
|
val items = when {
|
||||||
(kind in 5..8) && opt.unlockMusic -> musicUnlock.getValue(kind)
|
(kind in 5..8) && opt.unlockMusic -> musicUnlock.getValue(kind)
|
||||||
(kind in 1..3 || kind == 11) && opt.unlockCollectables -> itemUnlock[kind]
|
(kind in 1..3 || kind == 11) && opt.unlockCollectables -> itemUnlock[kind]
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class GetUserPortraitHandler(
|
|||||||
|
|
||||||
val uid = (request["userId"] as Number).toLong()
|
val uid = (request["userId"] as Number).toLong()
|
||||||
val list = ArrayList<Mai2UserPortrait>()
|
val list = ArrayList<Mai2UserPortrait>()
|
||||||
val profilePicture = cardRepo.findByExtId(uid)()?.aquaUser?.profilePicture?.ifBlank { null }
|
val profilePicture = cardRepo.findByExtId(uid)?.aquaUser?.profilePicture?.ifBlank { null }
|
||||||
?: return """{"length":0,"userPortraitList":[]}"""
|
?: return """{"length":0,"userPortraitList":[]}"""
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -23,25 +23,25 @@ class GetUserRatingHandler(
|
|||||||
|
|
||||||
val ur = UserRating()
|
val ur = UserRating()
|
||||||
|
|
||||||
repos.userData.findByCardExtId(userId)()?.let {
|
repos.userData.findByCardExtId(userId)?.let {
|
||||||
ur.rating = it.playerRating
|
ur.rating = it.playerRating
|
||||||
}
|
}
|
||||||
|
|
||||||
// Old charts (standard) = 25
|
// Old charts (standard) = 25
|
||||||
ur.ratingList = repos.userGeneralData.findByUser_Card_ExtIdAndPropertyKey(userId, "recent_rating")()
|
ur.ratingList = repos.userGeneralData.findByUser_Card_ExtIdAndPropertyKey(userId, "recent_rating")
|
||||||
?.let { loadRateData(it.propertyValue) } ?: empty
|
?.let { loadRateData(it.propertyValue) } ?: empty
|
||||||
|
|
||||||
// New charts (DX) = 15
|
// New charts (DX) = 15
|
||||||
ur.newRatingList = repos.userGeneralData.findByUser_Card_ExtIdAndPropertyKey(userId, "recent_rating_new")()
|
ur.newRatingList = repos.userGeneralData.findByUser_Card_ExtIdAndPropertyKey(userId, "recent_rating_new")
|
||||||
?.let { loadRateData(it.propertyValue) } ?: empty
|
?.let { loadRateData(it.propertyValue) } ?: empty
|
||||||
|
|
||||||
ur.nextRatingList = repos.userGeneralData.findByUser_Card_ExtIdAndPropertyKey(userId, "recent_rating_next")()
|
ur.nextRatingList = repos.userGeneralData.findByUser_Card_ExtIdAndPropertyKey(userId, "recent_rating_next")
|
||||||
?.let { loadRateData(it.propertyValue) } ?: empty
|
?.let { loadRateData(it.propertyValue) } ?: empty
|
||||||
|
|
||||||
ur.nextNewRatingList = repos.userGeneralData.findByUser_Card_ExtIdAndPropertyKey(userId, "recent_rating_next_new")()
|
ur.nextNewRatingList = repos.userGeneralData.findByUser_Card_ExtIdAndPropertyKey(userId, "recent_rating_next_new")
|
||||||
?.let { loadRateData(it.propertyValue) } ?: empty
|
?.let { loadRateData(it.propertyValue) } ?: empty
|
||||||
|
|
||||||
ur.udemae = repos.userUdemae.findSingleByUser_Card_ExtId(userId)() ?: Mai2UserUdemae()
|
ur.udemae = repos.userUdemae.findSingleByUser_Card_ExtId(userId) ?: Mai2UserUdemae()
|
||||||
|
|
||||||
return mapOf(
|
return mapOf(
|
||||||
"userId" to userId,
|
"userId" to userId,
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import icu.samnyan.aqua.sega.util.BasicMapper
|
|||||||
import icu.samnyan.aqua.spring.Metrics
|
import icu.samnyan.aqua.spring.Metrics
|
||||||
import org.springframework.scheduling.annotation.Scheduled
|
import org.springframework.scheduling.annotation.Scheduled
|
||||||
import org.springframework.stereotype.Component
|
import org.springframework.stereotype.Component
|
||||||
import kotlin.jvm.optionals.getOrNull
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author samnyan (privateamusement@protonmail.com)
|
* @author samnyan (privateamusement@protonmail.com)
|
||||||
@@ -52,14 +51,14 @@ class UploadUserPlaylogHandler(
|
|||||||
uid,
|
uid,
|
||||||
playlog.musicId,
|
playlog.musicId,
|
||||||
playlog.userPlayDate
|
playlog.userPlayDate
|
||||||
).size > 0
|
).isNotEmpty()
|
||||||
if (isDup) {
|
if (isDup) {
|
||||||
log.info("Duplicate playlog detected")
|
log.info("Duplicate playlog detected")
|
||||||
return """{"returnCode":1,"apiName":"com.sega.maimai2servlet.api.UploadUserPlaylogApi"}"""
|
return """{"returnCode":1,"apiName":"com.sega.maimai2servlet.api.UploadUserPlaylogApi"}"""
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save if the user is registered
|
// Save if the user is registered
|
||||||
val u = userDataRepository.findByCardExtId(uid).getOrNull()
|
val u = userDataRepository.findByCardExtId(uid)
|
||||||
if (u != null) playlogRepo.save(playlog.apply { user = u })
|
if (u != null) playlogRepo.save(playlog.apply { user = u })
|
||||||
|
|
||||||
// If the user hasn't registered (first play), save the playlog to a backlog
|
// If the user hasn't registered (first play), save the playlog to a backlog
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package icu.samnyan.aqua.sega.maimai2.handler
|
package icu.samnyan.aqua.sega.maimai2.handler
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException
|
import com.fasterxml.jackson.core.JsonProcessingException
|
||||||
import ext.invoke
|
|
||||||
import ext.mapApply
|
import ext.mapApply
|
||||||
|
import ext.minus
|
||||||
import ext.unique
|
import ext.unique
|
||||||
import icu.samnyan.aqua.sega.general.BaseHandler
|
import icu.samnyan.aqua.sega.general.BaseHandler
|
||||||
import icu.samnyan.aqua.sega.general.service.CardService
|
import icu.samnyan.aqua.sega.general.service.CardService
|
||||||
@@ -39,10 +39,10 @@ class UpsertUserAllHandler(
|
|||||||
// If user is guest, just return OK response.
|
// If user is guest, just return OK response.
|
||||||
if ((userId and 281474976710657L) == 281474976710657L) return SUCCESS
|
if ((userId and 281474976710657L) == 281474976710657L) return SUCCESS
|
||||||
|
|
||||||
val userData = repos.userData.findByCardExtId(userId)()
|
val userData = repos.userData.findByCardExtId(userId)
|
||||||
val u = repos.userData.saveAndFlush(req.userData[0].apply {
|
val u = repos.userData.saveAndFlush(req.userData[0].apply {
|
||||||
id = userData?.id ?: 0
|
id = userData?.id ?: 0
|
||||||
card = userData?.card ?: cardService.getCardByExtId(userId).orElseThrow()
|
card = userData?.card ?: cardService.getCardByExtId(userId) ?: (404 - "User not found")
|
||||||
isNetMember = 1
|
isNetMember = 1
|
||||||
|
|
||||||
// Validate username
|
// Validate username
|
||||||
@@ -76,30 +76,30 @@ class UpsertUserAllHandler(
|
|||||||
}.flatten().forEach { it.user = u }
|
}.flatten().forEach { it.user = u }
|
||||||
|
|
||||||
req.userExtend?.getOrNull(0)?.let {
|
req.userExtend?.getOrNull(0)?.let {
|
||||||
repos.userExtend.save(it.apply { id = repos.userExtend.findSingleByUser(u)()?.id ?: 0 })
|
repos.userExtend.save(it.apply { id = repos.userExtend.findSingleByUser(u)?.id ?: 0 })
|
||||||
}
|
}
|
||||||
|
|
||||||
req.userOption?.getOrNull(0)?.let {
|
req.userOption?.getOrNull(0)?.let {
|
||||||
repos.userOption.save(it.apply { id = repos.userOption.findSingleByUser(u)()?.id ?: 0 })
|
repos.userOption.save(it.apply { id = repos.userOption.findSingleByUser(u)?.id ?: 0 })
|
||||||
}
|
}
|
||||||
|
|
||||||
req.userCharacterList?.unique { it.characterId }?.let { news ->
|
req.userCharacterList?.unique { it.characterId }?.let { news ->
|
||||||
repos.userCharacter.saveAll(news.mapApply {
|
repos.userCharacter.saveAll(news.mapApply {
|
||||||
id = repos.userCharacter.findByUserAndCharacterId(u, characterId)()?.id ?: 0 }) }
|
id = repos.userCharacter.findByUserAndCharacterId(u, characterId)?.id ?: 0 }) }
|
||||||
|
|
||||||
req.userMapList?.unique { it.mapId }?.let { news ->
|
req.userMapList?.unique { it.mapId }?.let { news ->
|
||||||
repos.userMap.saveAll(news.mapApply {
|
repos.userMap.saveAll(news.mapApply {
|
||||||
id = repos.userMap.findByUserAndMapId(u, mapId)()?.id ?: 0 }) }
|
id = repos.userMap.findByUserAndMapId(u, mapId)?.id ?: 0 }) }
|
||||||
|
|
||||||
req.userLoginBonusList?.unique { it.bonusId }?.let { news ->
|
req.userLoginBonusList?.unique { it.bonusId }?.let { news ->
|
||||||
repos.userLoginBonus.saveAll(news.mapApply {
|
repos.userLoginBonus.saveAll(news.mapApply {
|
||||||
id = repos.userLoginBonus.findByUserAndBonusId(u, bonusId)()?.id ?: 0
|
id = repos.userLoginBonus.findByUserAndBonusId(u, bonusId)?.id ?: 0
|
||||||
isCurrent = false
|
isCurrent = false
|
||||||
}) }
|
}) }
|
||||||
|
|
||||||
req.userRatingList?.getOrNull(0)?.let { r ->
|
req.userRatingList?.getOrNull(0)?.let { r ->
|
||||||
repos.userUdemae.saveAndFlush(r.udemae.apply {
|
repos.userUdemae.saveAndFlush(r.udemae.apply {
|
||||||
id = repos.userUdemae.findSingleByUser(u)()?.id ?: 0
|
id = repos.userUdemae.findSingleByUser(u)?.id ?: 0
|
||||||
user = u
|
user = u
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -111,23 +111,23 @@ class UpsertUserAllHandler(
|
|||||||
|
|
||||||
req.userItemList?.unique { it.itemId to it.itemKind }?.let { news ->
|
req.userItemList?.unique { it.itemId to it.itemKind }?.let { news ->
|
||||||
repos.userItem.saveAll(news.mapApply {
|
repos.userItem.saveAll(news.mapApply {
|
||||||
id = repos.userItem.findByUserAndItemKindAndItemId(u, itemKind, itemId)()?.id ?: 0 }) }
|
id = repos.userItem.findByUserAndItemKindAndItemId(u, itemKind, itemId)?.id ?: 0 }) }
|
||||||
|
|
||||||
req.userMusicDetailList?.unique { it.musicId to it.level }?.let { news ->
|
req.userMusicDetailList?.unique { it.musicId to it.level }?.let { news ->
|
||||||
repos.userMusicDetail.saveAll(news.mapApply {
|
repos.userMusicDetail.saveAll(news.mapApply {
|
||||||
id = repos.userMusicDetail.findByUserAndMusicIdAndLevel(u, musicId, level)()?.id ?: 0 }) }
|
id = repos.userMusicDetail.findByUserAndMusicIdAndLevel(u, musicId, level)?.id ?: 0 }) }
|
||||||
|
|
||||||
req.userCourseList?.unique { it.courseId }?.let { news ->
|
req.userCourseList?.unique { it.courseId }?.let { news ->
|
||||||
repos.userCourse.saveAll(news.mapApply {
|
repos.userCourse.saveAll(news.mapApply {
|
||||||
id = repos.userCourse.findByUserAndCourseId(u, courseId)()?.id ?: 0 }) }
|
id = repos.userCourse.findByUserAndCourseId(u, courseId)?.id ?: 0 }) }
|
||||||
|
|
||||||
req.userFriendSeasonRankingList?.unique { it.seasonId }?.let { news ->
|
req.userFriendSeasonRankingList?.unique { it.seasonId }?.let { news ->
|
||||||
repos.userFriendSeasonRanking.saveAll(news.mapApply {
|
repos.userFriendSeasonRanking.saveAll(news.mapApply {
|
||||||
id = repos.userFriendSeasonRanking.findByUserAndSeasonId(u, seasonId)()?.id ?: 0 }) }
|
id = repos.userFriendSeasonRanking.findByUserAndSeasonId(u, seasonId)?.id ?: 0 }) }
|
||||||
|
|
||||||
req.userFavoriteList?.unique { it.itemKind }?.let { news ->
|
req.userFavoriteList?.unique { it.itemKind }?.let { news ->
|
||||||
repos.userFavorite.saveAll(news.mapApply {
|
repos.userFavorite.saveAll(news.mapApply {
|
||||||
id = repos.userFavorite.findByUserAndItemKind(u, itemKind)()?.id ?: 0 }) }
|
id = repos.userFavorite.findByUserAndItemKind(u, itemKind)?.id ?: 0 }) }
|
||||||
|
|
||||||
// Added on 1.50
|
// Added on 1.50
|
||||||
req.userKaleidxScopeList?.unique { it.gateId }?.let { lst ->
|
req.userKaleidxScopeList?.unique { it.gateId }?.let { lst ->
|
||||||
@@ -145,7 +145,7 @@ class UpsertUserAllHandler(
|
|||||||
repos.userAct.saveAll(news.flatMap { listOf(it.musicList, it.playList) }.flatten()
|
repos.userAct.saveAll(news.flatMap { listOf(it.musicList, it.playList) }.flatten()
|
||||||
.filter { it.kind != 0 && it.activityId != 0 }
|
.filter { it.kind != 0 && it.activityId != 0 }
|
||||||
.mapApply {
|
.mapApply {
|
||||||
// id = repos.userAct.findByUserAndKindAndActivityId(u, kind, activityId)()?.id ?: 0
|
// id = repos.userAct.findByUserAndKindAndActivityId(u, kind, activityId)?.id ?: 0
|
||||||
user = u
|
user = u
|
||||||
}.sortedBy { it.sortNumber })
|
}.sortedBy { it.sortNumber })
|
||||||
}
|
}
|
||||||
@@ -158,7 +158,7 @@ class UpsertUserAllHandler(
|
|||||||
// Or userFavoritemusicList will be empty
|
// Or userFavoritemusicList will be empty
|
||||||
req.userFavoritemusicList?.let { news ->
|
req.userFavoritemusicList?.let { news ->
|
||||||
val key = "favorite_music"
|
val key = "favorite_music"
|
||||||
val data = repos.userGeneralData.findByUserAndPropertyKey(u, key)()
|
val data = repos.userGeneralData.findByUserAndPropertyKey(u, key)
|
||||||
?: Mai2UserGeneralData().apply { user = u; propertyKey = key }
|
?: Mai2UserGeneralData().apply { user = u; propertyKey = key }
|
||||||
repos.userGeneralData.save(data.apply {
|
repos.userGeneralData.save(data.apply {
|
||||||
propertyValue = news.map { it.id }.joinToString(",")
|
propertyValue = news.map { it.id }.joinToString(",")
|
||||||
@@ -170,7 +170,7 @@ class UpsertUserAllHandler(
|
|||||||
|
|
||||||
fun saveRating(itemList: List<Mai2UserRate>, u: Mai2UserDetail, key: String) {
|
fun saveRating(itemList: List<Mai2UserRate>, u: Mai2UserDetail, key: String) {
|
||||||
val sb = itemList.joinToString(",") { "${it.musicId}:${it.level}:${it.romVersion}:${it.achievement}" }
|
val sb = itemList.joinToString(",") { "${it.musicId}:${it.level}:${it.romVersion}:${it.achievement}" }
|
||||||
val data = repos.userGeneralData.findByUserAndPropertyKey(u, key)()
|
val data = repos.userGeneralData.findByUserAndPropertyKey(u, key)
|
||||||
?: Mai2UserGeneralData().apply { user = u; propertyKey = key }
|
?: Mai2UserGeneralData().apply { user = u; propertyKey = key }
|
||||||
repos.userGeneralData.save(data.apply { propertyValue = sb })
|
repos.userGeneralData.save(data.apply { propertyValue = sb })
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class UpsertUserPrintHandler(
|
|||||||
|
|
||||||
override fun handle(request: Map<String, Any>): Any? {
|
override fun handle(request: Map<String, Any>): Any? {
|
||||||
val userId = parsing { request["userId"]!!.long }
|
val userId = parsing { request["userId"]!!.long }
|
||||||
val userData = db.userData.findByCardExtId(userId)() ?: return null
|
val userData = db.userData.findByCardExtId(userId) ?: return null
|
||||||
|
|
||||||
val userPrint = parsing { mapper.convert(request["userPrintDetail"]!!, Mai2UserPrintDetail::class.java) }
|
val userPrint = parsing { mapper.convert(request["userPrintDetail"]!!, Mai2UserPrintDetail::class.java) }
|
||||||
val newCard = userPrint.userCard ?: return null
|
val newCard = userPrint.userCard ?: return null
|
||||||
@@ -33,7 +33,7 @@ class UpsertUserPrintHandler(
|
|||||||
newCard.user = userData
|
newCard.user = userData
|
||||||
newCard.startDate = LocalDateTime.now().format(formatter)
|
newCard.startDate = LocalDateTime.now().format(formatter)
|
||||||
newCard.endDate = LocalDateTime.now().plusDays(expirationTime).format(formatter)
|
newCard.endDate = LocalDateTime.now().plusDays(expirationTime).format(formatter)
|
||||||
newCard.id = db.userCard.findByUserAndCardId(newCard.user, newCard.cardId)()?.id ?: 0
|
newCard.id = db.userCard.findByUserAndCardId(newCard.user, newCard.cardId)?.id ?: 0
|
||||||
db.userCard.save(newCard)
|
db.userCard.save(newCard)
|
||||||
|
|
||||||
userPrint.user = userData
|
userPrint.user = userData
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import java.util.*
|
|||||||
interface Mai2UserLinked<T>: JpaRepository<T, Long>, IUserRepo<Mai2UserDetail, T> {
|
interface Mai2UserLinked<T>: JpaRepository<T, Long>, IUserRepo<Mai2UserDetail, T> {
|
||||||
fun findByUser_Card_ExtId(userId: Long): List<T>
|
fun findByUser_Card_ExtId(userId: Long): List<T>
|
||||||
fun findByUser_Card_ExtId(userId: Long, page: Pageable): Page<T>
|
fun findByUser_Card_ExtId(userId: Long, page: Pageable): Page<T>
|
||||||
fun findSingleByUser_Card_ExtId(userId: Long): Optional<T>
|
fun findSingleByUser_Card_ExtId(userId: Long): T?
|
||||||
@Transactional
|
@Transactional
|
||||||
fun deleteByUser(user: Mai2UserDetail)
|
fun deleteByUser(user: Mai2UserDetail)
|
||||||
}
|
}
|
||||||
@@ -31,21 +31,21 @@ interface Mai2MapEncountNpcRepo : Mai2UserLinked<Mai2MapEncountNpc>
|
|||||||
interface Mai2UserActRepo : Mai2UserLinked<Mai2UserAct>
|
interface Mai2UserActRepo : Mai2UserLinked<Mai2UserAct>
|
||||||
|
|
||||||
interface Mai2UserCardRepo : Mai2UserLinked<Mai2UserCard> {
|
interface Mai2UserCardRepo : Mai2UserLinked<Mai2UserCard> {
|
||||||
fun findByUserAndCardId(user: Mai2UserDetail, cardId: Int): Optional<Mai2UserCard>
|
fun findByUserAndCardId(user: Mai2UserDetail, cardId: Int): Mai2UserCard?
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Mai2UserCharacterRepo : Mai2UserLinked<Mai2UserCharacter> {
|
interface Mai2UserCharacterRepo : Mai2UserLinked<Mai2UserCharacter> {
|
||||||
fun findByUserAndCharacterId(user: Mai2UserDetail, characterId: Int): Optional<Mai2UserCharacter>
|
fun findByUserAndCharacterId(user: Mai2UserDetail, characterId: Int): Mai2UserCharacter?
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Mai2UserChargeRepo : Mai2UserLinked<Mai2UserCharge>
|
interface Mai2UserChargeRepo : Mai2UserLinked<Mai2UserCharge>
|
||||||
|
|
||||||
interface Mai2UserCourseRepo : Mai2UserLinked<Mai2UserCourse> {
|
interface Mai2UserCourseRepo : Mai2UserLinked<Mai2UserCourse> {
|
||||||
fun findByUserAndCourseId(user: Mai2UserDetail, courseId: Int): Optional<Mai2UserCourse>
|
fun findByUserAndCourseId(user: Mai2UserDetail, courseId: Int): Mai2UserCourse?
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Mai2UserDataRepo : GenericUserDataRepo<Mai2UserDetail> {
|
interface Mai2UserDataRepo : GenericUserDataRepo<Mai2UserDetail> {
|
||||||
fun findByCardExtId(userId: Long): Optional<Mai2UserDetail>
|
fun findByCardExtId(userId: Long): Mai2UserDetail?
|
||||||
|
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@Transactional
|
||||||
@@ -55,40 +55,40 @@ interface Mai2UserDataRepo : GenericUserDataRepo<Mai2UserDetail> {
|
|||||||
interface Mai2UserExtendRepo : Mai2UserLinked<Mai2UserExtend>
|
interface Mai2UserExtendRepo : Mai2UserLinked<Mai2UserExtend>
|
||||||
|
|
||||||
interface Mai2UserFavoriteRepo : Mai2UserLinked<Mai2UserFavorite> {
|
interface Mai2UserFavoriteRepo : Mai2UserLinked<Mai2UserFavorite> {
|
||||||
fun findByUserAndItemKind(user: Mai2UserDetail, kind: Int): Optional<Mai2UserFavorite>
|
fun findByUserAndItemKind(user: Mai2UserDetail, kind: Int): Mai2UserFavorite?
|
||||||
|
|
||||||
fun findByUser_Card_ExtIdAndItemKind(userId: Long, kind: Int): Optional<Mai2UserFavorite>
|
fun findByUser_Card_ExtIdAndItemKind(userId: Long, kind: Int): Mai2UserFavorite?
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Mai2UserFriendSeasonRankingRepo : Mai2UserLinked<Mai2UserFriendSeasonRanking> {
|
interface Mai2UserFriendSeasonRankingRepo : Mai2UserLinked<Mai2UserFriendSeasonRanking> {
|
||||||
fun findByUserAndSeasonId(user: Mai2UserDetail, seasonId: Int): Optional<Mai2UserFriendSeasonRanking>
|
fun findByUserAndSeasonId(user: Mai2UserDetail, seasonId: Int): Mai2UserFriendSeasonRanking?
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Mai2UserGeneralDataRepo : Mai2UserLinked<Mai2UserGeneralData> {
|
interface Mai2UserGeneralDataRepo : Mai2UserLinked<Mai2UserGeneralData> {
|
||||||
fun findByUserAndPropertyKey(user: Mai2UserDetail, key: String): Optional<Mai2UserGeneralData>
|
fun findByUserAndPropertyKey(user: Mai2UserDetail, key: String): Mai2UserGeneralData?
|
||||||
|
|
||||||
fun findByUser_Card_ExtIdAndPropertyKey(userId: Long, key: String): Optional<Mai2UserGeneralData>
|
fun findByUser_Card_ExtIdAndPropertyKey(userId: Long, key: String): Mai2UserGeneralData?
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Mai2UserItemRepo : Mai2UserLinked<Mai2UserItem> {
|
interface Mai2UserItemRepo : Mai2UserLinked<Mai2UserItem> {
|
||||||
fun findByUserCardExtIdAndItemKind(userId: Long, kind: Int): List<Mai2UserItem>
|
fun findByUserCardExtIdAndItemKind(userId: Long, kind: Int): List<Mai2UserItem>
|
||||||
fun findByUserAndItemKindAndItemId(user: Mai2UserDetail, itemKind: Int, itemId: Int): Optional<Mai2UserItem>
|
fun findByUserAndItemKindAndItemId(user: Mai2UserDetail, itemKind: Int, itemId: Int): Mai2UserItem?
|
||||||
|
|
||||||
fun findByUser_Card_ExtIdAndItemKind(userId: Long, kind: Int, page: Pageable): Page<Mai2UserItem>
|
fun findByUser_Card_ExtIdAndItemKind(userId: Long, kind: Int, page: Pageable): Page<Mai2UserItem>
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Mai2UserLoginBonusRepo : Mai2UserLinked<Mai2UserLoginBonus> {
|
interface Mai2UserLoginBonusRepo : Mai2UserLinked<Mai2UserLoginBonus> {
|
||||||
fun findByUserAndBonusId(user: Mai2UserDetail, bonusId: Int): Optional<Mai2UserLoginBonus>
|
fun findByUserAndBonusId(user: Mai2UserDetail, bonusId: Int): Mai2UserLoginBonus?
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Mai2UserMapRepo : Mai2UserLinked<Mai2UserMap> {
|
interface Mai2UserMapRepo : Mai2UserLinked<Mai2UserMap> {
|
||||||
fun findByUserAndMapId(user: Mai2UserDetail, mapId: Int): Optional<Mai2UserMap>
|
fun findByUserAndMapId(user: Mai2UserDetail, mapId: Int): Mai2UserMap?
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Mai2UserMusicDetailRepo : Mai2UserLinked<Mai2UserMusicDetail>, GenericUserMusicRepo<Mai2UserMusicDetail> {
|
interface Mai2UserMusicDetailRepo : Mai2UserLinked<Mai2UserMusicDetail>, GenericUserMusicRepo<Mai2UserMusicDetail> {
|
||||||
fun findByUser_Card_ExtIdAndMusicId(userId: Long, id: Int): List<Mai2UserMusicDetail>
|
fun findByUser_Card_ExtIdAndMusicId(userId: Long, id: Int): List<Mai2UserMusicDetail>
|
||||||
|
|
||||||
fun findByUserAndMusicIdAndLevel(user: Mai2UserDetail, musicId: Int, level: Int): Optional<Mai2UserMusicDetail>
|
fun findByUserAndMusicIdAndLevel(user: Mai2UserDetail, musicId: Int, level: Int): Mai2UserMusicDetail?
|
||||||
|
|
||||||
fun findByUserId(userId: Long): List<Mai2UserMusicDetail>
|
fun findByUserId(userId: Long): List<Mai2UserMusicDetail>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import java.time.LocalDateTime
|
|||||||
|
|
||||||
fun OngekiController.cmApiInit() {
|
fun OngekiController.cmApiInit() {
|
||||||
"CMGetUserData" {
|
"CMGetUserData" {
|
||||||
val user = db.data.findByCard_ExtId(uid)() ?: (400 - "User not found")
|
val user = db.data.findByCard_ExtId(uid) ?: (400 - "User not found")
|
||||||
mapOf("userId" to uid, "userData" to user)
|
mapOf("userId" to uid, "userData" to user)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ fun OngekiController.cmApiInit() {
|
|||||||
|
|
||||||
// Check if user have infinite kaika
|
// Check if user have infinite kaika
|
||||||
if (kind == OgkItemType.KaikaItem.ordinal) {
|
if (kind == OgkItemType.KaikaItem.ordinal) {
|
||||||
val u = db.data.findByCard_ExtId(uid)()
|
val u = db.data.findByCard_ExtId(uid)
|
||||||
u?.card?.aquaUser?.gameOptions?.let {
|
u?.card?.aquaUser?.gameOptions?.let {
|
||||||
if (it.ongekiInfiniteKaika) {
|
if (it.ongekiInfiniteKaika) {
|
||||||
dat = listOf(UserItem().apply {
|
dat = listOf(UserItem().apply {
|
||||||
@@ -67,7 +67,7 @@ fun OngekiController.cmApiInit() {
|
|||||||
val (gachaId, tmpTimes) = parsing { data["gachaId"]!!.long to data["times"]!!.int }
|
val (gachaId, tmpTimes) = parsing { data["gachaId"]!!.long to data["times"]!!.int }
|
||||||
var times = tmpTimes
|
var times = tmpTimes
|
||||||
|
|
||||||
val user = db.data.findByCard_ExtId(uid)() ?: (400 - "User not found")
|
val user = db.data.findByCard_ExtId(uid) ?: (400 - "User not found")
|
||||||
val foundGacha = gdb.gacha.findById(gachaId)() ?: (404 - "Gacha not found")
|
val foundGacha = gdb.gacha.findById(gachaId)() ?: (404 - "Gacha not found")
|
||||||
|
|
||||||
val foundUserGacha = db.gacha.findByUserAndGachaId(user, gachaId)
|
val foundUserGacha = db.gacha.findByUserAndGachaId(user, gachaId)
|
||||||
@@ -111,10 +111,10 @@ fun OngekiController.cmApiInit() {
|
|||||||
val earnedSelectPoints = parsing { data["selectPoint"]!!.int }
|
val earnedSelectPoints = parsing { data["selectPoint"]!!.int }
|
||||||
|
|
||||||
// User data
|
// User data
|
||||||
val oldUser = db.data.findByCard_ExtId(uid)()
|
val oldUser = db.data.findByCard_ExtId(uid)
|
||||||
val u: UserData = all.userData?.get(0)?.apply {
|
val u: UserData = all.userData?.get(0)?.apply {
|
||||||
id = oldUser?.id ?: 0
|
id = oldUser?.id ?: 0
|
||||||
card = oldUser?.card ?: us.cardRepo.findByExtId(uid)() ?: (404 - "Card not found")
|
card = oldUser?.card ?: us.cardRepo.findByExtId(uid) ?: (404 - "Card not found")
|
||||||
|
|
||||||
// Set eventWatchedDate with lastPlayDate, because client doesn't update it
|
// Set eventWatchedDate with lastPlayDate, because client doesn't update it
|
||||||
cmEventWatchedDate = oldUser?.lastPlayDate ?: ""
|
cmEventWatchedDate = oldUser?.lastPlayDate ?: ""
|
||||||
@@ -171,21 +171,21 @@ fun OngekiController.cmApiInit() {
|
|||||||
// UserCharacterList
|
// UserCharacterList
|
||||||
userCharacterList?.let { list ->
|
userCharacterList?.let { list ->
|
||||||
db.character.saveAll(list.distinctBy { it.characterId }.mapApply {
|
db.character.saveAll(list.distinctBy { it.characterId }.mapApply {
|
||||||
id = db.character.findByUserAndCharacterId(u, characterId)()?.id ?: 0
|
id = db.character.findByUserAndCharacterId(u, characterId)?.id ?: 0
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// UserCardList
|
// UserCardList
|
||||||
userCardList?.let { list ->
|
userCardList?.let { list ->
|
||||||
db.card.saveAll(list.distinctBy { it.cardId }.mapApply {
|
db.card.saveAll(list.distinctBy { it.cardId }.mapApply {
|
||||||
id = db.card.findByUserAndCardId(u, cardId)()?.id ?: 0
|
id = db.card.findByUserAndCardId(u, cardId)?.id ?: 0
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// UserItemList
|
// UserItemList
|
||||||
userItemList?.let { list ->
|
userItemList?.let { list ->
|
||||||
db.item.saveAll(list.distinctBy { it.itemKind to it.itemId }.mapApply {
|
db.item.saveAll(list.distinctBy { it.itemKind to it.itemId }.mapApply {
|
||||||
id = db.item.findByUserAndItemKindAndItemId(u, itemKind, itemId)()?.id ?: 0
|
id = db.item.findByUserAndItemKindAndItemId(u, itemKind, itemId)?.id ?: 0
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -197,10 +197,10 @@ fun OngekiController.cmApiInit() {
|
|||||||
val all: OngekiCMUpsertAll = mapper.convert(data["cmUpsertUserAll"]!!)
|
val all: OngekiCMUpsertAll = mapper.convert(data["cmUpsertUserAll"]!!)
|
||||||
|
|
||||||
// User data
|
// User data
|
||||||
val oldUser = db.data.findByCard_ExtId(uid)()
|
val oldUser = db.data.findByCard_ExtId(uid)
|
||||||
val u: UserData = all.userData?.get(0)?.apply {
|
val u: UserData = all.userData?.get(0)?.apply {
|
||||||
id = oldUser?.id ?: 0
|
id = oldUser?.id ?: 0
|
||||||
card = oldUser?.card ?: us.cardRepo.findByExtId(uid)() ?: (404 - "Card not found")
|
card = oldUser?.card ?: us.cardRepo.findByExtId(uid) ?: (404 - "Card not found")
|
||||||
|
|
||||||
// Set eventWatchedDate with lastPlayDate, because client doesn't update it
|
// Set eventWatchedDate with lastPlayDate, because client doesn't update it
|
||||||
cmEventWatchedDate = oldUser?.lastPlayDate ?: ""
|
cmEventWatchedDate = oldUser?.lastPlayDate ?: ""
|
||||||
@@ -216,7 +216,7 @@ fun OngekiController.cmApiInit() {
|
|||||||
// UserActivityList
|
// UserActivityList
|
||||||
userActivityList?.let { list ->
|
userActivityList?.let { list ->
|
||||||
db.activity.saveAll(list.distinctBy { it.activityId to it.kind }.mapApply {
|
db.activity.saveAll(list.distinctBy { it.activityId to it.kind }.mapApply {
|
||||||
id = db.activity.findByUserAndKindAndActivityId(u, kind, activityId)()?.id ?: 0
|
id = db.activity.findByUserAndKindAndActivityId(u, kind, activityId)?.id ?: 0
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -224,21 +224,21 @@ fun OngekiController.cmApiInit() {
|
|||||||
// UserCharacterList
|
// UserCharacterList
|
||||||
userCharacterList?.let { list ->
|
userCharacterList?.let { list ->
|
||||||
db.character.saveAll(list.distinctBy { it.characterId }.mapApply {
|
db.character.saveAll(list.distinctBy { it.characterId }.mapApply {
|
||||||
id = db.character.findByUserAndCharacterId(u, characterId)()?.id ?: 0
|
id = db.character.findByUserAndCharacterId(u, characterId)?.id ?: 0
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// UserCardList
|
// UserCardList
|
||||||
userCardList?.let { list ->
|
userCardList?.let { list ->
|
||||||
db.card.saveAll(list.distinctBy { it.cardId }.mapApply {
|
db.card.saveAll(list.distinctBy { it.cardId }.mapApply {
|
||||||
id = db.card.findByUserAndCardId(u, cardId)()?.id ?: 0
|
id = db.card.findByUserAndCardId(u, cardId)?.id ?: 0
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// UserItemList
|
// UserItemList
|
||||||
userItemList?.let { list ->
|
userItemList?.let { list ->
|
||||||
db.item.saveAll(list.distinctBy { it.itemKind to it.itemId }.mapApply {
|
db.item.saveAll(list.distinctBy { it.itemKind to it.itemId }.mapApply {
|
||||||
id = db.item.findByUserAndItemKindAndItemId(u, itemKind, itemId)()?.id ?: 0
|
id = db.item.findByUserAndItemKindAndItemId(u, itemKind, itemId)?.id ?: 0
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -251,10 +251,10 @@ fun OngekiController.cmApiInit() {
|
|||||||
val selectLog:List<OngekiCMSelectGachaLog> = mapper.convert(data["selectGachaLogList"]!!)
|
val selectLog:List<OngekiCMSelectGachaLog> = mapper.convert(data["selectGachaLogList"]!!)
|
||||||
|
|
||||||
// User data
|
// User data
|
||||||
val oldUser = db.data.findByCard_ExtId(uid)()
|
val oldUser = db.data.findByCard_ExtId(uid)
|
||||||
val u: UserData = all.userData?.get(0)?.apply {
|
val u: UserData = all.userData?.get(0)?.apply {
|
||||||
id = oldUser?.id ?: 0
|
id = oldUser?.id ?: 0
|
||||||
card = oldUser?.card ?: us.cardRepo.findByExtId(uid)() ?: (404 - "Card not found")
|
card = oldUser?.card ?: us.cardRepo.findByExtId(uid) ?: (404 - "Card not found")
|
||||||
|
|
||||||
// Set eventWatchedDate with lastPlayDate, because client doesn't update it
|
// Set eventWatchedDate with lastPlayDate, because client doesn't update it
|
||||||
cmEventWatchedDate = oldUser?.lastPlayDate ?: ""
|
cmEventWatchedDate = oldUser?.lastPlayDate ?: ""
|
||||||
@@ -291,7 +291,7 @@ fun OngekiController.cmApiInit() {
|
|||||||
// UserCharacterList
|
// UserCharacterList
|
||||||
userCharacterList?.let { list ->
|
userCharacterList?.let { list ->
|
||||||
db.character.saveAll(list.distinctBy { it.characterId }.mapApply {
|
db.character.saveAll(list.distinctBy { it.characterId }.mapApply {
|
||||||
id = db.character.findByUserAndCharacterId(u, characterId)()?.id ?: 0
|
id = db.character.findByUserAndCharacterId(u, characterId)?.id ?: 0
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -300,7 +300,7 @@ fun OngekiController.cmApiInit() {
|
|||||||
// UserCardList
|
// UserCardList
|
||||||
userCardList?.let { list ->
|
userCardList?.let { list ->
|
||||||
db.card.saveAll(list.distinctBy { it.cardId }.mapApply {
|
db.card.saveAll(list.distinctBy { it.cardId }.mapApply {
|
||||||
id = db.card.findByUserAndCardId(u, cardId)()?.id ?: 0
|
id = db.card.findByUserAndCardId(u, cardId)?.id ?: 0
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import java.util.*
|
|||||||
@NoRepositoryBean
|
@NoRepositoryBean
|
||||||
interface OngekiUserLinked<T> : IUserRepo<UserData, T> {
|
interface OngekiUserLinked<T> : IUserRepo<UserData, T> {
|
||||||
fun findByUser_Card_ExtId(extId: Long): List<T>
|
fun findByUser_Card_ExtId(extId: Long): List<T>
|
||||||
fun findSingleByUser_Card_ExtId(extId: Long): Optional<T>
|
fun findSingleByUser_Card_ExtId(extId: Long): T?
|
||||||
fun findByUser_Card_ExtId(extId: Long, pageable: Pageable): Page<T>
|
fun findByUser_Card_ExtId(extId: Long, pageable: Pageable): Page<T>
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,28 +27,28 @@ interface OgkUserDataRepo : GenericUserDataRepo<UserData> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface OgkUserActivityRepo : OngekiUserLinked<UserActivity> {
|
interface OgkUserActivityRepo : OngekiUserLinked<UserActivity> {
|
||||||
fun findByUserAndKindAndActivityId(userData: UserData, kind: Int, activityId: Int): Optional<UserActivity>
|
fun findByUserAndKindAndActivityId(userData: UserData, kind: Int, activityId: Int): UserActivity?
|
||||||
fun findByUser_Card_ExtIdAndKindOrderBySortNumberDesc(userId: Long, kind: Int): List<UserActivity>
|
fun findByUser_Card_ExtIdAndKindOrderBySortNumberDesc(userId: Long, kind: Int): List<UserActivity>
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OgkUserBossRepo : OngekiUserLinked<UserBoss> {
|
interface OgkUserBossRepo : OngekiUserLinked<UserBoss> {
|
||||||
fun findByUserAndMusicId(user: UserData, musicId: Int): Optional<UserBoss>
|
fun findByUserAndMusicId(user: UserData, musicId: Int): UserBoss?
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OgkUserCardRepo : OngekiUserLinked<UserCard> {
|
interface OgkUserCardRepo : OngekiUserLinked<UserCard> {
|
||||||
fun findByUserAndCardId(userData: UserData, cardId: Int): Optional<UserCard>
|
fun findByUserAndCardId(userData: UserData, cardId: Int): UserCard?
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OgkUserChapterRepo : OngekiUserLinked<UserChapter> {
|
interface OgkUserChapterRepo : OngekiUserLinked<UserChapter> {
|
||||||
fun findByUserAndChapterId(userData: UserData, chapterId: Int): Optional<UserChapter>
|
fun findByUserAndChapterId(userData: UserData, chapterId: Int): UserChapter?
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OgkUserCharacterRepo : OngekiUserLinked<UserCharacter> {
|
interface OgkUserCharacterRepo : OngekiUserLinked<UserCharacter> {
|
||||||
fun findByUserAndCharacterId(userData: UserData, characterId: Int): Optional<UserCharacter>
|
fun findByUserAndCharacterId(userData: UserData, characterId: Int): UserCharacter?
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OgkUserDeckRepo : OngekiUserLinked<UserDeck> {
|
interface OgkUserDeckRepo : OngekiUserLinked<UserDeck> {
|
||||||
fun findByUserAndDeckId(userData: UserData, deckId: Int): Optional<UserDeck>
|
fun findByUserAndDeckId(userData: UserData, deckId: Int): UserDeck?
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OgkUserEventMusicRepo : OngekiUserLinked<UserEventMusic> {
|
interface OgkUserEventMusicRepo : OngekiUserLinked<UserEventMusic> {
|
||||||
@@ -57,11 +57,11 @@ interface OgkUserEventMusicRepo : OngekiUserLinked<UserEventMusic> {
|
|||||||
eventId: Int,
|
eventId: Int,
|
||||||
type: Int,
|
type: Int,
|
||||||
musicId: Int
|
musicId: Int
|
||||||
): Optional<UserEventMusic>
|
): UserEventMusic?
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OgkUserEventPointRepo : OngekiUserLinked<UserEventPoint> {
|
interface OgkUserEventPointRepo : OngekiUserLinked<UserEventPoint> {
|
||||||
fun findByUserAndEventId(userData: UserData, eventId: Int): Optional<UserEventPoint>
|
fun findByUserAndEventId(userData: UserData, eventId: Int): UserEventPoint?
|
||||||
|
|
||||||
//@Query(value = "SELECT rank from (SELECT user_id , DENSE_RANK() OVER (ORDER BY point DESC) as rank from ongeki_user_event_point where event_id = :eventId) where user_id == :userId limit 1", nativeQuery = true)
|
//@Query(value = "SELECT rank from (SELECT user_id , DENSE_RANK() OVER (ORDER BY point DESC) as rank from ongeki_user_event_point where event_id = :eventId) where user_id == :userId limit 1", nativeQuery = true)
|
||||||
@Query("SELECT COUNT(u)+1 FROM OngekiUserEventPoint u WHERE u.eventId = :eventId AND u.point > (SELECT u2.point FROM OngekiUserEventPoint u2 WHERE u2.user.id = :userId AND u2.eventId = :eventId)")
|
@Query("SELECT COUNT(u)+1 FROM OngekiUserEventPoint u WHERE u.eventId = :eventId AND u.point > (SELECT u2.point FROM OngekiUserEventPoint u2 WHERE u2.user.id = :userId AND u2.eventId = :eventId)")
|
||||||
@@ -69,40 +69,40 @@ interface OgkUserEventPointRepo : OngekiUserLinked<UserEventPoint> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface OgkUserGeneralDataRepo : OngekiUserLinked<UserGeneralData> {
|
interface OgkUserGeneralDataRepo : OngekiUserLinked<UserGeneralData> {
|
||||||
fun findByUserAndPropertyKey(user: UserData, key: String): Optional<UserGeneralData>
|
fun findByUserAndPropertyKey(user: UserData, key: String): UserGeneralData?
|
||||||
|
|
||||||
fun findByUser_Card_ExtIdAndPropertyKey(userId: Long, key: String): Optional<UserGeneralData>
|
fun findByUser_Card_ExtIdAndPropertyKey(userId: Long, key: String): UserGeneralData?
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OgkUserItemRepo : OngekiUserLinked<UserItem> {
|
interface OgkUserItemRepo : OngekiUserLinked<UserItem> {
|
||||||
fun findByUserAndItemKindAndItemId(userData: UserData, itemKind: Int, itemId: Int): Optional<UserItem>
|
fun findByUserAndItemKindAndItemId(userData: UserData, itemKind: Int, itemId: Int): UserItem?
|
||||||
|
|
||||||
fun findByUser_Card_ExtIdAndItemKind(userId: Long, kind: Int, page: Pageable): Page<UserItem>
|
fun findByUser_Card_ExtIdAndItemKind(userId: Long, kind: Int, page: Pageable): Page<UserItem>
|
||||||
fun findByUser_Card_ExtIdAndItemKind(userId: Long, kind: Int): List<UserItem>
|
fun findByUser_Card_ExtIdAndItemKind(userId: Long, kind: Int): List<UserItem>
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OgkUserKopRepo : OngekiUserLinked<UserKop> {
|
interface OgkUserKopRepo : OngekiUserLinked<UserKop> {
|
||||||
fun findByUserAndKopIdAndAreaId(userData: UserData, kopId: Int, areaId: Int): Optional<UserKop>
|
fun findByUserAndKopIdAndAreaId(userData: UserData, kopId: Int, areaId: Int): UserKop?
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OgkUserLoginBonusRepo : OngekiUserLinked<UserLoginBonus> {
|
interface OgkUserLoginBonusRepo : OngekiUserLinked<UserLoginBonus> {
|
||||||
fun findByUserAndBonusId(userData: UserData, bonusId: Int): Optional<UserLoginBonus>
|
fun findByUserAndBonusId(userData: UserData, bonusId: Int): UserLoginBonus?
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OgkUserMemoryChapterRepo : OngekiUserLinked<UserMemoryChapter> {
|
interface OgkUserMemoryChapterRepo : OngekiUserLinked<UserMemoryChapter> {
|
||||||
fun findByUserAndChapterId(userData: UserData, chapterId: Int): Optional<UserMemoryChapter>
|
fun findByUserAndChapterId(userData: UserData, chapterId: Int): UserMemoryChapter?
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OgkUserMissionPointRepo : OngekiUserLinked<UserMissionPoint> {
|
interface OgkUserMissionPointRepo : OngekiUserLinked<UserMissionPoint> {
|
||||||
fun findByUserAndEventId(userData: UserData, eventId: Int): Optional<UserMissionPoint>
|
fun findByUserAndEventId(userData: UserData, eventId: Int): UserMissionPoint?
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OgkUserMusicDetailRepo : OngekiUserLinked<UserMusicDetail>, GenericUserMusicRepo<UserMusicDetail> {
|
interface OgkUserMusicDetailRepo : OngekiUserLinked<UserMusicDetail>, GenericUserMusicRepo<UserMusicDetail> {
|
||||||
fun findByUserAndMusicIdAndLevel(userData: UserData, musicId: Int, level: Int): Optional<UserMusicDetail>
|
fun findByUserAndMusicIdAndLevel(userData: UserData, musicId: Int, level: Int): UserMusicDetail?
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OgkUserMusicItemRepo : OngekiUserLinked<UserMusicItem> {
|
interface OgkUserMusicItemRepo : OngekiUserLinked<UserMusicItem> {
|
||||||
fun findByUserAndMusicId(userData: UserData, musicId: Int): Optional<UserMusicItem>
|
fun findByUserAndMusicId(userData: UserData, musicId: Int): UserMusicItem?
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OgkUserOptionRepo : OngekiUserLinked<UserOption>
|
interface OgkUserOptionRepo : OngekiUserLinked<UserOption>
|
||||||
@@ -112,19 +112,19 @@ interface OgkUserPlaylogRepo : OngekiUserLinked<UserPlaylog>, GenericPlaylogRepo
|
|||||||
interface OgkUserRivalDataRepo : OngekiUserLinked<UserRival>
|
interface OgkUserRivalDataRepo : OngekiUserLinked<UserRival>
|
||||||
|
|
||||||
interface OgkUserScenarioRepo : OngekiUserLinked<UserScenario> {
|
interface OgkUserScenarioRepo : OngekiUserLinked<UserScenario> {
|
||||||
fun findByUserAndScenarioId(user: UserData, scenarioId: Int): Optional<UserScenario>
|
fun findByUserAndScenarioId(user: UserData, scenarioId: Int): UserScenario?
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OgkUserStoryRepo : OngekiUserLinked<UserStory> {
|
interface OgkUserStoryRepo : OngekiUserLinked<UserStory> {
|
||||||
fun findByUserAndStoryId(userData: UserData, storyId: Int): Optional<UserStory>
|
fun findByUserAndStoryId(userData: UserData, storyId: Int): UserStory?
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OgkUserTechCountRepo : OngekiUserLinked<UserTechCount> {
|
interface OgkUserTechCountRepo : OngekiUserLinked<UserTechCount> {
|
||||||
fun findByUserAndLevelId(user: UserData, levelId: Int): Optional<UserTechCount>
|
fun findByUserAndLevelId(user: UserData, levelId: Int): UserTechCount?
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OgkUserTechEventRepo : OngekiUserLinked<UserTechEvent> {
|
interface OgkUserTechEventRepo : OngekiUserLinked<UserTechEvent> {
|
||||||
fun findByUserAndEventId(userData: UserData, eventId: Int): Optional<UserTechEvent>
|
fun findByUserAndEventId(userData: UserData, eventId: Int): UserTechEvent?
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OgkUserTradeItemRepo : OngekiUserLinked<UserTradeItem> {
|
interface OgkUserTradeItemRepo : OngekiUserLinked<UserTradeItem> {
|
||||||
@@ -138,11 +138,11 @@ interface OgkUserTradeItemRepo : OngekiUserLinked<UserTradeItem> {
|
|||||||
userData: UserData,
|
userData: UserData,
|
||||||
chapterId: Int,
|
chapterId: Int,
|
||||||
tradeItemId: Int
|
tradeItemId: Int
|
||||||
): Optional<UserTradeItem>
|
): UserTradeItem?
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OgkUserTrainingRoomRepo : OngekiUserLinked<UserTrainingRoom> {
|
interface OgkUserTrainingRoomRepo : OngekiUserLinked<UserTrainingRoom> {
|
||||||
fun findByUserAndRoomId(user: UserData, roomId: Int): Optional<UserTrainingRoom>
|
fun findByUserAndRoomId(user: UserData, roomId: Int): UserTrainingRoom?
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OgkUserRegionsRepo: OngekiUserLinked<UserRegions> {
|
interface OgkUserRegionsRepo: OngekiUserLinked<UserRegions> {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import icu.samnyan.aqua.sega.ongeki.model.UserRegions
|
|||||||
fun OngekiController.initUpsertAll() {
|
fun OngekiController.initUpsertAll() {
|
||||||
fun saveGeneralData(items: List<Any>, u: UserData, key: String) {
|
fun saveGeneralData(items: List<Any>, u: UserData, key: String) {
|
||||||
db.generalData.save(UserGeneralData().apply {
|
db.generalData.save(UserGeneralData().apply {
|
||||||
id = db.generalData.findByUserAndPropertyKey(u, key)()?.id ?: 0
|
id = db.generalData.findByUserAndPropertyKey(u, key)?.id ?: 0
|
||||||
user = u
|
user = u
|
||||||
propertyKey = key
|
propertyKey = key
|
||||||
propertyValue = items.joinToString(",")
|
propertyValue = items.joinToString(",")
|
||||||
@@ -24,10 +24,10 @@ fun OngekiController.initUpsertAll() {
|
|||||||
val all: OngekiUpsertUserAll = mapper.convert(data["upsertUserAll"]!!)
|
val all: OngekiUpsertUserAll = mapper.convert(data["upsertUserAll"]!!)
|
||||||
|
|
||||||
// User data
|
// User data
|
||||||
val oldUser = db.data.findByCard_ExtId(uid)()
|
val oldUser = db.data.findByCard_ExtId(uid)
|
||||||
val u: UserData = all.userData?.get(0)?.apply {
|
val u: UserData = all.userData?.get(0)?.apply {
|
||||||
id = oldUser?.id ?: 0
|
id = oldUser?.id ?: 0
|
||||||
card = oldUser?.card ?: us.cardRepo.findByExtId(uid)() ?: (404 - "Card not found")
|
card = oldUser?.card ?: us.cardRepo.findByExtId(uid) ?: (404 - "Card not found")
|
||||||
|
|
||||||
// Set eventWatchedDate with lastPlayDate, because client doesn't update it
|
// Set eventWatchedDate with lastPlayDate, because client doesn't update it
|
||||||
eventWatchedDate = oldUser?.lastPlayDate ?: ""
|
eventWatchedDate = oldUser?.lastPlayDate ?: ""
|
||||||
@@ -62,12 +62,12 @@ fun OngekiController.initUpsertAll() {
|
|||||||
// UserOption
|
// UserOption
|
||||||
userOption?.get(0)?.let {
|
userOption?.get(0)?.let {
|
||||||
db.option.save(it.apply {
|
db.option.save(it.apply {
|
||||||
id = db.option.findSingleByUser(u)()?.id ?: 0 }) }
|
id = db.option.findSingleByUser(u)?.id ?: 0 }) }
|
||||||
|
|
||||||
// UserEventMap
|
// UserEventMap
|
||||||
userEventMap?.let {
|
userEventMap?.let {
|
||||||
db.eventMap.save(it.apply {
|
db.eventMap.save(it.apply {
|
||||||
id = db.eventMap.findSingleByUser(u)()?.id ?: 0 }) }
|
id = db.eventMap.findSingleByUser(u)?.id ?: 0 }) }
|
||||||
|
|
||||||
// UserPlaylogList
|
// UserPlaylogList
|
||||||
userPlaylogList?.let { db.playlog.saveAll(it) }
|
userPlaylogList?.let { db.playlog.saveAll(it) }
|
||||||
@@ -97,109 +97,109 @@ fun OngekiController.initUpsertAll() {
|
|||||||
// UserActivityList
|
// UserActivityList
|
||||||
userActivityList?.let { list ->
|
userActivityList?.let { list ->
|
||||||
db.activity.saveAll(list.distinctBy { it.activityId to it.kind }.mapApply {
|
db.activity.saveAll(list.distinctBy { it.activityId to it.kind }.mapApply {
|
||||||
id = db.activity.findByUserAndKindAndActivityId(u, kind, activityId)()?.id ?: 0 }) }
|
id = db.activity.findByUserAndKindAndActivityId(u, kind, activityId)?.id ?: 0 }) }
|
||||||
|
|
||||||
// UserMusicDetailList
|
// UserMusicDetailList
|
||||||
userMusicDetailList?.let { list ->
|
userMusicDetailList?.let { list ->
|
||||||
db.musicDetail.saveAll(list.distinctBy { it.musicId to it.level }.mapApply {
|
db.musicDetail.saveAll(list.distinctBy { it.musicId to it.level }.mapApply {
|
||||||
id = db.musicDetail.findByUserAndMusicIdAndLevel(u, musicId, level)()?.id ?: 0 }) }
|
id = db.musicDetail.findByUserAndMusicIdAndLevel(u, musicId, level)?.id ?: 0 }) }
|
||||||
|
|
||||||
// UserCharacterList
|
// UserCharacterList
|
||||||
userCharacterList?.let { list ->
|
userCharacterList?.let { list ->
|
||||||
db.character.saveAll(list.distinctBy { it.characterId }.mapApply {
|
db.character.saveAll(list.distinctBy { it.characterId }.mapApply {
|
||||||
id = db.character.findByUserAndCharacterId(u, characterId)()?.id ?: 0 }) }
|
id = db.character.findByUserAndCharacterId(u, characterId)?.id ?: 0 }) }
|
||||||
|
|
||||||
// UserCardList
|
// UserCardList
|
||||||
userCardList?.let { list ->
|
userCardList?.let { list ->
|
||||||
db.card.saveAll(list.distinctBy { it.cardId }.mapApply {
|
db.card.saveAll(list.distinctBy { it.cardId }.mapApply {
|
||||||
id = db.card.findByUserAndCardId(u, cardId)()?.id ?: 0 }) }
|
id = db.card.findByUserAndCardId(u, cardId)?.id ?: 0 }) }
|
||||||
|
|
||||||
// UserDeckList
|
// UserDeckList
|
||||||
userDeckList?.let { list ->
|
userDeckList?.let { list ->
|
||||||
db.deck.saveAll(list.distinctBy { it.deckId }.mapApply {
|
db.deck.saveAll(list.distinctBy { it.deckId }.mapApply {
|
||||||
id = db.deck.findByUserAndDeckId(u, deckId)()?.id ?: 0 }) }
|
id = db.deck.findByUserAndDeckId(u, deckId)?.id ?: 0 }) }
|
||||||
|
|
||||||
// UserTrainingRoomList
|
// UserTrainingRoomList
|
||||||
userTrainingRoomList?.let { list ->
|
userTrainingRoomList?.let { list ->
|
||||||
db.trainingRoom.saveAll(list.distinctBy { it.roomId }.mapApply {
|
db.trainingRoom.saveAll(list.distinctBy { it.roomId }.mapApply {
|
||||||
id = db.trainingRoom.findByUserAndRoomId(u, roomId)()?.id ?: 0 }) }
|
id = db.trainingRoom.findByUserAndRoomId(u, roomId)?.id ?: 0 }) }
|
||||||
|
|
||||||
// UserStoryList
|
// UserStoryList
|
||||||
userStoryList?.let { list ->
|
userStoryList?.let { list ->
|
||||||
db.story.saveAll(list.distinctBy { it.storyId }.mapApply {
|
db.story.saveAll(list.distinctBy { it.storyId }.mapApply {
|
||||||
id = db.story.findByUserAndStoryId(u, storyId)()?.id ?: 0 }) }
|
id = db.story.findByUserAndStoryId(u, storyId)?.id ?: 0 }) }
|
||||||
|
|
||||||
// UserChapterList
|
// UserChapterList
|
||||||
userChapterList?.let { list ->
|
userChapterList?.let { list ->
|
||||||
db.chapter.saveAll(list.distinctBy { it.chapterId }.mapApply {
|
db.chapter.saveAll(list.distinctBy { it.chapterId }.mapApply {
|
||||||
id = db.chapter.findByUserAndChapterId(u, chapterId)()?.id ?: 0 }) }
|
id = db.chapter.findByUserAndChapterId(u, chapterId)?.id ?: 0 }) }
|
||||||
|
|
||||||
// UserMemoryChapterList
|
// UserMemoryChapterList
|
||||||
userMemoryChapterList?.let { list ->
|
userMemoryChapterList?.let { list ->
|
||||||
db.memoryChapter.saveAll(list.distinctBy { it.chapterId }.mapApply {
|
db.memoryChapter.saveAll(list.distinctBy { it.chapterId }.mapApply {
|
||||||
id = db.memoryChapter.findByUserAndChapterId(u, chapterId)()?.id ?: 0 }) }
|
id = db.memoryChapter.findByUserAndChapterId(u, chapterId)?.id ?: 0 }) }
|
||||||
|
|
||||||
// UserItemList
|
// UserItemList
|
||||||
userItemList?.let { list ->
|
userItemList?.let { list ->
|
||||||
db.item.saveAll(list.distinctBy { it.itemKind to it.itemId }.mapApply {
|
db.item.saveAll(list.distinctBy { it.itemKind to it.itemId }.mapApply {
|
||||||
id = db.item.findByUserAndItemKindAndItemId(u, itemKind, itemId)()?.id ?: 0 }) }
|
id = db.item.findByUserAndItemKindAndItemId(u, itemKind, itemId)?.id ?: 0 }) }
|
||||||
|
|
||||||
// UserMusicItemList
|
// UserMusicItemList
|
||||||
userMusicItemList?.let { list ->
|
userMusicItemList?.let { list ->
|
||||||
db.musicItem.saveAll(list.distinctBy { it.musicId }.mapApply {
|
db.musicItem.saveAll(list.distinctBy { it.musicId }.mapApply {
|
||||||
id = db.musicItem.findByUserAndMusicId(u, musicId)()?.id ?: 0 }) }
|
id = db.musicItem.findByUserAndMusicId(u, musicId)?.id ?: 0 }) }
|
||||||
|
|
||||||
// UserLoginBonusList
|
// UserLoginBonusList
|
||||||
userLoginBonusList?.let { list ->
|
userLoginBonusList?.let { list ->
|
||||||
db.loginBonus.saveAll(list.distinctBy { it.bonusId }.mapApply {
|
db.loginBonus.saveAll(list.distinctBy { it.bonusId }.mapApply {
|
||||||
id = db.loginBonus.findByUserAndBonusId(u, bonusId)()?.id ?: 0 }) }
|
id = db.loginBonus.findByUserAndBonusId(u, bonusId)?.id ?: 0 }) }
|
||||||
|
|
||||||
// UserEventPointList
|
// UserEventPointList
|
||||||
userEventPointList?.let { list ->
|
userEventPointList?.let { list ->
|
||||||
db.eventPoint.saveAll(list.distinctBy { it.eventId }.mapApply {
|
db.eventPoint.saveAll(list.distinctBy { it.eventId }.mapApply {
|
||||||
id = db.eventPoint.findByUserAndEventId(u, eventId)()?.id ?: 0 }) }
|
id = db.eventPoint.findByUserAndEventId(u, eventId)?.id ?: 0 }) }
|
||||||
|
|
||||||
// UserMissionPointList
|
// UserMissionPointList
|
||||||
userMissionPointList?.let { list ->
|
userMissionPointList?.let { list ->
|
||||||
db.missionPoint.saveAll(list.distinctBy { it.eventId }.mapApply {
|
db.missionPoint.saveAll(list.distinctBy { it.eventId }.mapApply {
|
||||||
id = db.missionPoint.findByUserAndEventId(u, eventId)()?.id ?: 0 }) }
|
id = db.missionPoint.findByUserAndEventId(u, eventId)?.id ?: 0 }) }
|
||||||
|
|
||||||
// UserRatinglogList (For the highest rating of each version)
|
// UserRatinglogList (For the highest rating of each version)
|
||||||
|
|
||||||
// UserBossList
|
// UserBossList
|
||||||
userBossList?.let { list ->
|
userBossList?.let { list ->
|
||||||
db.boss.saveAll(list.distinctBy { it.musicId }.mapApply {
|
db.boss.saveAll(list.distinctBy { it.musicId }.mapApply {
|
||||||
id = db.boss.findByUserAndMusicId(u, musicId)()?.id ?: 0 }) }
|
id = db.boss.findByUserAndMusicId(u, musicId)?.id ?: 0 }) }
|
||||||
|
|
||||||
// UserTechCountList
|
// UserTechCountList
|
||||||
userTechCountList?.let { list ->
|
userTechCountList?.let { list ->
|
||||||
db.techCount.saveAll(list.distinctBy { it.levelId }.mapApply {
|
db.techCount.saveAll(list.distinctBy { it.levelId }.mapApply {
|
||||||
id = db.techCount.findByUserAndLevelId(u, levelId)()?.id ?: 0 }) }
|
id = db.techCount.findByUserAndLevelId(u, levelId)?.id ?: 0 }) }
|
||||||
|
|
||||||
// UserScenarioList
|
// UserScenarioList
|
||||||
userScenarioList?.let { list ->
|
userScenarioList?.let { list ->
|
||||||
db.scenario.saveAll(list.distinctBy { it.scenarioId }.mapApply {
|
db.scenario.saveAll(list.distinctBy { it.scenarioId }.mapApply {
|
||||||
id = db.scenario.findByUserAndScenarioId(u, scenarioId)()?.id ?: 0 }) }
|
id = db.scenario.findByUserAndScenarioId(u, scenarioId)?.id ?: 0 }) }
|
||||||
|
|
||||||
// UserTradeItemList
|
// UserTradeItemList
|
||||||
userTradeItemList?.let { list ->
|
userTradeItemList?.let { list ->
|
||||||
db.tradeItem.saveAll(list.distinctBy { it.chapterId to it.tradeItemId }.mapApply {
|
db.tradeItem.saveAll(list.distinctBy { it.chapterId to it.tradeItemId }.mapApply {
|
||||||
id = db.tradeItem.findByUserAndChapterIdAndTradeItemId(u, chapterId, tradeItemId)()?.id ?: 0 }) }
|
id = db.tradeItem.findByUserAndChapterIdAndTradeItemId(u, chapterId, tradeItemId)?.id ?: 0 }) }
|
||||||
|
|
||||||
// UserEventMusicList
|
// UserEventMusicList
|
||||||
userEventMusicList?.let { list ->
|
userEventMusicList?.let { list ->
|
||||||
db.eventMusic.saveAll(list.distinctBy { it.eventId to it.type to it.musicId }.mapApply {
|
db.eventMusic.saveAll(list.distinctBy { it.eventId to it.type to it.musicId }.mapApply {
|
||||||
id = db.eventMusic.findByUserAndEventIdAndTypeAndMusicId(u, eventId, type, musicId)()?.id ?: 0 }) }
|
id = db.eventMusic.findByUserAndEventIdAndTypeAndMusicId(u, eventId, type, musicId)?.id ?: 0 }) }
|
||||||
|
|
||||||
// UserTechEventList
|
// UserTechEventList
|
||||||
userTechEventList?.let { list ->
|
userTechEventList?.let { list ->
|
||||||
db.techEvent.saveAll(list.distinctBy { it.eventId }.mapApply {
|
db.techEvent.saveAll(list.distinctBy { it.eventId }.mapApply {
|
||||||
id = db.techEvent.findByUserAndEventId(u, eventId)()?.id ?: 0 }) }
|
id = db.techEvent.findByUserAndEventId(u, eventId)?.id ?: 0 }) }
|
||||||
|
|
||||||
// UserKopList
|
// UserKopList
|
||||||
userKopList?.let { list ->
|
userKopList?.let { list ->
|
||||||
db.kop.saveAll(list.distinctBy { it.kopId to it.areaId }.mapApply {
|
db.kop.saveAll(list.distinctBy { it.kopId to it.areaId }.mapApply {
|
||||||
id = db.kop.findByUserAndKopIdAndAreaId(u, kopId, areaId)()?.id ?: 0 }) }
|
id = db.kop.findByUserAndKopIdAndAreaId(u, kopId, areaId)?.id ?: 0 }) }
|
||||||
}
|
}
|
||||||
|
|
||||||
null
|
null
|
||||||
|
|||||||
@@ -14,10 +14,10 @@ import java.time.format.DateTimeFormatter
|
|||||||
|
|
||||||
|
|
||||||
fun OngekiController.initUser() {
|
fun OngekiController.initUser() {
|
||||||
"GetUserData" { mapOf("userId" to uid, "userData" to db.data.findByCard_ExtId(uid)()) }
|
"GetUserData" { mapOf("userId" to uid, "userData" to db.data.findByCard_ExtId(uid)) }
|
||||||
|
|
||||||
"GetUserOption" { mapOf("userId" to uid, "userOption" to db.option.findSingleByUser_Card_ExtId(uid)()) }
|
"GetUserOption" { mapOf("userId" to uid, "userOption" to db.option.findSingleByUser_Card_ExtId(uid)) }
|
||||||
"GetUserEventMap" { mapOf("userId" to uid, "userEventMap" to db.eventMap.findSingleByUser_Card_ExtId(uid)()) }
|
"GetUserEventMap" { mapOf("userId" to uid, "userEventMap" to db.eventMap.findSingleByUser_Card_ExtId(uid)) }
|
||||||
|
|
||||||
"GetUserTechEvent".unpaged { db.techEvent.findByUser_Card_ExtId(uid) }
|
"GetUserTechEvent".unpaged { db.techEvent.findByUser_Card_ExtId(uid) }
|
||||||
"GetUserBoss".unpaged { db.boss.findByUser_Card_ExtId(uid) }
|
"GetUserBoss".unpaged { db.boss.findByUser_Card_ExtId(uid) }
|
||||||
@@ -91,7 +91,7 @@ fun OngekiController.initUser() {
|
|||||||
|
|
||||||
// Check if user have infinite kaika
|
// Check if user have infinite kaika
|
||||||
if (kind == OgkItemType.KaikaItem.ordinal) {
|
if (kind == OgkItemType.KaikaItem.ordinal) {
|
||||||
val u = db.data.findByCard_ExtId(uid)()
|
val u = db.data.findByCard_ExtId(uid)
|
||||||
u?.card?.aquaUser?.gameOptions?.let {
|
u?.card?.aquaUser?.gameOptions?.let {
|
||||||
if (it.ongekiInfiniteKaika) {
|
if (it.ongekiInfiniteKaika) {
|
||||||
dat = listOf(UserItem().apply {
|
dat = listOf(UserItem().apply {
|
||||||
@@ -115,7 +115,7 @@ fun OngekiController.initUser() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
"GetUserPreview" api@ {
|
"GetUserPreview" api@ {
|
||||||
val u = db.data.findByCard_ExtId(uid)() ?: return@api mapOf(
|
val u = db.data.findByCard_ExtId(uid) ?: return@api mapOf(
|
||||||
"userId" to uid,
|
"userId" to uid,
|
||||||
"isLogin" to false,
|
"isLogin" to false,
|
||||||
"lastLoginDate" to "0000-00-00 00:00:00",
|
"lastLoginDate" to "0000-00-00 00:00:00",
|
||||||
@@ -138,7 +138,7 @@ fun OngekiController.initUser() {
|
|||||||
"banStatus" to 0,
|
"banStatus" to 0,
|
||||||
"isWarningConfirmed" to true
|
"isWarningConfirmed" to true
|
||||||
)
|
)
|
||||||
val o = db.option.findSingleByUser(u)()
|
val o = db.option.findSingleByUser(u)
|
||||||
|
|
||||||
val res = mutableMapOf(
|
val res = mutableMapOf(
|
||||||
"userId" to uid, "isLogin" to false,
|
"userId" to uid, "isLogin" to false,
|
||||||
@@ -173,7 +173,7 @@ fun OngekiController.initUser() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
"GameLogin" {
|
"GameLogin" {
|
||||||
val user = db.data.findByCard_ExtId(uid)()
|
val user = db.data.findByCard_ExtId(uid)
|
||||||
|
|
||||||
if (user?.card?.status == CardStatus.MIGRATED_TO_MINATO) {
|
if (user?.card?.status == CardStatus.MIGRATED_TO_MINATO) {
|
||||||
"""{"returnCode":"0"}"""
|
"""{"returnCode":"0"}"""
|
||||||
@@ -184,7 +184,7 @@ fun OngekiController.initUser() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
"GetUserRecentRating".unpaged {
|
"GetUserRecentRating".unpaged {
|
||||||
db.generalData.findByUser_Card_ExtIdAndPropertyKey(uid, "recent_rating_list")()?.let { recent ->
|
db.generalData.findByUser_Card_ExtIdAndPropertyKey(uid, "recent_rating_list")?.let { recent ->
|
||||||
recent.propertyValue.split(',').dropLastWhile { it.isEmpty() }.map {
|
recent.propertyValue.split(',').dropLastWhile { it.isEmpty() }.map {
|
||||||
val (m, d, s) = it.split(':').map { it.int }
|
val (m, d, s) = it.split(':').map { it.int }
|
||||||
UserRecentRating(m, d, "1000000", s)
|
UserRecentRating(m, d, "1000000", s)
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ fun WaccaServer.init() {
|
|||||||
if (user(uid) != null) 404 - "User already exists"
|
if (user(uid) != null) 404 - "User already exists"
|
||||||
|
|
||||||
val u = rp.user.save(WaccaUser().apply {
|
val u = rp.user.save(WaccaUser().apply {
|
||||||
card = cardRepo.findByExtId(uid.uint32())() ?: (404 - "Card not found")
|
card = cardRepo.findByExtId(uid.uint32()) ?: (404 - "Card not found")
|
||||||
userName = name.toString()
|
userName = name.toString()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# assuming you all have backups :3
|
# there are 0 profiles here so should be fine.
|
||||||
drop table maimai_user_web_option;
|
drop table maimai_user_web_option;
|
||||||
drop table maimai_user_survival;
|
drop table maimai_user_survival;
|
||||||
drop table maimai_user_present_event;
|
drop table maimai_user_present_event;
|
||||||
@@ -9,15 +9,17 @@ drop table maimai_user_general_data;
|
|||||||
drop table maimai_user_character;
|
drop table maimai_user_character;
|
||||||
drop table maimai_user_boss;
|
drop table maimai_user_boss;
|
||||||
drop table maimai_user_activity;
|
drop table maimai_user_activity;
|
||||||
|
drop table maimai_user_item;
|
||||||
|
drop table maimai_game_event;
|
||||||
|
|
||||||
drop table maimai_user_data;
|
drop table maimai_user_data;
|
||||||
|
|
||||||
|
# there are 30 profiles in chuni, so make sure to back up before upgrading!
|
||||||
drop table chuni_game_character;
|
drop table chuni_game_character;
|
||||||
drop table chuni_game_charge;
|
drop table chuni_game_charge;
|
||||||
drop table chuni_game_event;
|
drop table chuni_game_event;
|
||||||
drop table chuni_game_message;
|
drop table chuni_game_message;
|
||||||
drop table chuni_game_skill;
|
drop table chuni_game_skill;
|
||||||
drop table chuni_music;
|
|
||||||
drop table chuni_music_level;
|
drop table chuni_music_level;
|
||||||
drop table chuni_user_activity;
|
drop table chuni_user_activity;
|
||||||
drop table chuni_user_character;
|
drop table chuni_user_character;
|
||||||
@@ -32,6 +34,7 @@ drop table chuni_user_map;
|
|||||||
drop table chuni_user_music_detail;
|
drop table chuni_user_music_detail;
|
||||||
drop table chuni_user_playlog;
|
drop table chuni_user_playlog;
|
||||||
|
|
||||||
|
drop table chuni_music;
|
||||||
drop table chuni_user_data_ex;
|
drop table chuni_user_data_ex;
|
||||||
drop table chuni_user_data;
|
drop table chuni_user_data;
|
||||||
|
|
||||||
|
|||||||
42
start.bat
42
start.bat
@@ -1,42 +0,0 @@
|
|||||||
@echo off
|
|
||||||
cd /d %~dp0
|
|
||||||
|
|
||||||
@rem set JAVA_HOME=C:\Program Files\RedHat\java-11-openjdk-11.0.4-1
|
|
||||||
|
|
||||||
if not "%JAVA_HOME%" == "" goto OkJHome
|
|
||||||
|
|
||||||
echo.
|
|
||||||
echo Error: JAVA_HOME not found in your environment. >&2
|
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
|
||||||
echo location of your Java installation. >&2
|
|
||||||
echo.
|
|
||||||
goto error
|
|
||||||
|
|
||||||
:OkJHome
|
|
||||||
if exist "%JAVA_HOME%\bin\java.exe" goto init
|
|
||||||
echo.
|
|
||||||
echo Error: jave.exe not found. in JAVA_HOME>&2
|
|
||||||
echo.
|
|
||||||
goto error
|
|
||||||
|
|
||||||
:init
|
|
||||||
SET JAVA_EXE="%JAVA_HOME%\bin\java.exe"
|
|
||||||
for /f tokens^=2-5^ delims^=.-_^" %%j in ('%JAVA_EXE% -fullversion 2^>^&1') do set "JAVA_VER=%%j%%k"
|
|
||||||
if not %JAVA_VER% LSS 170 goto run
|
|
||||||
echo.
|
|
||||||
echo Error: Java version is lower than 17, please update your Java version. >&2
|
|
||||||
echo.
|
|
||||||
goto error
|
|
||||||
|
|
||||||
:run
|
|
||||||
%JAVA_EXE% -jar aqua.jar
|
|
||||||
if ERRORLEVEL 1 goto error
|
|
||||||
goto end
|
|
||||||
|
|
||||||
|
|
||||||
:error
|
|
||||||
set ERROR_CODE=1
|
|
||||||
|
|
||||||
:end
|
|
||||||
@endlocal & set ERROR_CODE=%ERROR_CODE%
|
|
||||||
pause
|
|
||||||
Reference in New Issue
Block a user