[+] MaiMile and UserIntimate (partner closeness)

pull/115/head
Menci 2025-02-01 15:49:40 +08:00 committed by Azalea
parent 9d19c99abe
commit 2ef4b7241d
7 changed files with 44 additions and 2 deletions

View File

@ -6,6 +6,7 @@ import ext.*
import icu.samnyan.aqua.sega.general.PagedHandler import icu.samnyan.aqua.sega.general.PagedHandler
import icu.samnyan.aqua.sega.maimai2.model.response.data.UserRivalMusic import icu.samnyan.aqua.sega.maimai2.model.response.data.UserRivalMusic
import icu.samnyan.aqua.sega.maimai2.model.response.data.UserRivalMusicDetail import icu.samnyan.aqua.sega.maimai2.model.response.data.UserRivalMusicDetail
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserIntimate
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserKaleidx import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserKaleidx
import java.time.LocalDate import java.time.LocalDate
import java.util.* import java.util.*
@ -175,11 +176,15 @@ fun Maimai2ServletController.initApis() {
mapOf("userId" to uid, "rivalId" to rivalId, "nextIndex" to 0, "userRivalMusicList" to res.values) mapOf("userId" to uid, "rivalId" to rivalId, "nextIndex" to 0, "userRivalMusicList" to res.values)
} }
"GetUserIntimate".unpaged {
val u = db.userData.findByCardExtId(uid)() ?: (404 - "User not found")
db.userIntimate.findByUser(u)
}
// Empty List Handlers // Empty List Handlers
"GetUserRegion".unpaged { empty } "GetUserRegion".unpaged { empty }
"GetUserGhost".unpaged { empty } "GetUserGhost".unpaged { empty }
"GetUserFriendBonus" { mapOf("userId" to uid, "returnCode" to 0, "getMiles" to 0) } "GetUserFriendBonus" { mapOf("userId" to uid, "returnCode" to 0, "getMiles" to 0) }
"GetUserIntimate" { mapOf("userId" to uid, "length" to 0, "userIntimateList" to empty) }
"GetTransferFriend" { mapOf("userId" to uid, "transferFriendList" to empty) } "GetTransferFriend" { mapOf("userId" to uid, "transferFriendList" to empty) }
"GetUserNewItem" { mapOf("userId" to uid, "itemKind" to 0, "itemId" to 0) } "GetUserNewItem" { mapOf("userId" to uid, "itemKind" to 0, "itemId" to 0) }

View File

