forked from Cookies_Public/AquaDX
[O] Collapse boring handlers
This commit is contained in:
parent
e41bdecd5b
commit
ac16f40303
@ -36,10 +36,6 @@ class ChusanServletController(
|
|||||||
val getUserOption: GetUserOptionHandler,
|
val getUserOption: GetUserOptionHandler,
|
||||||
val getUserPreview: GetUserPreviewHandler,
|
val getUserPreview: GetUserPreviewHandler,
|
||||||
val getUserRecentRating: GetUserRecentRatingHandler,
|
val getUserRecentRating: GetUserRecentRatingHandler,
|
||||||
val getUserRegion: GetUserRegionHandler,
|
|
||||||
val getUserRivalData: GetUserRivalDataHandler,
|
|
||||||
val getUserRivalMusic: GetUserRivalMusicHandler,
|
|
||||||
val getUserSymbolChatSetting: GetUserSymbolChatSettingHandler,
|
|
||||||
val getUserNetBattleData: GetUserNetBattleDataHandler,
|
val getUserNetBattleData: GetUserNetBattleDataHandler,
|
||||||
val getUserTeam: GetUserTeamHandler,
|
val getUserTeam: GetUserTeamHandler,
|
||||||
val upsertUserAll: UpsertUserAllHandler,
|
val upsertUserAll: UpsertUserAllHandler,
|
||||||
@ -51,15 +47,12 @@ class ChusanServletController(
|
|||||||
val cmGetUserData: CMGetUserDataHandler,
|
val cmGetUserData: CMGetUserDataHandler,
|
||||||
val cmGetUserCharacter: CMGetUserCharacterHandler,
|
val cmGetUserCharacter: CMGetUserCharacterHandler,
|
||||||
val getUserGacha: GetUserGachaHandler,
|
val getUserGacha: GetUserGachaHandler,
|
||||||
val getUserPrintedCard: GetUserPrintedCardHandler,
|
|
||||||
val cmGetUserItem: CMGetUserItemHandler,
|
val cmGetUserItem: CMGetUserItemHandler,
|
||||||
val rollGacha: RollGachaHandler,
|
val rollGacha: RollGachaHandler,
|
||||||
val cmUpsertUserGacha: CMUpsertUserGachaHandler,
|
val cmUpsertUserGacha: CMUpsertUserGachaHandler,
|
||||||
val cmUpsertUserPrintSubtract: CMUpsertUserPrintSubtractHandler,
|
val cmUpsertUserPrintSubtract: CMUpsertUserPrintSubtractHandler,
|
||||||
val cmUpsertUserPrintCancel: CMUpsertUserPrintCancelHandler,
|
val cmUpsertUserPrintCancel: CMUpsertUserPrintCancelHandler,
|
||||||
val beginMatching: BeginMatchingHandler,
|
val beginMatching: BeginMatchingHandler,
|
||||||
val endMatching: EndMatchingHandler,
|
|
||||||
val getMatchingState: GetMatchingStateHandler,
|
|
||||||
val removeMatchingMember: RemoveMatchingMemberHandler,
|
val removeMatchingMember: RemoveMatchingMemberHandler,
|
||||||
|
|
||||||
// Luminous
|
// Luminous
|
||||||
@ -73,12 +66,25 @@ class ChusanServletController(
|
|||||||
|
|
||||||
val getGameRanking = BaseHandler { """{"type":"${it["type"]}","length":"0","gameRankingList":[]}""" }
|
val getGameRanking = BaseHandler { """{"type":"${it["type"]}","length":"0","gameRankingList":[]}""" }
|
||||||
val getGameIdlist = BaseHandler { """{"type":"${it["type"]}","length":"0","gameRankingList":[]}""" }
|
val getGameIdlist = BaseHandler { """{"type":"${it["type"]}","length":"0","gameRankingList":[]}""" }
|
||||||
|
|
||||||
val getTeamCourseSetting = BaseHandler { """{"userId":"${it["userId"]}","length":"0","nextIndex":"0","teamCourseSettingList":[]}""" }
|
val getTeamCourseSetting = BaseHandler { """{"userId":"${it["userId"]}","length":"0","nextIndex":"0","teamCourseSettingList":[]}""" }
|
||||||
val getTeamCourseRule = BaseHandler { """{"userId":"${it["userId"]}","length":"0","nextIndex":"0","teamCourseRuleList":[]}""" }
|
val getTeamCourseRule = BaseHandler { """{"userId":"${it["userId"]}","length":"0","nextIndex":"0","teamCourseRuleList":[]}""" }
|
||||||
val getUserCtoCPlay = BaseHandler { """{"userId":"${it["userId"]}","orderBy":"0","count":"0","userCtoCPlayList":[]}""" }
|
val getUserCtoCPlay = BaseHandler { """{"userId":"${it["userId"]}","orderBy":"0","count":"0","userCtoCPlayList":[]}""" }
|
||||||
|
val getUserRivalMusic = BaseHandler { """{"userId":"${it["userId"]}","rivalId":"0","length":"0","nextIndex":"0","userRivalMusicList":[]}""" }
|
||||||
|
val getUserRivalData = BaseHandler { """{"userId":"${it["userId"]}","length":"0","userRivalData":[]}""" }
|
||||||
|
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 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"}""" }
|
||||||
|
|
||||||
|
// Matching
|
||||||
|
val endMatching = BaseHandler { """{"matchingResult":{"matchingMemberInfoList":[],"matchingMemberRoleList":[],"reflectorUri":""}}""" }
|
||||||
|
val getMatchingState = BaseHandler { """{"matchingWaitState":{"restMSec":"30000","pollingInterval":"10","matchingMemberInfoList":[],"isFinish":"true"}}""" }
|
||||||
|
|
||||||
|
|
||||||
|
// Below are code related to handling the handlers
|
||||||
val endpointList = mutableListOf(
|
val endpointList = mutableListOf(
|
||||||
"GameLoginApi", "GameLogoutApi", "GetGameChargeApi", "GetGameEventApi", "GetGameIdlistApi",
|
"GameLoginApi", "GameLogoutApi", "GetGameChargeApi", "GetGameEventApi", "GetGameIdlistApi",
|
||||||
"GetGameRankingApi", "GetGameSettingApi", "GetTeamCourseRuleApi", "GetTeamCourseSettingApi", "GetUserActivityApi",
|
"GetGameRankingApi", "GetGameSettingApi", "GetTeamCourseRuleApi", "GetTeamCourseSettingApi", "GetUserActivityApi",
|
||||||
@ -134,7 +140,7 @@ class ChusanServletController(
|
|||||||
logger.info("Chu3 > $api no-op")
|
logger.info("Chu3 > $api no-op")
|
||||||
return """{"returnCode":"1"}"""
|
return """{"returnCode":"1"}"""
|
||||||
}
|
}
|
||||||
logger.info("Chu3 > $api : $request")
|
logger.info("Chu3 < $api : $request")
|
||||||
|
|
||||||
return try {
|
return try {
|
||||||
Metrics.timer("aquadx_chusan_api_latency", "api" to api).recordCallable {
|
Metrics.timer("aquadx_chusan_api_latency", "api" to api).recordCallable {
|
||||||
|
|||||||
@ -1,47 +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;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author samnyan (privateamusement@protonmail.com)
|
|
||||||
*/
|
|
||||||
@Component("ChusanEndMatchingHandler")
|
|
||||||
public class EndMatchingHandler implements BaseHandler {
|
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(EndMatchingHandler.class);
|
|
||||||
|
|
||||||
private final StringMapper mapper;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
public EndMatchingHandler(StringMapper mapper) {
|
|
||||||
this.mapper = mapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String handle(Map<String, ?> request) throws JsonProcessingException {
|
|
||||||
//roomId, userId
|
|
||||||
|
|
||||||
Map<String, Object> matchingResult = new LinkedHashMap<>();
|
|
||||||
matchingResult.put("matchingMemberInfoList", List.of()); // MatchingMemberInfo
|
|
||||||
matchingResult.put("matchingMemberRoleList", List.of()); // Role?
|
|
||||||
matchingResult.put("reflectorUri", "");
|
|
||||||
|
|
||||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
|
||||||
resultMap.put("matchingResult", matchingResult);
|
|
||||||
|
|
||||||
String json = mapper.write(resultMap);
|
|
||||||
logger.info("Response: " + json);
|
|
||||||
return json;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,48 +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.data.MatchingMemberInfo;
|
|
||||||
import icu.samnyan.aqua.sega.chusan.model.response.data.MatchingWaitState;
|
|
||||||
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("ChusanGetMatchingStateHandler")
|
|
||||||
public class GetMatchingStateHandler implements BaseHandler {
|
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(GetMatchingStateHandler.class);
|
|
||||||
|
|
||||||
private final StringMapper mapper;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
public GetMatchingStateHandler(StringMapper mapper) {
|
|
||||||
this.mapper = mapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String handle(Map<String, ?> request) throws JsonProcessingException {
|
|
||||||
String roomId = (String) request.get("roomId");
|
|
||||||
MatchingMemberInfo matchingMemberInfo = mapper.convert(request.get("matchingMemberInfo"), MatchingMemberInfo.class);
|
|
||||||
|
|
||||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
|
||||||
|
|
||||||
MatchingWaitState matchingWaitState = new MatchingWaitState();
|
|
||||||
matchingWaitState.setFinish(true);
|
|
||||||
|
|
||||||
resultMap.put("matchingWaitState", matchingWaitState);
|
|
||||||
|
|
||||||
String json = mapper.write(resultMap);
|
|
||||||
logger.info("Response: " + json);
|
|
||||||
return json;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,43 +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.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("ChusanGetUserPrintedCardHandler")
|
|
||||||
public class GetUserPrintedCardHandler implements BaseHandler {
|
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(GetUserPrintedCardHandler.class);
|
|
||||||
private final BasicMapper mapper;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
public GetUserPrintedCardHandler(BasicMapper mapper) {
|
|
||||||
this.mapper = mapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String handle(Map<String, ?> request) throws JsonProcessingException {
|
|
||||||
String userId = String.valueOf(request.get("userId"));
|
|
||||||
|
|
||||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
|
||||||
resultMap.put("userId", userId);
|
|
||||||
resultMap.put("length", 0);
|
|
||||||
resultMap.put("nextIndex", -1);
|
|
||||||
resultMap.put("userPrintedCardList", List.of());
|
|
||||||
|
|
||||||
String json = mapper.write(resultMap);
|
|
||||||
logger.info("Response: " + json);
|
|
||||||
return json;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,46 +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.ArrayList;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author samnyan (privateamusement@protonmail.com)
|
|
||||||
*/
|
|
||||||
@Component("ChusanGetUserRegionHandler")
|
|
||||||
public class GetUserRegionHandler implements BaseHandler {
|
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(GetUserRegionHandler.class);
|
|
||||||
|
|
||||||
private final StringMapper mapper;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
public GetUserRegionHandler(StringMapper mapper) {
|
|
||||||
this.mapper = mapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String handle(Map<String, ?> request) throws JsonProcessingException {
|
|
||||||
String userId = (String) request.get("userId");
|
|
||||||
|
|
||||||
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,39 +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.stereotype.Component;
|
|
||||||
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Component("ChusanGetUserRivalDataHandler")
|
|
||||||
public class GetUserRivalDataHandler implements BaseHandler {
|
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(GetUserRivalDataHandler.class);
|
|
||||||
|
|
||||||
private final StringMapper mapper;
|
|
||||||
|
|
||||||
|
|
||||||
public GetUserRivalDataHandler(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);
|
|
||||||
resultMap.put("length", 0);
|
|
||||||
resultMap.put("userRivalData", List.of());
|
|
||||||
|
|
||||||
String json = mapper.write(resultMap);
|
|
||||||
logger.info("Response: " + json);
|
|
||||||
return json;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,41 +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.stereotype.Component;
|
|
||||||
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Component("ChusanGetUserRivalMusicHandler")
|
|
||||||
public class GetUserRivalMusicHandler implements BaseHandler {
|
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(GetUserRivalMusicHandler.class);
|
|
||||||
|
|
||||||
private final StringMapper mapper;
|
|
||||||
|
|
||||||
|
|
||||||
public GetUserRivalMusicHandler(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);
|
|
||||||
resultMap.put("rivalId", 0);
|
|
||||||
resultMap.put("length", 0);
|
|
||||||
resultMap.put("nextIndex", 0);
|
|
||||||
resultMap.put("userRivalMusicList", List.of());
|
|
||||||
|
|
||||||
String json = mapper.write(resultMap);
|
|
||||||
logger.info("Response: " + json);
|
|
||||||
return json;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,47 +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.data.SymbolChatInfo;
|
|
||||||
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.ArrayList;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author samnyan (privateamusement@protonmail.com)
|
|
||||||
*/
|
|
||||||
@Component("ChusanGetUserSymbolChatSettingHandler")
|
|
||||||
public class GetUserSymbolChatSettingHandler implements BaseHandler {
|
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(GetUserSymbolChatSettingHandler.class);
|
|
||||||
|
|
||||||
private final StringMapper mapper;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
public GetUserSymbolChatSettingHandler(StringMapper mapper) {
|
|
||||||
this.mapper = mapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String handle(Map<String, ?> request) throws JsonProcessingException {
|
|
||||||
String userId = (String) request.get("userId");
|
|
||||||
|
|
||||||
List<SymbolChatInfo> symbolChatInfoList = new ArrayList<>();
|
|
||||||
|
|
||||||
Map<String, Object> resultMap = new LinkedHashMap<>();
|
|
||||||
resultMap.put("userId", userId);
|
|
||||||
resultMap.put("length", 0);
|
|
||||||
resultMap.put("symbolChatInfoList", symbolChatInfoList);
|
|
||||||
|
|
||||||
String json = mapper.write(resultMap);
|
|
||||||
logger.info("Response: " + json);
|
|
||||||
return json;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
x
Reference in New Issue
Block a user