mirror of
https://github.com/MewoLab/AquaDX.git
synced 2026-02-14 00:17:27 +08:00
[-] Collapse more
This commit is contained in:
@@ -8,6 +8,7 @@ import icu.samnyan.aqua.sega.util.jackson.StringMapper
|
|||||||
import icu.samnyan.aqua.spring.Metrics
|
import icu.samnyan.aqua.spring.Metrics
|
||||||
import org.slf4j.LoggerFactory
|
import org.slf4j.LoggerFactory
|
||||||
import org.springframework.web.bind.annotation.RestController
|
import org.springframework.web.bind.annotation.RestController
|
||||||
|
import kotlin.collections.set
|
||||||
import kotlin.reflect.full.declaredMemberProperties
|
import kotlin.reflect.full.declaredMemberProperties
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -18,7 +19,6 @@ import kotlin.reflect.full.declaredMemberProperties
|
|||||||
@API(value = ["/g/chu3/{version}/ChuniServlet", "/g/chu3/{version}"])
|
@API(value = ["/g/chu3/{version}/ChuniServlet", "/g/chu3/{version}"])
|
||||||
class ChusanServletController(
|
class ChusanServletController(
|
||||||
val gameLogin: GameLoginHandler,
|
val gameLogin: GameLoginHandler,
|
||||||
val gameLogout: GameLogoutHandler,
|
|
||||||
val getGameCharge: GetGameChargeHandler,
|
val getGameCharge: GetGameChargeHandler,
|
||||||
val getGameEvent: GetGameEventHandler,
|
val getGameEvent: GetGameEventHandler,
|
||||||
val getGameSetting: GetGameSettingHandler,
|
val getGameSetting: GetGameSettingHandler,
|
||||||
@@ -36,7 +36,6 @@ class ChusanServletController(
|
|||||||
val getUserOption: GetUserOptionHandler,
|
val getUserOption: GetUserOptionHandler,
|
||||||
val getUserPreview: GetUserPreviewHandler,
|
val getUserPreview: GetUserPreviewHandler,
|
||||||
val getUserRecentRating: GetUserRecentRatingHandler,
|
val getUserRecentRating: GetUserRecentRatingHandler,
|
||||||
val getUserNetBattleData: GetUserNetBattleDataHandler,
|
|
||||||
val getUserTeam: GetUserTeamHandler,
|
val getUserTeam: GetUserTeamHandler,
|
||||||
val upsertUserAll: UpsertUserAllHandler,
|
val upsertUserAll: UpsertUserAllHandler,
|
||||||
val upsertUserChargelog: UpsertUserChargelogHandler,
|
val upsertUserChargelog: UpsertUserChargelogHandler,
|
||||||
@@ -53,11 +52,9 @@ class ChusanServletController(
|
|||||||
val cmUpsertUserPrintSubtract: CMUpsertUserPrintSubtractHandler,
|
val cmUpsertUserPrintSubtract: CMUpsertUserPrintSubtractHandler,
|
||||||
val cmUpsertUserPrintCancel: CMUpsertUserPrintCancelHandler,
|
val cmUpsertUserPrintCancel: CMUpsertUserPrintCancelHandler,
|
||||||
val beginMatching: BeginMatchingHandler,
|
val beginMatching: BeginMatchingHandler,
|
||||||
val removeMatchingMember: RemoveMatchingMemberHandler,
|
|
||||||
|
|
||||||
// Luminous
|
// Luminous
|
||||||
val getUserCMission: GetUserCMissionHandler,
|
val getUserCMission: GetUserCMissionHandler,
|
||||||
val getUserNetBattleRankingInfo: GetUserNetBattleRankingInfoHandler,
|
|
||||||
val getGameMapAreaCondition: GetGameMapAreaConditionHandler,
|
val getGameMapAreaCondition: GetGameMapAreaConditionHandler,
|
||||||
|
|
||||||
val mapper: StringMapper
|
val mapper: StringMapper
|
||||||
@@ -75,6 +72,8 @@ class ChusanServletController(
|
|||||||
val getUserRegion = BaseHandler { """{"userId":"${it["userId"]}","length":"0","userRegionList":[]}""" }
|
val getUserRegion = BaseHandler { """{"userId":"${it["userId"]}","length":"0","userRegionList":[]}""" }
|
||||||
val getUserPrintedCard = BaseHandler { """{"userId":"${it["userId"]}","length":0,"nextIndex":-1,"userPrintedCardList":[]}""" }
|
val getUserPrintedCard = BaseHandler { """{"userId":"${it["userId"]}","length":0,"nextIndex":-1,"userPrintedCardList":[]}""" }
|
||||||
val getUserSymbolChatSetting = BaseHandler { """{"userId":"${it["userId"]}","length":"0","symbolChatInfoList":[]}""" }
|
val getUserSymbolChatSetting = BaseHandler { """{"userId":"${it["userId"]}","length":"0","symbolChatInfoList":[]}""" }
|
||||||
|
val getUserNetBattleData = BaseHandler { """{"userId":"${it["userId"]}","userNetBattleData":{"recentNBSelectMusicList":[],"recentNBMusicList":[]}}""" }
|
||||||
|
val getUserNetBattleRankingInfo = BaseHandler { """{"userId":"${it["userId"]}","length":"0","userNetBattleRankingInfoList":{}}""" }
|
||||||
|
|
||||||
val cmUpsertUserPrint = BaseHandler { """{"returnCode":1,"orderId":"0","serialId":"FAKECARDIMAG12345678","apiName":"CMUpsertUserPrintApi"}""" }
|
val cmUpsertUserPrint = BaseHandler { """{"returnCode":1,"orderId":"0","serialId":"FAKECARDIMAG12345678","apiName":"CMUpsertUserPrintApi"}""" }
|
||||||
val cmUpsertUserPrintlog = BaseHandler { """{"returnCode":1,"orderId":"0","serialId":"FAKECARDIMAG12345678","apiName":"CMUpsertUserPrintlogApi"}""" }
|
val cmUpsertUserPrintlog = BaseHandler { """{"returnCode":1,"orderId":"0","serialId":"FAKECARDIMAG12345678","apiName":"CMUpsertUserPrintlogApi"}""" }
|
||||||
@@ -86,28 +85,29 @@ class ChusanServletController(
|
|||||||
|
|
||||||
// Below are code related to handling the handlers
|
// Below are code related to handling the handlers
|
||||||
val endpointList = mutableListOf(
|
val endpointList = mutableListOf(
|
||||||
"GameLoginApi", "GameLogoutApi", "GetGameChargeApi", "GetGameEventApi", "GetGameIdlistApi",
|
"GameLoginApi", "GetGameChargeApi", "GetGameEventApi", "GetGameIdlistApi",
|
||||||
"GetGameRankingApi", "GetGameSettingApi", "GetTeamCourseRuleApi", "GetTeamCourseSettingApi", "GetUserActivityApi",
|
"GetGameRankingApi", "GetGameSettingApi", "GetTeamCourseRuleApi", "GetTeamCourseSettingApi", "GetUserActivityApi",
|
||||||
"GetUserCharacterApi", "GetUserChargeApi", "GetUserCourseApi", "GetUserDataApi", "GetUserDuelApi",
|
"GetUserCharacterApi", "GetUserChargeApi", "GetUserCourseApi", "GetUserDataApi", "GetUserDuelApi",
|
||||||
"GetUserFavoriteItemApi", "GetUserItemApi", "GetUserLoginBonusApi", "GetUserMapAreaApi", "GetUserMusicApi",
|
"GetUserFavoriteItemApi", "GetUserItemApi", "GetUserLoginBonusApi", "GetUserMapAreaApi", "GetUserMusicApi",
|
||||||
"GetUserOptionApi", "GetUserPreviewApi", "GetUserRecentRatingApi", "GetUserRegionApi", "GetUserRivalDataApi",
|
"GetUserOptionApi", "GetUserPreviewApi", "GetUserRecentRatingApi", "GetUserRegionApi", "GetUserRivalDataApi",
|
||||||
"GetUserRivalMusicApi", "GetUserTeamApi", "GetUserSymbolChatSettingApi", "GetUserNetBattleDataApi",
|
"GetUserRivalMusicApi", "GetUserTeamApi", "GetUserSymbolChatSettingApi", "GetUserNetBattleDataApi",
|
||||||
"UpsertClientBookkeepingApi", "UpsertClientDevelopApi", "UpsertClientErrorApi", "UpsertClientSettingApi",
|
"UpsertUserAllApi", "UpsertUserChargelogApi", "GetGameGachaApi",
|
||||||
"UpsertClientTestmodeApi", "UpsertUserAllApi", "UpsertUserChargelogApi", "CreateTokenApi", "RemoveTokenApi",
|
"MatchingServer/BeginMatchingApi", "MatchingServer/EndMatchingApi", "MatchingServer/GetMatchingStateApi",
|
||||||
"UpsertClientUploadApi", "MatchingServer/Ping", "MatchingServer/BeginMatchingApi", "MatchingServer/EndMatchingApi",
|
|
||||||
"MatchingServer/RemoveMatchingMemberApi", "MatchingServer/GetMatchingStateApi", "GetGameGachaApi",
|
|
||||||
"GetGameGachaCardByIdApi", "GetUserCardPrintErrorApi", "CMGetUserCharacterApi", "CMGetUserDataApi",
|
"GetGameGachaCardByIdApi", "GetUserCardPrintErrorApi", "CMGetUserCharacterApi", "CMGetUserDataApi",
|
||||||
"GetUserGachaApi", "CMGetUserItemApi", "CMGetUserPreviewApi", "GetUserPrintedCardApi", "PrinterLoginApi",
|
"GetUserGachaApi", "CMGetUserItemApi", "CMGetUserPreviewApi", "GetUserPrintedCardApi",
|
||||||
"PrinterLogoutApi", "RollGachaApi", "CMUpsertUserGachaApi", "CMUpsertUserPrintApi", "CMUpsertUserPrintCancelApi",
|
"RollGachaApi", "CMUpsertUserGachaApi", "CMUpsertUserPrintApi", "CMUpsertUserPrintCancelApi",
|
||||||
"CMUpsertUserPrintlogApi", "CMUpsertUserPrintSubtractApi",
|
"CMUpsertUserPrintlogApi", "CMUpsertUserPrintSubtractApi",
|
||||||
|
|
||||||
// SDGS Exclusive
|
// SDGS Exclusive
|
||||||
"GetUserCtoCPlayApi", "GetUserCMissionApi", "GetUserNetBattleRankingInfoApi", "GetGameMapAreaConditionApi")
|
"GetUserCtoCPlayApi", "GetUserCMissionApi", "GetUserNetBattleRankingInfoApi", "GetGameMapAreaConditionApi")
|
||||||
val matchingEndpoints = endpointList.filter { it.startsWith("MatchingServer") }.map { it.split("/").last() }.toSet()
|
|
||||||
|
|
||||||
val noopEndpoint = endpointList.popAll("UpsertClientBookkeepingApi", "UpsertClientDevelopApi", "UpsertClientErrorApi",
|
val noopEndpoint = setOf("UpsertClientBookkeepingApi", "UpsertClientDevelopApi", "UpsertClientErrorApi",
|
||||||
"UpsertClientSettingApi", "UpsertClientTestmodeApi", "CreateTokenApi", "RemoveTokenApi", "UpsertClientUploadApi",
|
"UpsertClientSettingApi", "UpsertClientTestmodeApi", "CreateTokenApi", "RemoveTokenApi", "UpsertClientUploadApi",
|
||||||
"MatchingServer/Ping", "PrinterLoginApi", "PrinterLogoutApi", "Ping")
|
"MatchingServer/Ping", "PrinterLoginApi", "PrinterLogoutApi", "Ping", "GameLogoutApi",
|
||||||
|
"MatchingServer/RemoveMatchingMemberApi")
|
||||||
|
|
||||||
|
val matchingEndpoints = (endpointList + noopEndpoint).filter { it.startsWith("MatchingServer") }
|
||||||
|
.map { it.split("/").last() }.toSet()
|
||||||
|
|
||||||
val members = this::class.declaredMemberProperties
|
val members = this::class.declaredMemberProperties
|
||||||
val handlers: Map<String, BaseHandler> = endpointList.associateWith { api ->
|
val handlers: Map<String, BaseHandler> = endpointList.associateWith { api ->
|
||||||
|
|||||||
@@ -1,34 +0,0 @@
|
|||||||
package icu.samnyan.aqua.sega.chusan.handler;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
||||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
|
||||||
import icu.samnyan.aqua.sega.chusan.model.response.CodeResp;
|
|
||||||
import icu.samnyan.aqua.sega.util.jackson.StringMapper;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author samnyan (privateamusement@protonmail.com)
|
|
||||||
*/
|
|
||||||
@Component("ChusanGameLogoutHandler")
|
|
||||||
public class GameLogoutHandler implements BaseHandler {
|
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(GameLogoutHandler.class);
|
|
||||||
|
|
||||||
private final StringMapper mapper;
|
|
||||||
|
|
||||||
public GameLogoutHandler(StringMapper mapper) {
|
|
||||||
this.mapper = mapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String handle(Map<String, ?> request) throws JsonProcessingException {
|
|
||||||
|
|
||||||
String json = mapper.write(new CodeResp(1));
|
|
||||||
logger.info("Response: " + json);
|
|
||||||
return json;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
package icu.samnyan.aqua.sega.chusan.handler;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
||||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
|
||||||
import icu.samnyan.aqua.sega.util.jackson.StringMapper;
|
|
||||||
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;
|
|
||||||
|
|
||||||
@Component("ChusanGetUserNetBattleDataHandler")
|
|
||||||
public class GetUserNetBattleDataHandler implements BaseHandler {
|
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(GetUserNetBattleDataHandler.class);
|
|
||||||
|
|
||||||
private final StringMapper mapper;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
public GetUserNetBattleDataHandler(StringMapper mapper) {
|
|
||||||
this.mapper = mapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String handle(Map<String, ?> request) throws JsonProcessingException {
|
|
||||||
String userId = (String) request.get("userId");
|
|
||||||
|
|
||||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
|
||||||
resultMap.put("userId", userId);
|
|
||||||
|
|
||||||
Map<String, Object> userNetBattleData = new LinkedHashMap<>();
|
|
||||||
userNetBattleData.put("recentNBSelectMusicList", List.of());
|
|
||||||
userNetBattleData.put("recentNBMusicList", List.of());
|
|
||||||
|
|
||||||
resultMap.put("userNetBattleData", userNetBattleData);
|
|
||||||
|
|
||||||
String json = mapper.write(resultMap);
|
|
||||||
logger.info("Response: " + json);
|
|
||||||
return json;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
package icu.samnyan.aqua.sega.chusan.handler;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
||||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
|
||||||
import icu.samnyan.aqua.sega.util.jackson.StringMapper;
|
|
||||||
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;
|
|
||||||
|
|
||||||
@Component("ChusanGetUserNetBattleRankingInfoHandler")
|
|
||||||
public class GetUserNetBattleRankingInfoHandler implements BaseHandler {
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(GetUserNetBattleRankingInfoHandler.class);
|
|
||||||
|
|
||||||
private final StringMapper mapper;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
public GetUserNetBattleRankingInfoHandler(StringMapper mapper) {
|
|
||||||
this.mapper = mapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String handle(Map<String, ?> request) throws JsonProcessingException {
|
|
||||||
logger.info("UserNetBattleRankingInfo Dummy Handler");
|
|
||||||
|
|
||||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
|
||||||
resultMap.put("userId", request.get("userId"));
|
|
||||||
resultMap.put("length", 0);
|
|
||||||
resultMap.put("userNetBattleRankingInfoList", new LinkedHashMap<>());
|
|
||||||
|
|
||||||
String json = mapper.write(resultMap);
|
|
||||||
logger.info("Response: " + json);
|
|
||||||
return json;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
package icu.samnyan.aqua.sega.chusan.handler;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
||||||
import icu.samnyan.aqua.sega.general.BaseHandler;
|
|
||||||
import icu.samnyan.aqua.sega.util.jackson.StringMapper;
|
|
||||||
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;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author samnyan (privateamusement@protonmail.com)
|
|
||||||
*/
|
|
||||||
@Component("ChusanRemoveMatchingMemberHandler")
|
|
||||||
public class RemoveMatchingMemberHandler implements BaseHandler {
|
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(RemoveMatchingMemberHandler.class);
|
|
||||||
|
|
||||||
private final StringMapper mapper;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
public RemoveMatchingMemberHandler(StringMapper mapper) {
|
|
||||||
this.mapper = mapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String handle(Map<String, ?> request) throws JsonProcessingException {
|
|
||||||
|
|
||||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
|
||||||
resultMap.put("returnCode", 1);
|
|
||||||
|
|
||||||
String json = mapper.write(resultMap);
|
|
||||||
logger.info("Response: " + json);
|
|
||||||
return json;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user