public async Task <RES_DATA> RequestLoadUserData(REQ_DATA request) { try { //var preCheck = ServerLogic.ClientRequestPrepare.CheckServerStatus(); //if(preCheck != ERROR_CODE.NONE) //{ //return new RES_DATA { Result = (short)preCheck }; //} var jsonObject = DecryptRequestData <REQ_USER_DATA>(request.LSeq, request.Data); if (string.IsNullOrEmpty(jsonObject.ID) || string.IsNullOrEmpty(request.ID)) { return(new RES_DATA { Result = (short)ERROR_CODE.REQUEST_JSON_PARSE_OR_ID_NULL }); } var userID = jsonObject.ID; var loginSeq = jsonObject.LSeq; var authToken = jsonObject.AT; if (userID != request.ID || loginSeq != request.LSeq) { return(new RES_DATA { Result = (short)ERROR_CODE.DISCORDANCE_ID_LSEQ }); } var authUserInfo = await CommonServer.LocalCache.UserAuthCache.GetAuthInfo(userID); if (authUserInfo.err != ERROR_CODE.NONE) { return(new RES_DATA { Result = (short)authUserInfo.err }); } var checkResult = authUserInfo.Check(loginSeq, userID, authToken); if (checkResult != ERROR_CODE.NONE) { return(new RES_DATA { Result = (short)checkResult }); } if (ServerLogic.ClientRequestPrepare.CompareClientDataVer(authUserInfo.CDV) == false) { return(new RES_DATA { Result = (short)ERROR_CODE.FAIL_CLIENT_DATA_VERSION }); } { checkResult = await RequestLock.Lock(userID, authToken); if (checkResult != ERROR_CODE.NONE) { return(new RES_DATA { Result = (short)checkResult }); } var result = await Request.LoadUserData.Process(jsonObject, authUserInfo); await RequestLock.UnLock(userID); return(EncryotResponseData <RES_USER_DATA>(request.LSeq.ToString(), result)); } } catch (Exception ex) { return(ResponseException <RES_DATA>(ex.ToString())); } }
public async Task <RES_DATA> RequestWorldExtension(REQ_DATA request) { try { //var preCheck = ServerLogic.ClientRequestPrepare.CheckServerStatus(); //if(preCheck != ERROR_CODE.NONE) //{ //return new RES_DATA { Result = (short)preCheck }; //} var jsonObject = DecryptRequestData <REQ_WORLD_EXTENSION>(request.LSeq, request.Data); if (string.IsNullOrEmpty(jsonObject.ID) || string.IsNullOrEmpty(request.ID)) { return(new RES_DATA { Result = (short)ERROR_CODE.REQUEST_JSON_PARSE_OR_ID_NULL }); } var userID = jsonObject.ID; var loginSeq = jsonObject.LSeq; var authToken = jsonObject.AT; if (userID != request.ID || loginSeq != request.LSeq) { return(new RES_DATA { Result = (short)ERROR_CODE.DISCORDANCE_ID_LSEQ }); } var authUserInfo = await CommonServer.LocalCache.UserAuthCache.GetAuthInfo(userID); if (authUserInfo.err != ERROR_CODE.NONE) { return(new RES_DATA { Result = (short)authUserInfo.err }); } var checkResult = authUserInfo.Check(loginSeq, userID, authToken); if (checkResult != ERROR_CODE.NONE) { return(new RES_DATA { Result = (short)checkResult }); } if (ServerLogic.ClientRequestPrepare.CompareClientDataVer(authUserInfo.CDV) == false) { return(new RES_DATA { Result = (short)ERROR_CODE.FAIL_CLIENT_DATA_VERSION }); } { checkResult = await RequestLock.Lock(userID, authToken); if (checkResult != ERROR_CODE.NONE) { return(new RES_DATA { Result = (short)checkResult }); } var userGameData = await DBUserGameData.GetSmallBasicGameData(authUserInfo.UserID); if (userGameData.IsValid == false) { await RequestLock.UnLock(userID); return(new RES_DATA { Result = (short)ERROR_CODE.FAIL_LOAD_SMALL_USER_BASIC_GAME_DATA }); } if (userGameData.TSeq != Loader.DBTutorialDataInst.TUTORIAL_COUNT) { await RequestLock.UnLock(userID); return(new RES_DATA { Result = (short)ERROR_CODE.TUTORIAL_DONT_COMPLETED }); } if (Request.Function.IsBusinessSimulationing(userGameData.PBSTurn)) { await RequestLock.UnLock(userID); return(new RES_DATA { Result = (short)ERROR_CODE.ALREADY_BUSINESS_SIMULATIONING }); } var result = await Request.WorldExtension.Process(jsonObject, authUserInfo, userGameData); await RequestLock.UnLock(userID); return(EncryotResponseData <RES_WORLD_EXTENSION>(request.LSeq.ToString(), result)); } } catch (Exception ex) { return(ResponseException <RES_DATA>(ex.ToString())); } }