@ -73,7 +73,7 @@ class UpsertUserAllHandler(
listOfNotNull( listOfNotNull(
userExtend, userOption, userCharacterList, userMapList, userLoginBonusList, userItemList, userExtend, userOption, userCharacterList, userMapList, userLoginBonusList, userItemList,
userMusicDetailList, userCourseList, userFriendSeasonRankingList, userFavoriteList, userMusicDetailList, userCourseList, userFriendSeasonRankingList, userFavoriteList,
userKaleidxScopeList userKaleidxScopeList, userIntimateList
) )
}.flatten().forEach { it.user = u } }.flatten().forEach { it.user = u }
@ -134,6 +134,10 @@ class UpsertUserAllHandler(
repos.userKaleidx.saveAll(lst.mapApply { repos.userKaleidx.saveAll(lst.mapApply {
id = repos.userKaleidx.findByUserAndGateId(u, gateId)?.id ?: 0 }) } id = repos.userKaleidx.findByUserAndGateId(u, gateId)?.id ?: 0 }) }
req.userIntimateList?.unique { it.partnerId }?.let { lst ->
repos.userIntimate.saveAll(lst.mapApply {
id = repos.userIntimate.findByUserAndPartnerId(u, partnerId)?.id ?: 0 }) }
// 2024/10/31 Found some user data findByUserAndKindAndActivityId is not unique // 2024/10/31 Found some user data findByUserAndKindAndActivityId is not unique
// I think userActivityList is not important, so I will ignore it // I think userActivityList is not important, so I will ignore it
try { try {

View File

@ -114,6 +114,10 @@ interface MAi2UserKaleidxRepo : Mai2UserLinked<Mai2UserKaleidx> {
fun findByUserAndGateId(user: Mai2UserDetail, gateId: Int): Mai2UserKaleidx? fun findByUserAndGateId(user: Mai2UserDetail, gateId: Int): Mai2UserKaleidx?
} }
interface MAi2UserIntimateRepo : Mai2UserLinked<Mai2UserIntimate> {
fun findByUserAndPartnerId(user: Mai2UserDetail, partnerId: Int): Mai2UserIntimate?
}
interface Mai2GameChargeRepo : JpaRepository<Mai2GameCharge, Long> interface Mai2GameChargeRepo : JpaRepository<Mai2GameCharge, Long>
interface Mai2GameEventRepo : JpaRepository<Mai2GameEvent, Int> { interface Mai2GameEventRepo : JpaRepository<Mai2GameEvent, Int> {
@ -144,6 +148,7 @@ class Mai2Repos(
val userPrintDetail: Mai2UserPrintDetailRepo, val userPrintDetail: Mai2UserPrintDetailRepo,
val userUdemae: Mai2UserUdemaeRepo, val userUdemae: Mai2UserUdemaeRepo,
val userKaleidx: MAi2UserKaleidxRepo, val userKaleidx: MAi2UserKaleidxRepo,
val userIntimate: MAi2UserIntimateRepo,
val gameCharge: Mai2GameChargeRepo, val gameCharge: Mai2GameChargeRepo,
val gameEvent: Mai2GameEventRepo, val gameEvent: Mai2GameEventRepo,
val gameSellingCard: Mai2GameSellingCardRepo val gameSellingCard: Mai2GameSellingCardRepo

View File

@ -36,6 +36,7 @@ public class UserAll implements Serializable {
private List<Map<String, Object>> userGamePlaylogList; private List<Map<String, Object>> userGamePlaylogList;
private List<UserFavoriteItem> userFavoritemusicList; private List<UserFavoriteItem> userFavoritemusicList;
private List<Mai2UserKaleidx> userKaleidxScopeList; private List<Mai2UserKaleidx> userKaleidxScopeList;
private List<Mai2UserIntimate> userIntimateList;
private String isNewCharacterList; private String isNewCharacterList;
private String isNewMapList; private String isNewMapList;
private String isNewLoginBonusList; private String isNewLoginBonusList;

View File

@ -148,6 +148,10 @@ class Mai2UserDetail(
var cmLastEmoneyCredit: Int = 69, var cmLastEmoneyCredit: Int = 69,
var mapStock: Int = 0, var mapStock: Int = 0,
// MaiMile
var point: Int = 0,
var totalPoint: Int = 0,
// TODO: Make these non-nullable with default value // TODO: Make these non-nullable with default value
var currentPlayCount: Int? = 0, var currentPlayCount: Int? = 0,
var renameCredit: Int? = 0 var renameCredit: Int? = 0

View File

@ -597,3 +597,11 @@ class Mai2UserKaleidx : Mai2UserEntity() {
var lastPlayDate: LocalDateTime? = null var lastPlayDate: LocalDateTime? = null
var isInfoWatched = false var isInfoWatched = false
} }
@Table(name = "maimai2_user_intimate")
@Data @Entity
class Mai2UserIntimate : Mai2UserEntity() {
var partnerId = 1;
var intimateLevel = 0;
var intimateCountRewarded = 0;
}

View File

@ -0,0 +1,15 @@
ALTER TABLE maimai2_user_detail
ADD COLUMN point INT DEFAULT 0,
ADD COLUMN total_point INT DEFAULT 0;
CREATE TABLE maimai2_user_intimate
(
id BIGINT AUTO_INCREMENT NOT NULL PRIMARY KEY,
user_id BIGINT NULL,
partner_id INT NOT NULL,
intimate_level INT NOT NULL,
intimate_count_rewarded INT NOT NULL,
CONSTRAINT fku_maimai2_user_intimate FOREIGN KEY (user_id) REFERENCES maimai2_user_detail (id) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT unique_maimai2_user_intimate UNIQUE (user_id, partner_id)
);