mirror of
https://github.com/MewoLab/AquaDX.git
synced 2026-02-10 16:27:28 +08:00
[F] Fix duplicate uploads
This commit is contained in:
@@ -43,6 +43,14 @@ class UploadUserPlaylogHandler(
|
|||||||
).increment()
|
).increment()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check duplicate
|
||||||
|
val isDup = playlogRepo.findByUser_Card_ExtIdAndMusicIdAndUserPlayDate(
|
||||||
|
req.userId,
|
||||||
|
req.userPlaylog.musicId,
|
||||||
|
req.userPlaylog.userPlayDate
|
||||||
|
).size > 0
|
||||||
|
if (isDup) 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(req.userId).getOrNull()
|
val u = userDataRepository.findByCardExtId(req.userId).getOrNull()
|
||||||
if (u != null) playlogRepo.save(req.userPlaylog.apply { user = u })
|
if (u != null) playlogRepo.save(req.userPlaylog.apply { user = u })
|
||||||
|
|||||||
@@ -99,6 +99,11 @@ interface Mai2UserOptionRepo : Mai2UserLinked<Mai2UserOption>
|
|||||||
|
|
||||||
interface Mai2UserPlaylogRepo : GenericPlaylogRepo<Mai2UserPlaylog>, Mai2UserLinked<Mai2UserPlaylog> {
|
interface Mai2UserPlaylogRepo : GenericPlaylogRepo<Mai2UserPlaylog>, Mai2UserLinked<Mai2UserPlaylog> {
|
||||||
fun findByUser_Card_ExtIdAndMusicIdAndLevel(userId: Long, musicId: Int, level: Int): List<Mai2UserPlaylog>
|
fun findByUser_Card_ExtIdAndMusicIdAndLevel(userId: Long, musicId: Int, level: Int): List<Mai2UserPlaylog>
|
||||||
|
fun findByUser_Card_ExtIdAndMusicIdAndUserPlayDate(
|
||||||
|
userCardExtId: Long,
|
||||||
|
musicId: Int,
|
||||||
|
userPlayDate: String
|
||||||
|
): MutableList<Mai2UserPlaylog>
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Mai2UserPrintDetailRepo : JpaRepository<Mai2UserPrintDetail, Long>
|
interface Mai2UserPrintDetailRepo : JpaRepository<Mai2UserPrintDetail, Long>
|
||||||
|
|||||||
Reference in New Issue
Block a user