mirror of https://github.com/hykilpikonna/AquaDX
[-] Collapse more
parent
ac16f40303
commit
698422a41e
|
@ -8,6 +8,7 @@ import icu.samnyan.aqua.sega.util.jackson.StringMapper
|
|||
import icu.samnyan.aqua.spring.Metrics
|
||||
import org.slf4j.LoggerFactory
|
||||
import org.springframework.web.bind.annotation.RestController
|
||||
import kotlin.collections.set
|
||||
import kotlin.reflect.full.declaredMemberProperties
|
||||
|
||||
/**
|
||||
|
@ -18,7 +19,6 @@ import kotlin.reflect.full.declaredMemberProperties
|
|||
@API(value = ["/g/chu3/{version}/ChuniServlet", "/g/chu3/{version}"])
|
||||
class ChusanServletController(
|
||||
val gameLogin: GameLoginHandler,
|
||||
val gameLogout: GameLogoutHandler,
|
||||
val getGameCharge: GetGameChargeHandler,
|
||||
val getGameEvent: GetGameEventHandler,
|
||||
val getGameSetting: GetGameSettingHandler,
|
||||
|
@ -36,7 +36,6 @@ class ChusanServletController(
|
|||
val getUserOption: GetUserOptionHandler,
|
||||
val getUserPreview: GetUserPreviewHandler,
|
||||
val getUserRecentRating: GetUserRecentRatingHandler,
|
||||
val getUserNetBattleData: GetUserNetBattleDataHandler,
|
||||
val getUserTeam: GetUserTeamHandler,
|
||||
val upsertUserAll: UpsertUserAllHandler,
|
||||
val upsertUserChargelog: UpsertUserChargelogHandler,
|
||||
|
@ -53,11 +52,9 @@ class ChusanServletController(
|
|||
val cmUpsertUserPrintSubtract: CMUpsertUserPrintSubtractHandler,
|
||||
val cmUpsertUserPrintCancel: CMUpsertUserPrintCancelHandler,
|
||||
val beginMatching: BeginMatchingHandler,
|
||||
val removeMatchingMember: RemoveMatchingMemberHandler,
|
||||
|
||||
// Luminous
|
||||
val getUserCMission: GetUserCMissionHandler,
|
||||
val getUserNetBattleRankingInfo: GetUserNetBattleRankingInfoHandler,
|
||||
val getGameMapAreaCondition: GetGameMapAreaConditionHandler,
|
||||
|
||||
val mapper: StringMapper
|
||||
|
@ -75,6 +72,8 @@ class ChusanServletController(
|
|||
val getUserRegion = BaseHandler { """{"userId":"${it["userId"]}","length":"0","userRegionList":[]}""" }
|
||||
val getUserPrintedCard = BaseHandler { """{"userId":"${it["userId"]}","length":0,"nextIndex":-1,"userPrintedCardList":[]}""" }
|
||||
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 cmUpsertUserPrintlog = BaseHandler { """{"returnCode":1,"orderId":"0","serialId":"FAKECARDIMAG12345678","apiName":"CMUpsertUserPrintlogApi"}""" }
|
||||
|
@ -86,28 +85,29 @@ class ChusanServletController(
|
|||
|
||||
// Below are code related to handling the handlers
|
||||
val endpointList = mutableListOf(
|
||||
"GameLoginApi", "GameLogoutApi", "GetGameChargeApi", "GetGameEventApi", "GetGameIdlistApi",
|
||||
"GameLoginApi", "GetGameChargeApi", "GetGameEventApi", "GetGameIdlistApi",
|
||||
"GetGameRankingApi", "GetGameSettingApi", "GetTeamCourseRuleApi", "GetTeamCourseSettingApi", "GetUserActivityApi",
|
||||
"GetUserCharacterApi", "GetUserChargeApi", "GetUserCourseApi", "GetUserDataApi", "GetUserDuelApi",
|
||||
"GetUserFavoriteItemApi", "GetUserItemApi", "GetUserLoginBonusApi", "GetUserMapAreaApi", "GetUserMusicApi",
|
||||
"GetUserOptionApi", "GetUserPreviewApi", "GetUserRecentRatingApi", "GetUserRegionApi", "GetUserRivalDataApi",
|
||||
"GetUserRivalMusicApi", "GetUserTeamApi", "GetUserSymbolChatSettingApi", "GetUserNetBattleDataApi",
|
||||
"UpsertClientBookkeepingApi", "UpsertClientDevelopApi", "UpsertClientErrorApi", "UpsertClientSettingApi",
|
||||
"UpsertClientTestmodeApi", "UpsertUserAllApi", "UpsertUserChargelogApi", "CreateTokenApi", "RemoveTokenApi",
|
||||
"UpsertClientUploadApi", "MatchingServer/Ping", "MatchingServer/BeginMatchingApi", "MatchingServer/EndMatchingApi",
|
||||
"MatchingServer/RemoveMatchingMemberApi", "MatchingServer/GetMatchingStateApi", "GetGameGachaApi",
|
||||
"UpsertUserAllApi", "UpsertUserChargelogApi", "GetGameGachaApi",
|
||||
"MatchingServer/BeginMatchingApi", "MatchingServer/EndMatchingApi", "MatchingServer/GetMatchingStateApi",
|
||||
"GetGameGachaCardByIdApi", "GetUserCardPrintErrorApi", "CMGetUserCharacterApi", "CMGetUserDataApi",
|
||||
"GetUserGachaApi", "CMGetUserItemApi", "CMGetUserPreviewApi", "GetUserPrintedCardApi", "PrinterLoginApi",
|
||||
"PrinterLogoutApi", "RollGachaApi", "CMUpsertUserGachaApi", "CMUpsertUserPrintApi", "CMUpsertUserPrintCancelApi",
|
||||
"GetUserGachaApi", "CMGetUserItemApi", "CMGetUserPreviewApi", "GetUserPrintedCardApi",
|
||||
"RollGachaApi", "CMUpsertUserGachaApi", "CMUpsertUserPrintApi", "CMUpsertUserPrintCancelApi",
|
||||
"CMUpsertUserPrintlogApi", "CMUpsertUserPrintSubtractApi",
|
||||
|
||||
// SDGS Exclusive
|
||||
"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",
|
||||
"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 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;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue