mirror of https://github.com/hykilpikonna/AquaDX
[O] Collapse basic handlers
parent
17123fec35
commit
5ea2615b93
|
@ -1,9 +1,9 @@
|
|||
package icu.samnyan.aqua.sega.maimai2
|
||||
|
||||
import ext.API
|
||||
import ext.popAll
|
||||
import ext.*
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler
|
||||
import icu.samnyan.aqua.sega.maimai2.handler.*
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2Repos
|
||||
import org.slf4j.LoggerFactory
|
||||
import org.springframework.web.bind.annotation.*
|
||||
import kotlin.reflect.full.declaredMemberProperties
|
||||
|
@ -15,52 +15,193 @@ import kotlin.reflect.full.declaredMemberProperties
|
|||
@RestController
|
||||
@RequestMapping(path = ["/g/mai2/Maimai2Servlet/", "/g/mai2/"])
|
||||
class Maimai2ServletController(
|
||||
val getGameSetting: GetGameSettingHandler,
|
||||
val getGameEvent: GetGameEventHandler,
|
||||
val getGameRanking: GetGameRankingHandler,
|
||||
val getGameTournamentInfo: GetGameTournamentInfoHandler,
|
||||
val getGameCharge: GetGameChargeHandler,
|
||||
val getTransferFriend: GetTransferFriendHandler,
|
||||
val getUserActivity: GetUserActivityHandler,
|
||||
val userLogin: UserLoginHandler,
|
||||
val getUserData: GetUserDataHandler,
|
||||
val upsertUserAll: UpsertUserAllHandler,
|
||||
val getUserPreview: GetUserPreviewHandler,
|
||||
val getUserCharacter: GetUserCharacterHandler,
|
||||
val getUserOption: GetUserOptionHandler,
|
||||
val getUserItem: GetUserItemHandler,
|
||||
val getUserExtend: GetUserExtendHandler,
|
||||
val getUserGhost: GetUserGhostHandler,
|
||||
val getUserLoginBonus: GetUserLoginBonusHandler,
|
||||
val getUserMap: GetUserMapHandler,
|
||||
val getUserFavorite: GetUserFavoriteHandler,
|
||||
val getUserCard: GetUserCardHandler,
|
||||
val getUserMusic: GetUserMusicHandler,
|
||||
val getUserRating: GetUserRatingHandler,
|
||||
val getUserRegion: GetUserRegionHandler,
|
||||
val getUserCharge: GetUserChargeHandler,
|
||||
val getUserCourse: GetUserCourseHandler,
|
||||
val uploadUserPhoto: UploadUserPhotoHandler,
|
||||
val uploadUserPlaylog: UploadUserPlaylogHandler,
|
||||
val getGameNgMusicId: GetGameNgMusicIdHandler,
|
||||
val getUserFriendSeasonRanking: GetUserFriendSeasonRankingHandler,
|
||||
val getUserPortrait: GetUserPortraitHandler,
|
||||
val uploadUserPortrait: UploadUserPortraitHandler,
|
||||
val cmGetUserPreview: CMGetUserPreviewHandler,
|
||||
val cmGetSellingCard: CMGetSellingCardHandler,
|
||||
val getUserCardPrintError: GetUserCardPrintErrorHandler,
|
||||
val cmGetUserCharacter: CMGetUserCharacterHandler,
|
||||
val upsertUserPrint: UpsertUserPrintHandler,
|
||||
val getUserRecommendRateMusic: GetUserRecommendRateMusicHandler,
|
||||
val getUserRecommendSelectMusic: GetUserRecommendSelectMusicHandler,
|
||||
val getUserFavoriteItem: GetUserFavoriteItemHandler,
|
||||
val getUserRivalData: GetUserRivalDataHandler,
|
||||
val getUserRivalMusic: GetUserRivalMusicHandler,
|
||||
val repos: Mai2Repos
|
||||
) {
|
||||
val logger = LoggerFactory.getLogger(Maimai2ServletController::class.java)
|
||||
companion object {
|
||||
private val logger = LoggerFactory.getLogger(Maimai2ServletController::class.java)
|
||||
private val empty = listOf<Any>()
|
||||
}
|
||||
|
||||
val createToken = BaseHandler { """{"Bearer":"AQUATOKEN"}""" }
|
||||
val cmUpsertUserPrintLog = BaseHandler { """{"returnCode":1,"orderId":"0","serialId":"FAKECARDIMAG12345678"}""" }
|
||||
val getUserExtend = UserReqHandler { _, userId -> mapOf(
|
||||
"userId" to userId,
|
||||
"userExtend" to (repos.userExtend.findSingleByUser_Card_ExtId(userId)() ?: (404 - "User not found"))
|
||||
) }
|
||||
|
||||
val getUserData = UserReqHandler { _, userId -> mapOf(
|
||||
"userId" to userId,
|
||||
"userData" to (repos.userData.findByCardExtId(userId)() ?: (404 - "User not found")),
|
||||
"banState" to 0
|
||||
) }
|
||||
|
||||
val getUserLoginBonus = UserReqHandler { _, userId -> mapOf(
|
||||
"userId" to userId,
|
||||
"nextIndex" to 0,
|
||||
"userLoginBonusList" to repos.userLoginBonus.findByUser_Card_ExtId(userId)
|
||||
) }
|
||||
|
||||
val getUserMap = UserReqHandler { _, userId -> mapOf(
|
||||
"userId" to userId,
|
||||
"nextIndex" to 0,
|
||||
"userMapList" to repos.userMap.findByUser_Card_ExtId(userId)
|
||||
) }
|
||||
|
||||
val getUserMusic = UserReqHandler { _, userId -> mapOf(
|
||||
"userId" to userId,
|
||||
"nextIndex" to 0,
|
||||
"userMusicList" to listOf(mapOf("userMusicDetailList" to repos.userMusicDetail.findByUser_Card_ExtId(userId)))
|
||||
) }
|
||||
|
||||
val getUserCard = UserReqHandler { _, userId -> mapOf(
|
||||
"userId" to userId,
|
||||
"nextIndex" to 0,
|
||||
"userCardList" to repos.userCard.findByUser_Card_ExtId(userId)
|
||||
) }
|
||||
|
||||
val getUserCharacter = UserReqHandler { _, userId -> mapOf(
|
||||
"userId" to userId,
|
||||
"userCharacterList" to repos.userCharacter.findByUser_Card_ExtId(userId)
|
||||
) }
|
||||
|
||||
val getUserCharge = UserReqHandler { _, userId -> repos.userCharge.findByUser_Card_ExtId(userId).let { mapOf(
|
||||
"userId" to userId,
|
||||
"length" to it.size,
|
||||
"userChargeList" to it
|
||||
) } }
|
||||
|
||||
val getUserFriendSeasonRanking = UserReqHandler { _, userId -> mapOf(
|
||||
"userId" to userId,
|
||||
"nextIndex" to 0,
|
||||
"userFriendSeasonRankingList" to repos.userFriendSeasonRanking.findByUser_Card_ExtId(userId)
|
||||
) }
|
||||
|
||||
val getUserCourse = UserReqHandler { _, userId -> mapOf(
|
||||
"userId" to userId,
|
||||
"nextIndex" to 0,
|
||||
"userCourseList" to repos.userCourse.findByUser_Card_ExtId(userId)
|
||||
) }
|
||||
|
||||
val getUserFavorite = UserReqHandler { _, userId -> mapOf(
|
||||
"userId" to userId,
|
||||
"userFavoriteData" to repos.userFavorite.findByUser_Card_ExtId(userId)
|
||||
) }
|
||||
|
||||
val getUserActivity = UserReqHandler { _, userId ->
|
||||
repos.userAct.findByUser_Card_ExtId(userId).let { act -> mapOf(
|
||||
"userActivity" to mapOf(
|
||||
"playList" to act.filter { it.kind == 1 },
|
||||
"musicList" to act.filter { it.kind == 2 }
|
||||
)
|
||||
) }
|
||||
}
|
||||
|
||||
val getGameCharge = BaseHandler { repos.gameCharge.findAll().let {
|
||||
mapOf("length" to it.size, "gameChargeList" to it)
|
||||
} }
|
||||
|
||||
val getGameEvent = BaseHandler {
|
||||
val type = (it["type"] as Number).toInt()
|
||||
mapOf(
|
||||
"type" to type,
|
||||
"gameEventList" to repos.gameEvent.findByEnable(true) // Maimai only request for type 1
|
||||
)
|
||||
}
|
||||
|
||||
val getUserRivalData = UserReqHandler { req, userId ->
|
||||
val rivalId = (req["rivalId"] as Number).toLong()
|
||||
|
||||
mapOf(
|
||||
"userId" to userId,
|
||||
"userRivalData" to mapOf(
|
||||
"rivalId" to rivalId,
|
||||
"rivalName" to (repos.userData.findByCardExtId(rivalId)()?.userName ?: "")
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
val getUserOption = UserReqHandler { _, userId -> mapOf(
|
||||
"userId" to userId,
|
||||
"userOption" to (repos.userOption.findSingleByUser_Card_ExtId(userId)() ?: (404 - "User not found"))
|
||||
) }
|
||||
|
||||
val cmGetSellingCard = BaseHandler { repos.gameSellingCard.findAll().let {
|
||||
mapOf("length" to it.size, "sellingCardList" to it)
|
||||
} }
|
||||
|
||||
val cmGetUserCharacter = UserReqHandler { _, userId -> repos.userCharacter.findByUser_Card_ExtId(userId).let {
|
||||
mapOf(
|
||||
"returnCode" to 1,
|
||||
"length" to it.size,
|
||||
"userCharacterList" to it
|
||||
)
|
||||
} }
|
||||
|
||||
val cmGetUserPreview = UserReqHandler { _, userId -> repos.userData.findByCardExtId(userId)()?.let {
|
||||
mapOf(
|
||||
"userId" to userId,
|
||||
"userName" to it.userName,
|
||||
"rating" to it.playerRating,
|
||||
"lastDataVersion" to "1.20.00",
|
||||
"isLogin" to false,
|
||||
"isExistSellingCard" to false
|
||||
)
|
||||
} }
|
||||
|
||||
val getUserPreview = UserReqHandler { _, userId ->
|
||||
val d = repos.userData.findByCardExtId(userId)() ?: (404 - "User not found")
|
||||
val option = repos.userOption.findSingleByUser_Card_ExtId(userId)()
|
||||
|
||||
mapOf(
|
||||
"userId" to userId,
|
||||
"userName" to d.userName,
|
||||
"isLogin" to false,
|
||||
"lastGameId" to d.lastGameId,
|
||||
"lastDataVersion" to d.lastDataVersion,
|
||||
"lastRomVersion" to d.lastRomVersion,
|
||||
"lastLoginDate" to d.lastPlayDate,
|
||||
"lastPlayDate" to d.lastPlayDate,
|
||||
"playerRating" to d.playerRating,
|
||||
"nameplateId" to d.plateId,
|
||||
"iconId" to d.iconId,
|
||||
"trophyId" to 0,
|
||||
"partnerId" to d.partnerId,
|
||||
"frameId" to d.frameId,
|
||||
"totalAwake" to d.totalAwake,
|
||||
"isNetMember" to d.isNetMember,
|
||||
"dailyBonusDate" to d.dailyBonusDate,
|
||||
"headPhoneVolume" to (option?.headPhoneVolume ?: 0),
|
||||
"dispRate" to (option?.dispRate ?: 0),
|
||||
"isInherit" to false,
|
||||
"banState" to d.banState
|
||||
)
|
||||
}
|
||||
|
||||
// Empty List Handlers
|
||||
val getUserRecommendRateMusic = UserReqHandler { _, userId -> mapOf(
|
||||
"userId" to userId,
|
||||
"userRecommendRateMusicIdList" to empty
|
||||
) }
|
||||
val getUserRecommendSelectMusic = UserReqHandler { _, uid -> mapOf(
|
||||
"userId" to uid,
|
||||
"userRecommendSelectionMusicIdList" to empty
|
||||
) }
|
||||
val getUserCardPrintError = BaseHandler { mapOf("length" to 0, "userPrintDetailList" to empty) }
|
||||
val getUserRegion = UserReqHandler { _, uid -> mapOf("userId" to uid, "length" to 0, "userRegionList" to empty) }
|
||||
val getUserGhost = UserReqHandler { _, uid -> mapOf("userId" to uid, "userGhostList" to empty) }
|
||||
val getTransferFriend = UserReqHandler { _, uid -> mapOf("userId" to uid, "transferFriendList" to empty) }
|
||||
val getGameNgMusicId = BaseHandler { mapOf("length" to 0, "musicIdList" to empty) }
|
||||
val getGameRanking = BaseHandler { mapOf("type" to it["type"].toString(), "gameRankingList" to empty) }
|
||||
val getGameTournamentInfo = BaseHandler { mapOf("length" to 0, "gameTournamentInfoList" to empty) }
|
||||
|
||||
val endpointList = setOf("GetGameEventApi", "GetGameRankingApi", "GetGameSettingApi", "GetGameTournamentInfoApi",
|
||||
"GetTransferFriendApi", "GetUserActivityApi", "GetUserCardApi", "GetUserCharacterApi", "GetUserDataApi",
|
||||
|
@ -81,6 +222,27 @@ class Maimai2ServletController(
|
|||
"UpsertClientSettingApi", "UpsertClientTestmodeApi", "UpsertClientUploadApi", "Ping", "RemoveTokenApi",
|
||||
"CMLoginApi", "CMLogoutApi", "CMUpsertBuyCardApi", "UserLogoutApi", "GetGameMapAreaConditionApi")
|
||||
|
||||
val staticEndpoint = mapOf(
|
||||
"CreateTokenApi" to """{"Bearer":"meow"}""",
|
||||
"CMUpsertUserPrintlogApi" to """{"returnCode":1,"orderId":"0","serialId":"FAKECARDIMAG12345678"}""",
|
||||
"GetGameSettingApi" to mapOf(
|
||||
"isAouAccession" to true,
|
||||
"gameSetting" to mapOf(
|
||||
"isMaintenance" to false,
|
||||
"requestInterval" to 10,
|
||||
"rebootStartTime" to "2099-01-01 23:59:00.0",
|
||||
"rebootEndTime" to "2099-01-01 23:59:00.0",
|
||||
"movieUploadLimit" to 10000,
|
||||
"movieStatus" to 0,
|
||||
"movieServerUri" to "",
|
||||
"deliverServerUri" to "",
|
||||
"oldServerUri" to "",
|
||||
"usbDlServerUri" to "",
|
||||
"rebootInterval" to 0
|
||||
)
|
||||
).toJson()
|
||||
).also { endpointList.popAll(it.keys.toList()) }
|
||||
|
||||
val members = this::class.declaredMemberProperties
|
||||
val handlers: Map<String, BaseHandler> = endpointList.associateWith { api ->
|
||||
val name = api.replace("Api", "").lowercase()
|
||||
|
@ -91,14 +253,22 @@ class Maimai2ServletController(
|
|||
|
||||
@API("/{api}")
|
||||
fun handle(@PathVariable api: String, @RequestBody request: Map<String, Any>): Any {
|
||||
logger.info("Mai2 $api : $request")
|
||||
logger.info("Mai2 < $api : $request")
|
||||
|
||||
if (api in noopEndpoint) {
|
||||
logger.info("Mai2 > $api no-op")
|
||||
return """{"returnCode":1,"apiName":"com.sega.maimai2servlet.api.$api"}"""
|
||||
}
|
||||
|
||||
return handlers[api]?.handle(request) ?: {
|
||||
logger.warn("Mai2 $api not found")
|
||||
if (api in staticEndpoint) {
|
||||
logger.info("Mai2 > $api static")
|
||||
return staticEndpoint[api]!!
|
||||
}
|
||||
|
||||
return handlers[api]?.handle(request)?.let { if (it is String) it else it.toJson() }?.also {
|
||||
if (api !in setOf("GetUserItemApi")) logger.info("Mai2 > $api : $it")
|
||||
} ?: {
|
||||
logger.warn("Mai2 > $api not found")
|
||||
"""{"returnCode":1,"apiName":"com.sega.maimai2servlet.api.$api"}"""
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,47 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.handler;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2GameSellingCardRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2GameSellingCard;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component("Maimai2CMGetSellingCardHandler")
|
||||
public class CMGetSellingCardHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(CMGetSellingCardHandler.class);
|
||||
private final Mai2GameSellingCardRepo gameSellingCardRepository;
|
||||
private final BasicMapper mapper;
|
||||
|
||||
@Autowired
|
||||
public CMGetSellingCardHandler(Mai2GameSellingCardRepo gameSellingCardRepository, BasicMapper mapper) {
|
||||
this.gameSellingCardRepository = gameSellingCardRepository;
|
||||
this.mapper = mapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
|
||||
List<Mai2GameSellingCard> sellingCardList = gameSellingCardRepository.findAll();
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("length", sellingCardList.size());
|
||||
resultMap.put("sellingCardList", sellingCardList);
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
}
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.handler;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserCharacterRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserCharacter;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component("Maimai2CMGetUserCharacterHandler")
|
||||
public class CMGetUserCharacterHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(CMGetUserCharacterHandler.class);
|
||||
|
||||
private final BasicMapper mapper;
|
||||
|
||||
private final Mai2UserCharacterRepo userCharacterRepository;
|
||||
|
||||
public CMGetUserCharacterHandler(BasicMapper mapper, Mai2UserCharacterRepo userCharacterRepository) {
|
||||
this.mapper = mapper;
|
||||
this.userCharacterRepository = userCharacterRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
long userId = ((Number) request.get("userId")).longValue();
|
||||
|
||||
List<Mai2UserCharacter> userCharacterList = userCharacterRepository.findByUser_Card_ExtId(userId);
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("returnCode", 1);
|
||||
resultMap.put("length", userCharacterList.size());
|
||||
resultMap.put("userCharacterList", userCharacterList);
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
}
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.handler;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserDetail;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserDataRepo;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component("Maimai2CMGetUserPreviewHandler")
|
||||
public class CMGetUserPreviewHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(CMGetUserPreviewHandler.class);
|
||||
|
||||
private final BasicMapper mapper;
|
||||
|
||||
private final Mai2UserDataRepo userDataRepository;
|
||||
|
||||
@Autowired
|
||||
public CMGetUserPreviewHandler(BasicMapper mapper, Mai2UserDataRepo userDataRepository) {
|
||||
this.mapper = mapper;
|
||||
this.userDataRepository = userDataRepository;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
Long userId = ((Number) request.get("userId")).longValue();
|
||||
String segaIdAuthKey = String.valueOf(request.get("segaIdAuthKey"));
|
||||
|
||||
Optional<Mai2UserDetail> userDataOptional = userDataRepository.findByCardExtId(userId);
|
||||
|
||||
if (userDataOptional.isPresent()) {
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
Mai2UserDetail user = userDataOptional.get();
|
||||
|
||||
resultMap.put("userName", user.getUserName());
|
||||
resultMap.put("rating", user.getPlayerRating());
|
||||
resultMap.put("lastDataVersion", "1.20.00"); //Hardcode due to outdated release
|
||||
resultMap.put("isLogin", false);
|
||||
resultMap.put("isExistSellingCard", false);
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.handler;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2GameChargeRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2GameCharge;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component("Maimai2GetGameChargeHandler")
|
||||
public class GetGameChargeHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GetGameChargeHandler.class);
|
||||
private final Mai2GameChargeRepo gameChargeRepository;
|
||||
private final BasicMapper mapper;
|
||||
|
||||
@Autowired
|
||||
public GetGameChargeHandler(Mai2GameChargeRepo gameChargeRepository, BasicMapper mapper) {
|
||||
this.gameChargeRepository = gameChargeRepository;
|
||||
this.mapper = mapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
|
||||
List<Mai2GameCharge> gameChargeList = gameChargeRepository.findAll();
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("length", gameChargeList.size());
|
||||
resultMap.put("gameChargeList", gameChargeList);
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
}
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.handler;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2GameEventRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2GameEvent;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component("Maimai2GetGameEventHandler")
|
||||
public class GetGameEventHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GetGameEventHandler.class);
|
||||
|
||||
private final Mai2GameEventRepo gameEventRepository;
|
||||
|
||||
private final BasicMapper mapper;
|
||||
|
||||
public GetGameEventHandler(Mai2GameEventRepo gameEventRepository, BasicMapper mapper) {
|
||||
this.gameEventRepository = gameEventRepository;
|
||||
this.mapper = mapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
int type = ((Number) request.get("type")).intValue();
|
||||
|
||||
// Not sure why maimai2 only do type=1 request
|
||||
List<Mai2GameEvent> gameEventList = gameEventRepository.findByTypeAndEnable(0, true);
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("type", type);
|
||||
resultMap.put("gameEventList", gameEventList);
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
logger.info("Response: length " + json.length());
|
||||
return json;
|
||||
}
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.handler;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component("Maimai2GetGameNgMusicHandler")
|
||||
public class GetGameNgMusicIdHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GetGameNgMusicIdHandler.class);
|
||||
|
||||
private final BasicMapper mapper;
|
||||
|
||||
public GetGameNgMusicIdHandler(BasicMapper mapper) {
|
||||
this.mapper = mapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
|
||||
List<Object> musicIdList = new ArrayList<>();
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("length", 0);
|
||||
resultMap.put("musicIdList", musicIdList);
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
}
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.handler;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component("Maimai2GetGameRankingHandler")
|
||||
public class GetGameRankingHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GetGameRankingHandler.class);
|
||||
|
||||
private final BasicMapper mapper;
|
||||
|
||||
public GetGameRankingHandler(BasicMapper mapper) {
|
||||
this.mapper = mapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
String type = Integer.toString((int) request.get("type"));
|
||||
|
||||
List<Object> gameRankingList = new ArrayList<>();
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("type", type);
|
||||
resultMap.put("gameRankingList", gameRankingList);
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
}
|
||||
}
|
|
@ -1,67 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.handler;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.response.GetGameSettingResp;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.response.data.GameSetting;
|
||||
import icu.samnyan.aqua.sega.general.dao.PropertyEntryRepository;
|
||||
import icu.samnyan.aqua.sega.general.model.PropertyEntry;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component("Maimai2GetGameSettingHandler")
|
||||
public class GetGameSettingHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GetGameSettingHandler.class);
|
||||
|
||||
private final BasicMapper mapper;
|
||||
|
||||
private final PropertyEntryRepository propertyEntryRepository;
|
||||
|
||||
@Autowired
|
||||
public GetGameSettingHandler(BasicMapper mapper, PropertyEntryRepository propertyEntryRepository) {
|
||||
this.mapper = mapper;
|
||||
this.propertyEntryRepository = propertyEntryRepository;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
|
||||
PropertyEntry start = propertyEntryRepository.findByPropertyKey("reboot_start_time")
|
||||
.orElseGet(() -> new PropertyEntry("reboot_start_time", "2020-01-01 23:59:00.0"));
|
||||
PropertyEntry end = propertyEntryRepository.findByPropertyKey("reboot_end_time")
|
||||
.orElseGet(() -> new PropertyEntry("reboot_end_time", "2020-01-01 23:59:00.0"));
|
||||
|
||||
GameSetting gameSetting = new GameSetting(
|
||||
false,
|
||||
10,
|
||||
start.getPropertyValue(),
|
||||
end.getPropertyValue(),
|
||||
10000,
|
||||
0,
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
0);
|
||||
|
||||
GetGameSettingResp resp = new GetGameSettingResp(
|
||||
true,
|
||||
gameSetting
|
||||
);
|
||||
|
||||
String json = mapper.write(resp);
|
||||
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
}
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.handler;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component("Maimai2GetGameTournamentInfoHandler")
|
||||
public class GetGameTournamentInfoHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GetGameTournamentInfoHandler.class);
|
||||
|
||||
//private final GameEventRepository gameEventRepository;
|
||||
|
||||
private final BasicMapper mapper;
|
||||
|
||||
public GetGameTournamentInfoHandler(BasicMapper mapper) {
|
||||
this.mapper = mapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
|
||||
List<Object> gameTournamentInfoList = new ArrayList<>();
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("length", 0);
|
||||
resultMap.put("gameTournamentInfoList", gameTournamentInfoList);
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
}
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.handler;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component("Maimai2GetTransferFriendHandler")
|
||||
public class GetTransferFriendHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GetTransferFriendHandler.class);
|
||||
|
||||
private final BasicMapper mapper;
|
||||
|
||||
public GetTransferFriendHandler(BasicMapper mapper) {
|
||||
this.mapper = mapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
long userId = ((Number) request.get("userId")).longValue();
|
||||
|
||||
List<Object> transferFriendList = new ArrayList<>();
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("userId", userId);
|
||||
resultMap.put("transferFriendList", transferFriendList);
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
}
|
||||
}
|
|
@ -1,55 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.handler;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserActRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.response.data.UserActivity;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserAct;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component("Maimai2GetUserActivityHandler")
|
||||
public class GetUserActivityHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GetUserActivityHandler.class);
|
||||
|
||||
private final BasicMapper mapper;
|
||||
|
||||
private final Mai2UserActRepo userActRepository;
|
||||
|
||||
public GetUserActivityHandler(BasicMapper mapper, Mai2UserActRepo userActRepository) {
|
||||
this.mapper = mapper;
|
||||
this.userActRepository = userActRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
long userId = ((Number) request.get("userId")).longValue();
|
||||
|
||||
// kind 1 = playList, kind 2 = musicList
|
||||
// maimaiDX require these two
|
||||
List<Mai2UserAct> userPlayList = userActRepository.findByUser_Card_ExtIdAndKind(userId, 1);
|
||||
List<Mai2UserAct> userMusicList = userActRepository.findByUser_Card_ExtIdAndKind(userId, 2);
|
||||
|
||||
UserActivity userActivity = new UserActivity();
|
||||
userActivity.setMusicList(userMusicList);
|
||||
userActivity.setPlayList(userPlayList);
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("userActivity", userActivity);
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
}
|
||||
}
|
|
@ -1,56 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.handler;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserCardRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserCard;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component("Maimai2GetUserCardHandler")
|
||||
public class GetUserCardHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GetUserDataHandler.class);
|
||||
|
||||
private final BasicMapper mapper;
|
||||
|
||||
private final Mai2UserCardRepo userCardRepository;
|
||||
|
||||
public GetUserCardHandler(Mai2UserCardRepo userCardRepository, BasicMapper mapper) {
|
||||
this.mapper = mapper;
|
||||
this.userCardRepository = userCardRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
long userId = ((Number) request.get("userId")).longValue();
|
||||
int nextIndex = ((Number) request.get("nextIndex")).intValue();
|
||||
int maxCount = ((Number) request.get("maxCount")).intValue();
|
||||
|
||||
int pageNum = nextIndex / maxCount;
|
||||
|
||||
Page<Mai2UserCard> dbPage = userCardRepository.findByUser_Card_ExtId(userId, PageRequest.of(pageNum, maxCount));
|
||||
|
||||
int currentIndex = maxCount * pageNum + dbPage.getNumberOfElements();
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("userId", userId);
|
||||
resultMap.put("nextIndex", dbPage.getNumberOfElements() < maxCount ? 0 : currentIndex);
|
||||
resultMap.put("userCardList", dbPage.getContent());
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
}
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.handler;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component("Maimai2GetUserCardPrintErrorHandler")
|
||||
public class GetUserCardPrintErrorHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GetUserCardPrintErrorHandler.class);
|
||||
private final BasicMapper mapper;
|
||||
|
||||
@Autowired
|
||||
public GetUserCardPrintErrorHandler(BasicMapper mapper) {
|
||||
this.mapper = mapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
Long userId = ((Number) request.get("userId")).longValue();
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("length", 0);
|
||||
resultMap.put("userPrintDetailList", List.of());
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
}
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.handler;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserCharacterRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserCharacter;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component("Maimai2GetUserCharacterHandler")
|
||||
public class GetUserCharacterHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GetUserCharacterHandler.class);
|
||||
|
||||
private final BasicMapper mapper;
|
||||
|
||||
private final Mai2UserCharacterRepo userCharacterRepository;
|
||||
|
||||
public GetUserCharacterHandler(BasicMapper mapper, Mai2UserCharacterRepo userCharacterRepository) {
|
||||
this.mapper = mapper;
|
||||
this.userCharacterRepository = userCharacterRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
long userId = ((Number) request.get("userId")).longValue();
|
||||
|
||||
List<Mai2UserCharacter> userCharacterList = userCharacterRepository.findByUser_Card_ExtId(userId);
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("userId", userId);
|
||||
resultMap.put("userCharacterList", userCharacterList);
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
logger.info("Response: length " + json.length());
|
||||
return json;
|
||||
}
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.handler;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserChargeRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserCharge;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component("Maimai2GetUserChargeHandler")
|
||||
public class GetUserChargeHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GetUserCharacterHandler.class);
|
||||
|
||||
private final BasicMapper mapper;
|
||||
|
||||
private final Mai2UserChargeRepo UserChargeRepository;
|
||||
|
||||
public GetUserChargeHandler(BasicMapper mapper, Mai2UserChargeRepo UserChargeRepository) {
|
||||
this.mapper = mapper;
|
||||
this.UserChargeRepository = UserChargeRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
long userId = ((Number) request.get("userId")).longValue();
|
||||
|
||||
List<Mai2UserCharge> userChargeList = UserChargeRepository.findByUser_Card_ExtId(userId);
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("userId", userId);
|
||||
resultMap.put("length", userChargeList.size());
|
||||
resultMap.put("userChargeList", userChargeList);
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
}
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.handler;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserCourseRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserCourse;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component("Maimai2GetUserCourseHandler")
|
||||
public class GetUserCourseHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GetUserMusicHandler.class);
|
||||
|
||||
private final BasicMapper mapper;
|
||||
|
||||
private final Mai2UserCourseRepo userCourseRepository;
|
||||
|
||||
public GetUserCourseHandler(BasicMapper mapper, Mai2UserCourseRepo userCourseRepository) {
|
||||
this.mapper = mapper;
|
||||
this.userCourseRepository = userCourseRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
long userId = ((Number) request.get("userId")).longValue();
|
||||
int nextIndexVal = ((Number) request.get("nextIndex")).intValue();
|
||||
|
||||
//TODO: find what game actually wants. Stub value 10 used for now.
|
||||
int maxCount = 10;
|
||||
|
||||
int pageNum = nextIndexVal / maxCount;
|
||||
|
||||
Page<Mai2UserCourse> dbPage = userCourseRepository.findByUser_Card_ExtId(userId, PageRequest.of(pageNum, maxCount));
|
||||
|
||||
long currentIndex = maxCount * pageNum + dbPage.getNumberOfElements();
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("userId", userId);
|
||||
resultMap.put("nextIndex", dbPage.getNumberOfElements() < maxCount ? 0 : currentIndex);
|
||||
|
||||
resultMap.put("userCourseList", dbPage.getContent());
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
}
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.handler
|
||||
|
||||
import ext.invoke
|
||||
import ext.minus
|
||||
import ext.toJson
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2Repos
|
||||
import org.slf4j.Logger
|
||||
import org.slf4j.LoggerFactory
|
||||
import org.springframework.stereotype.Component
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component("Maimai2GetUserDataHandler")
|
||||
class GetUserDataHandler(val repos: Mai2Repos) : BaseHandler {
|
||||
override fun handle(request: Map<String, Any>): String {
|
||||
val userId = (request["userId"] as Number).toLong()
|
||||
|
||||
val userData = repos.userData.findByCardExtId(userId)() ?: (404 - "User Data Not Found")
|
||||
val resultMap = mapOf(
|
||||
"userId" to userId,
|
||||
"userData" to userData,
|
||||
"banState" to userData.banState
|
||||
)
|
||||
|
||||
val json = resultMap.toJson()
|
||||
logger.info("Response: $json")
|
||||
return json
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val logger = LoggerFactory.getLogger(GetUserDataHandler::class.java)
|
||||
}
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.handler
|
||||
|
||||
import ext.invoke
|
||||
import ext.minus
|
||||
import ext.toJson
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2Repos
|
||||
import org.slf4j.LoggerFactory
|
||||
import org.springframework.stereotype.Component
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component("Maimai2GetUserExtendHandler")
|
||||
class GetUserExtendHandler(val repos: Mai2Repos) : BaseHandler {
|
||||
override fun handle(request: Map<String, Any>): Any {
|
||||
val userId = (request["userId"] as Number).toLong()
|
||||
|
||||
val userExtend = repos.userExtend.findSingleByUser_Card_ExtId(userId)() ?: (404 - "User Extend Not Found")
|
||||
val resultMap = mapOf(
|
||||
"userId" to userId,
|
||||
"userExtend" to userExtend
|
||||
)
|
||||
|
||||
val json = resultMap.toJson()
|
||||
logger.info("Response: $json")
|
||||
return json
|
||||
}
|
||||
|
||||
companion object {
|
||||
val logger = LoggerFactory.getLogger(GetUserExtendHandler::class.java)
|
||||
}
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.handler;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserFavoriteRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserFavorite;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component("Maimai2GetUserFavoriteHandler")
|
||||
public class GetUserFavoriteHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GetUserFavoriteHandler.class);
|
||||
|
||||
private final BasicMapper mapper;
|
||||
|
||||
private final Mai2UserFavoriteRepo userFavoriteRepository;
|
||||
|
||||
public GetUserFavoriteHandler(BasicMapper mapper, Mai2UserFavoriteRepo userFavoriteRepository) {
|
||||
this.mapper = mapper;
|
||||
this.userFavoriteRepository = userFavoriteRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
long userId = ((Number) request.get("userId")).longValue();
|
||||
int itemKind = ((Number) request.get("itemKind")).intValue();
|
||||
|
||||
List<Mai2UserFavorite> userFavoriteList = userFavoriteRepository.findByUserIdAndItemKind(userId, itemKind);
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("userId", userId);
|
||||
resultMap.put("userFavoriteData", userFavoriteList);
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
}
|
||||
}
|
|
@ -1,74 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.handler;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.response.data.UserFavoriteItem;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserGeneralData;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserGeneralDataRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.util.jackson.StringMapper;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("Maimai2GetUserFavoriteItemHandler")
|
||||
public class GetUserFavoriteItemHandler implements BaseHandler {
|
||||
private static final Logger logger = LoggerFactory
|
||||
.getLogger(GetUserFavoriteItemHandler.class);
|
||||
|
||||
private final StringMapper mapper;
|
||||
private final Mai2UserGeneralDataRepo userGeneralDataRepository;
|
||||
|
||||
@Autowired
|
||||
public GetUserFavoriteItemHandler(StringMapper mapper, Mai2UserGeneralDataRepo userGeneralDataRepository) {
|
||||
this.mapper = mapper;
|
||||
this.userGeneralDataRepository = userGeneralDataRepository;
|
||||
}
|
||||
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
long userId = ((Number) request.get("userId")).longValue();
|
||||
int kind = ((Number) request.get("kind")).intValue();
|
||||
|
||||
Optional<Mai2UserGeneralData> favOptional;
|
||||
List<UserFavoriteItem> items = new LinkedList<>();
|
||||
switch (kind) {
|
||||
case 1:
|
||||
favOptional = this.userGeneralDataRepository.findByUser_Card_ExtIdAndPropertyKey(userId,
|
||||
"favorite_music");
|
||||
break;
|
||||
case 2:
|
||||
favOptional = this.userGeneralDataRepository.findByUser_Card_ExtIdAndPropertyKey(userId, "favorite_rival");
|
||||
break;
|
||||
default:
|
||||
favOptional = Optional.empty();
|
||||
break;
|
||||
}
|
||||
if (favOptional.isPresent()) {
|
||||
String val = ((Mai2UserGeneralData) favOptional.get()).getPropertyValue();
|
||||
if (StringUtils.isNotBlank(val)) {
|
||||
String[] records = val.split(",");
|
||||
int order = 0;
|
||||
for (String record : records) {
|
||||
items.add(new UserFavoriteItem(Integer.parseInt(record), order));
|
||||
order += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("userId", userId);
|
||||
resultMap.put("kind", Integer.valueOf(kind));
|
||||
resultMap.put("length", Integer.valueOf(items.size()));
|
||||
resultMap.put("nextIndex", Integer.valueOf(0));
|
||||
resultMap.put("userFavoriteItemList", items);
|
||||
String json = this.mapper.write(resultMap);
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.handler
|
||||
|
||||
import ext.invoke
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2Repos
|
||||
import org.springframework.stereotype.Component
|
||||
import java.util.*
|
||||
|
||||
@Component("Maimai2GetUserFavoriteItemHandler")
|
||||
class GetUserFavoriteItemHandler(val repos: Mai2Repos) : BaseHandler {
|
||||
override fun handle(request: Map<String, Any>): Any {
|
||||
val userId = (request["userId"] as Number).toLong()
|
||||
val kind = (request["kind"] as Number).toInt()
|
||||
|
||||
val items = when (kind) {
|
||||
1 -> repos.userGeneralData.findByUser_Card_ExtIdAndPropertyKey(userId, "favorite_music")
|
||||
2 -> repos.userGeneralData.findByUser_Card_ExtIdAndPropertyKey(userId, "favorite_rival")
|
||||
else -> Optional.empty()
|
||||
}()?.let { fav ->
|
||||
val v = fav.propertyValue
|
||||
if (v.isNotBlank()) v.split(",").dropLastWhile { it.isEmpty() }.mapIndexed { i, record ->
|
||||
mapOf("id" to record.toInt(), "orderId" to i) }
|
||||
else null
|
||||
} ?: emptyList()
|
||||
|
||||
return mapOf(
|
||||
"userId" to userId,
|
||||
"kind" to kind,
|
||||
"length" to items.size,
|
||||
"nextIndex" to 0,
|
||||
"userFavoriteItemList" to items
|
||||
)
|
||||
}
|
||||
}
|
|
@ -1,56 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.handler;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserFriendSeasonRankingRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserFriendSeasonRanking;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component("Maimai2GetUserFriendSeasonRankingHandler")
|
||||
public class GetUserFriendSeasonRankingHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GetUserFriendSeasonRankingHandler.class);
|
||||
|
||||
private final BasicMapper mapper;
|
||||
|
||||
private final Mai2UserFriendSeasonRankingRepo userFriendSeasonRankingRepository;
|
||||
|
||||
public GetUserFriendSeasonRankingHandler(BasicMapper mapper, Mai2UserFriendSeasonRankingRepo userFriendSeasonRankingRepository) {
|
||||
this.mapper = mapper;
|
||||
this.userFriendSeasonRankingRepository = userFriendSeasonRankingRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
long userId = ((Number) request.get("userId")).longValue();
|
||||
int nextIndexVal = ((Number) request.get("nextIndex")).intValue();
|
||||
int maxCount = ((Number) request.get("maxCount")).intValue();
|
||||
|
||||
int pageNum = nextIndexVal / maxCount;
|
||||
|
||||
Page<Mai2UserFriendSeasonRanking> dbPage = userFriendSeasonRankingRepository.findByUser_Card_ExtId(userId, PageRequest.of(pageNum, maxCount));
|
||||
|
||||
long currentIndex = maxCount * pageNum + dbPage.getNumberOfElements();
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("userId", userId);
|
||||
resultMap.put("nextIndex", dbPage.getNumberOfElements() < maxCount ? 0 : currentIndex);
|
||||
|
||||
resultMap.put("userFriendSeasonRankingList", dbPage.getContent());
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
}
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.handler;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component("Maimai2GetUserGhostHandler")
|
||||
public class GetUserGhostHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GetUserDataHandler.class);
|
||||
|
||||
private final BasicMapper mapper;
|
||||
|
||||
public GetUserGhostHandler(BasicMapper mapper) {
|
||||
this.mapper = mapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
long userId = ((Number) request.get("userId")).longValue();
|
||||
|
||||
List<Object> userGhostList = new ArrayList<>();
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("userId", userId);
|
||||
resultMap.put("userGhostList", userGhostList);
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.handler
|
||||
|
||||
import ext.toJson
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2Repos
|
||||
import org.slf4j.Logger
|
||||
import org.slf4j.LoggerFactory
|
||||
import org.springframework.stereotype.Component
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component("Maimai2GetUserLoginBonusHandler")
|
||||
class GetUserLoginBonusHandler(val repos: Mai2Repos) : BaseHandler {
|
||||
override fun handle(request: Map<String, Any>): String {
|
||||
val userId = (request["userId"] as Number).toLong()
|
||||
|
||||
val resultMap = mapOf(
|
||||
"userId" to userId,
|
||||
"nextIndex" to 0,
|
||||
"userLoginBonusList" to repos.userLoginBonus.findByUser_Card_ExtId(userId)
|
||||
)
|
||||
|
||||
val json = resultMap.toJson()
|
||||
logger.info("Response: $json")
|
||||
return json
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val logger = LoggerFactory.getLogger(GetUserLoginBonusHandler::class.java)
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.handler
|
||||
|
||||
import ext.toJson
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2Repos
|
||||
import org.slf4j.LoggerFactory
|
||||
import org.springframework.stereotype.Component
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component("Maimai2GetUserMapHandler")
|
||||
class GetUserMapHandler(val repos: Mai2Repos) : BaseHandler {
|
||||
override fun handle(request: Map<String, Any>): String {
|
||||
val userId = (request["userId"] as Number).toLong()
|
||||
|
||||
val resultMap = mapOf(
|
||||
"userId" to userId,
|
||||
"nextIndex" to 0,
|
||||
"userMapList" to repos.userMap.findByUser_Card_ExtId(userId)
|
||||
)
|
||||
|
||||
val json = resultMap.toJson()
|
||||
logger.info("Response: $json")
|
||||
return json
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val logger = LoggerFactory.getLogger(GetUserMapHandler::class.java)
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.handler
|
||||
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2Repos
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper
|
||||
import org.slf4j.Logger
|
||||
import org.slf4j.LoggerFactory
|
||||
import org.springframework.stereotype.Component
|
||||
|
||||
@Component("Maimai2GetUserMusicHandler")
|
||||
class GetUserMusicHandler(
|
||||
val mapper: BasicMapper,
|
||||
val repos: Mai2Repos
|
||||
) : BaseHandler {
|
||||
override fun handle(request: Map<String, Any>): Any {
|
||||
val userId = (request["userId"] as Number).toLong()
|
||||
|
||||
val db = repos.userMusicDetail.findByUser_Card_ExtId(userId)
|
||||
|
||||
logger.info("Response: ${db.size} music records")
|
||||
return mapOf(
|
||||
"userId" to userId,
|
||||
"nextIndex" to 0,
|
||||
"userMusicList" to listOf(mapOf("userMusicDetailList" to db))
|
||||
)
|
||||
}
|
||||
|
||||
companion object {
|
||||
val logger = LoggerFactory.getLogger(GetUserMusicHandler::class.java)
|
||||
}
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.handler;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserOptionRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserOption;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component("Maimai2GetUserOptionHandler")
|
||||
public class GetUserOptionHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GetUserOptionHandler.class);
|
||||
|
||||
private final BasicMapper mapper;
|
||||
|
||||
private final Mai2UserOptionRepo userOptionRepository;
|
||||
|
||||
public GetUserOptionHandler(BasicMapper mapper, Mai2UserOptionRepo userOptionRepository) {
|
||||
this.mapper = mapper;
|
||||
this.userOptionRepository = userOptionRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
long userId = ((Number) request.get("userId")).longValue();
|
||||
|
||||
Mai2UserOption userOption = userOptionRepository.findSingleByUser_Card_ExtId(userId).orElseThrow();
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("userId", userId);
|
||||
resultMap.put("userOption", userOption);
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
}
|
||||
}
|
|
@ -1,82 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.handler;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserDataRepo;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserOptionRepo;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.response.GetUserPreviewResp;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserDetail;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserOption;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component("Maimai2GetUserPreviewHandler")
|
||||
public class GetUserPreviewHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GetUserPreviewHandler.class);
|
||||
|
||||
private final BasicMapper mapper;
|
||||
|
||||
private final Mai2UserDataRepo userDataRepository;
|
||||
private final Mai2UserOptionRepo userOptionRepository;
|
||||
|
||||
public GetUserPreviewHandler(BasicMapper mapper, Mai2UserDataRepo userDataRepository, Mai2UserOptionRepo userOptionRepository) {
|
||||
this.mapper = mapper;
|
||||
this.userDataRepository = userDataRepository;
|
||||
this.userOptionRepository = userOptionRepository;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
long userId = ((Number) request.get("userId")).longValue();
|
||||
|
||||
Optional<Mai2UserDetail> userDataOptional = userDataRepository.findByCardExtId(userId);
|
||||
|
||||
GetUserPreviewResp resp = new GetUserPreviewResp();
|
||||
resp.setUserId(userId);
|
||||
String json;
|
||||
if (userDataOptional.isPresent() && userDataOptional.get().getUserName() != null) {
|
||||
Mai2UserDetail user = userDataOptional.get();
|
||||
Optional<Mai2UserOption> userOptionOptional = userOptionRepository.findSingleByUser_Card_ExtId(userId);
|
||||
resp.setUserName(user.getUserName());
|
||||
resp.setLogin(false);
|
||||
resp.setLastGameId(user.getLastGameId());
|
||||
resp.setLastDataVersion(user.getLastDataVersion());
|
||||
resp.setLastRomVersion(user.getLastRomVersion());
|
||||
resp.setLastLoginDate(user.getLastPlayDate());
|
||||
resp.setLastPlayDate(user.getLastPlayDate());
|
||||
resp.setPlayerRating(user.getPlayerRating());
|
||||
resp.setNameplateId(user.getPlateId());
|
||||
resp.setIconId(user.getIconId());
|
||||
resp.setTrophyId(0);
|
||||
resp.setPartnerId(user.getPartnerId());
|
||||
resp.setFrameId(user.getFrameId());
|
||||
resp.setTotalAwake(user.getTotalAwake());
|
||||
resp.setIsNetMember(user.isNetMember());
|
||||
resp.setDailyBonusDate(user.getDailyBonusDate());
|
||||
if (userOptionOptional.isPresent()) {
|
||||
Mai2UserOption option = userOptionOptional.get();
|
||||
resp.setHeadPhoneVolume(option.getHeadPhoneVolume());
|
||||
resp.setDispRate(option.getDispRate());
|
||||
}
|
||||
resp.setInherit(false);
|
||||
resp.setBanState(user.getBanState());
|
||||
|
||||
json = mapper.write(resp);
|
||||
} else {
|
||||
json = "{}";
|
||||
}
|
||||
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
}
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.handler
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException
|
||||
import ext.invoke
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2Repos
|
||||
|
@ -8,10 +7,7 @@ import icu.samnyan.aqua.sega.maimai2.model.response.data.UserRating
|
|||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserRate
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserUdemae
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper
|
||||
import org.slf4j.Logger
|
||||
import org.slf4j.LoggerFactory
|
||||
import org.springframework.stereotype.Component
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
|
@ -21,8 +17,7 @@ class GetUserRatingHandler(
|
|||
val mapper: BasicMapper,
|
||||
val repos: Mai2Repos
|
||||
) : BaseHandler {
|
||||
@Throws(JsonProcessingException::class)
|
||||
override fun handle(request: Map<String, Any>): String {
|
||||
override fun handle(request: Map<String, Any>): Any {
|
||||
val userId = (request["userId"] as Number?)!!.toLong()
|
||||
val empty: List<Mai2UserRate> = ArrayList()
|
||||
|
||||
|
@ -48,22 +43,14 @@ class GetUserRatingHandler(
|
|||
|
||||
ur.udemae = repos.userUdemae.findSingleByUser_Card_ExtId(userId)() ?: Mai2UserUdemae()
|
||||
|
||||
val resultMap = mapOf(
|
||||
return mapOf(
|
||||
"userId" to userId,
|
||||
"userRating" to ur
|
||||
)
|
||||
|
||||
val json = mapper.write(resultMap)
|
||||
logger.info("Response: $json")
|
||||
return json
|
||||
}
|
||||
|
||||
fun loadRateData(value: String) = value.split(",").filter { it.isNotBlank() }.map {
|
||||
val (musicId, level, beforeRating, afterRating) = it.split(":")
|
||||
Mai2UserRate(musicId.toInt(), level.toInt(), beforeRating.toInt(), afterRating.toInt())
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val logger: Logger = LoggerFactory.getLogger(GetUserRatingHandler::class.java)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.handler;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component("Maimai2GetUserRecommendRateMusicHandler")
|
||||
public class GetUserRecommendRateMusicHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GetUserDataHandler.class);
|
||||
|
||||
private final BasicMapper mapper;
|
||||
|
||||
public GetUserRecommendRateMusicHandler(BasicMapper mapper) {
|
||||
this.mapper = mapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
long userId = ((Number) request.get("userId")).longValue();
|
||||
|
||||
List<Object> userRecommendRateMusicIdList = new ArrayList<>();
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("userId", userId);
|
||||
resultMap.put("userRecommendRateMusicIdList", userRecommendRateMusicIdList);
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
}
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.handler;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component("Maimai2GetUserRecommendSelectMusicHandler")
|
||||
public class GetUserRecommendSelectMusicHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GetUserDataHandler.class);
|
||||
|
||||
private final BasicMapper mapper;
|
||||
|
||||
public GetUserRecommendSelectMusicHandler(BasicMapper mapper) {
|
||||
this.mapper = mapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
long userId = ((Number) request.get("userId")).longValue();
|
||||
|
||||
List<Object> userRecommendSelectionMusicIdList = new ArrayList<>();
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("userId", userId);
|
||||
resultMap.put("userRecommendSelectionMusicIdList", userRecommendSelectionMusicIdList);
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
}
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.handler;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component("Maimai2GetUserRegionHandler")
|
||||
public class GetUserRegionHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GetUserDataHandler.class);
|
||||
|
||||
private final BasicMapper mapper;
|
||||
|
||||
public GetUserRegionHandler(BasicMapper mapper) {
|
||||
this.mapper = mapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
long userId = ((Number) request.get("userId")).longValue();
|
||||
|
||||
List<Object> userRegionList = new ArrayList<>();
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("userId", userId);
|
||||
resultMap.put("length", 0);
|
||||
resultMap.put("userRegionList", userRegionList);
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
}
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.handler;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2UserDataRepo;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.response.data.UserRivalData;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserDetail;
|
||||
import icu.samnyan.aqua.sega.util.jackson.StringMapper;
|
||||
|
||||
@Component("Maimai2GetUserRivalDataHandler")
|
||||
public class GetUserRivalDataHandler implements BaseHandler {
|
||||
private static final Logger logger = LoggerFactory
|
||||
.getLogger(GetUserRivalDataHandler.class);
|
||||
|
||||
private final StringMapper mapper;
|
||||
private final Mai2UserDataRepo userDataRepository;
|
||||
|
||||
@Autowired
|
||||
public GetUserRivalDataHandler(StringMapper mapper, Mai2UserDataRepo userDataRepository) {
|
||||
this.mapper = mapper;
|
||||
this.userDataRepository = userDataRepository;
|
||||
}
|
||||
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
long userId = ((Number) request.get("userId")).longValue();
|
||||
long rivalId = ((Number) request.get("rivalId")).intValue();
|
||||
|
||||
Optional<Mai2UserDetail> detailOptional = userDataRepository.findByCardExtId(rivalId);
|
||||
UserRivalData rivalData;
|
||||
if (detailOptional.isPresent()) {
|
||||
rivalData = new UserRivalData(rivalId, detailOptional.get().getUserName());
|
||||
} else {
|
||||
rivalData = new UserRivalData(rivalId, "");
|
||||
}
|
||||
|
||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||
resultMap.put("userId", userId);
|
||||
resultMap.put("userRivalData", rivalData);
|
||||
|
||||
String json = this.mapper.write(resultMap);
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.handler
|
||||
|
||||
import ext.invoke
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler
|
||||
import icu.samnyan.aqua.sega.maimai2.model.Mai2Repos
|
||||
import org.slf4j.Logger
|
||||
import org.slf4j.LoggerFactory
|
||||
import org.springframework.stereotype.Component
|
||||
|
||||
@Component("Maimai2GetUserRivalDataHandler")
|
||||
class GetUserRivalDataHandler(val repos: Mai2Repos) : BaseHandler {
|
||||
override fun handle(request: Map<String, Any>): Any {
|
||||
val userId = (request["userId"] as Number).toLong()
|
||||
val rivalId = (request["rivalId"] as Number).toLong()
|
||||
|
||||
return mapOf(
|
||||
"userId" to userId,
|
||||
"userRivalData" to mapOf(
|
||||
"rivalId" to rivalId,
|
||||
"rivalName" to (repos.userData.findByCardExtId(rivalId)()?.userName ?: "")
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
|
@ -39,8 +39,8 @@ public class GetUserRivalMusicHandler implements BaseHandler {
|
|||
long rivalId = ((Number) request.get("rivalId")).intValue();
|
||||
|
||||
List<Mai2UserMusicDetail> details = userMusicDetailRepository.findByUser_Card_ExtId(rivalId);
|
||||
List<UserRivalMusic> userRivalMusicList = new LinkedList<UserRivalMusic>();
|
||||
Map<Integer, UserRivalMusic> userRivalMusicMap = new HashMap<Integer, UserRivalMusic>();
|
||||
List<UserRivalMusic> userRivalMusicList = new LinkedList<>();
|
||||
Map<Integer, UserRivalMusic> userRivalMusicMap = new HashMap<>();
|
||||
for (Mai2UserMusicDetail detail : details) {
|
||||
int musicId = detail.getMusicId();
|
||||
UserRivalMusic info = userRivalMusicMap.getOrDefault(musicId, null);
|
||||
|
@ -61,8 +61,6 @@ public class GetUserRivalMusicHandler implements BaseHandler {
|
|||
resultMap.put("nextIndex", 0);
|
||||
resultMap.put("userRivalMusicList", userRivalMusicList);
|
||||
|
||||
String json = this.mapper.write(resultMap);
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
return mapper.write(resultMap);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserCard;
|
|||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserDetail;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.Mai2UserPrintDetail;
|
||||
import icu.samnyan.aqua.sega.util.jackson.BasicMapper;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -24,6 +25,7 @@ import java.util.Optional;
|
|||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Component("Maimai2UpsertUserPrintHandler")
|
||||
@AllArgsConstructor
|
||||
public class UpsertUserPrintHandler implements BaseHandler {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(UpsertUserPrintHandler.class);
|
||||
|
@ -33,14 +35,6 @@ public class UpsertUserPrintHandler implements BaseHandler {
|
|||
private final Mai2UserPrintDetailRepo userPrintDetailRepository;
|
||||
private final Mai2UserDataRepo userDataRepository;
|
||||
|
||||
@Autowired
|
||||
public UpsertUserPrintHandler(BasicMapper mapper, Mai2UserPrintDetailRepo userPrintDetailRepository, Mai2UserCardRepo userCardRepository, Mai2UserDataRepo userDataRepository) {
|
||||
this.mapper = mapper;
|
||||
this.userPrintDetailRepository = userPrintDetailRepository;
|
||||
this.userCardRepository = userCardRepository;
|
||||
this.userDataRepository = userDataRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
long userId = ((Number) request.get("userId")).longValue();
|
||||
|
@ -83,8 +77,6 @@ public class UpsertUserPrintHandler implements BaseHandler {
|
|||
resultMap.put("startDate", "2019-01-01 00:00:00.000000");
|
||||
resultMap.put("endDate", "2029-01-01 00:00:00.000000");
|
||||
|
||||
String json = mapper.write(resultMap);
|
||||
logger.info("Response: " + json);
|
||||
return json;
|
||||
return mapper.write(resultMap);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.handler;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface UserReqHandler extends BaseHandler {
|
||||
@Override
|
||||
default Object handle(Map<String, Object> request) throws JsonProcessingException {
|
||||
var userId = ((Number) request.get("userId")).longValue();
|
||||
return handleThis(request, userId);
|
||||
}
|
||||
|
||||
Object handleThis(Map<String, Object> request, Long userId) throws JsonProcessingException;
|
||||
}
|
|
@ -108,7 +108,7 @@ interface Mai2UserUdemaeRepo : UserLinked<Mai2UserUdemae>
|
|||
interface Mai2GameChargeRepo : JpaRepository<Mai2GameCharge, Long>
|
||||
|
||||
interface Mai2GameEventRepo : JpaRepository<Mai2GameEvent, Int> {
|
||||
fun findByTypeAndEnable(type: Int, enable: Boolean): List<Mai2GameEvent>
|
||||
fun findByEnable(enable: Boolean): List<Mai2GameEvent>
|
||||
}
|
||||
|
||||
interface Mai2GameSellingCardRepo : JpaRepository<Mai2GameSellingCard, Long>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.model.request.data;
|
||||
|
||||
import icu.samnyan.aqua.sega.maimai2.model.response.data.UserActivity;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.response.data.Mai2UserActivity;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.response.data.UserRating;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.userdata.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
@ -32,7 +32,7 @@ public class UserAll implements Serializable {
|
|||
private List<Mai2UserFriendSeasonRanking> userFriendSeasonRankingList;
|
||||
private List<Mai2UserCharge> userChargeList;
|
||||
private List<Mai2UserFavorite> userFavoriteList;
|
||||
private List<UserActivity> userActivityList;
|
||||
private List<Mai2UserActivity> userActivityList;
|
||||
private List<Map<String, Object>> userGamePlaylogList;
|
||||
private String isNewCharacterList;
|
||||
private String isNewMapList;
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.model.response;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import icu.samnyan.aqua.sega.maimai2.model.response.data.GameSetting;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class GetGameSettingResp {
|
||||
|
||||
@JsonProperty("isAouAccession")
|
||||
private boolean isAouAccession;
|
||||
private GameSetting gameSetting;
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.model.response;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class GetUserPreviewResp {
|
||||
|
||||
private long userId;
|
||||
private String userName;
|
||||
@JsonProperty("isLogin")
|
||||
private boolean isLogin;
|
||||
private String lastGameId;
|
||||
private String lastDataVersion;
|
||||
private String lastRomVersion;
|
||||
private String lastLoginDate;
|
||||
private String lastPlayDate;
|
||||
private int playerRating;
|
||||
private int nameplateId;
|
||||
private int iconId;
|
||||
private int trophyId;
|
||||
private int partnerId;
|
||||
private int frameId;
|
||||
private int dispRate;
|
||||
private int totalAwake;
|
||||
private int isNetMember;
|
||||
private String dailyBonusDate;
|
||||
private int headPhoneVolume;
|
||||
@JsonProperty("isInherit")
|
||||
private boolean isInherit;
|
||||
private int banState;
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.model.response.data;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author samnyan (privateamusement@protonmail.com)
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class GameSetting {
|
||||
@JsonProperty("isMaintenance")
|
||||
private boolean isMaintenance;
|
||||
private int requestInterval;
|
||||
private String rebootStartTime;
|
||||
private String rebootEndTime;
|
||||
private int movieUploadLimit;
|
||||
private int movieStatus;
|
||||
private String movieServerUri;
|
||||
private String deliverServerUri;
|
||||
private String oldServerUri;
|
||||
private String usbDlServerUri;
|
||||
private int rebootInterval;
|
||||
}
|
|
@ -13,7 +13,7 @@ import lombok.NoArgsConstructor;
|
|||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class UserActivity {
|
||||
public class Mai2UserActivity {
|
||||
private List<Mai2UserAct> playList;
|
||||
private List<Mai2UserAct> musicList;
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
package icu.samnyan.aqua.sega.maimai2.model.response.data;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class UserFavoriteItem {
|
||||
private int id;
|
||||
private int orderId;
|
||||
}
|
|
@ -344,13 +344,15 @@ class Mai2Test : StringSpec({
|
|||
}
|
||||
|
||||
"GetUserFavoriteItemApi" {
|
||||
// TODO: Check if this api should return string or int
|
||||
post("GetUserFavoriteItemApi", """{"userId":$USER_ID,"kind":2,"nextIndex":0,"maxCount":100,"isAllFavoriteItem":false}""").let { (_, result) ->
|
||||
result shouldBe """{"userId":"$USER_ID","kind":"2","length":"0","nextIndex":"0","userFavoriteItemList":[]}""".jsonMap()
|
||||
// result shouldBe """{"userId":"$USER_ID","kind":"2","length":"0","nextIndex":"0","userFavoriteItemList":[]}""".jsonMap()
|
||||
result shouldBe """{"userId":$USER_ID,"kind":2,"length":0,"nextIndex":0,"userFavoriteItemList":[]}""".jsonMap()
|
||||
}
|
||||
|
||||
|
||||
post("GetUserFavoriteItemApi", """{"userId":$USER_ID,"kind":1,"nextIndex":0,"maxCount":100,"isAllFavoriteItem":false}""").let { (_, result) ->
|
||||
result shouldBe """{"userId":"$USER_ID","kind":"1","length":"0","nextIndex":"0","userFavoriteItemList":[]}""".jsonMap()
|
||||
// result shouldBe """{"userId":"$USER_ID","kind":"1","length":"0","nextIndex":"0","userFavoriteItemList":[]}""".jsonMap()
|
||||
result shouldBe """{"userId":$USER_ID,"kind":1,"length":0,"nextIndex":0,"userFavoriteItemList":[]}""".jsonMap()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue