덱 저장 마무리

This commit is contained in:
김판돌 2024-02-24 15:40:14 +09:00
parent e41e3904dc
commit 6336fee8f1
3 changed files with 28 additions and 24 deletions

View File

@ -21,6 +21,6 @@
<rules>
<logger name="*" minlevel="Trace" writeTo="logfile" />
<logger name="*" minlevel="${configsetting:logLevel}" writeTo="console" />
<logger name="*" minlevel="Trace" writeTo="console" />
</rules>
</nlog>

View File

@ -3,12 +3,6 @@ using Server.System;
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
//로그 레벨 설정
#if DEBUG
NLog.GlobalDiagnosticsContext.Set("logLevel", "Trace");
#elif LIVE
NLog.GlobalDiagnosticsContext.Set("logLevel", "Info");
#endif
//웹서버 초기화
ProtocolProcessor.Init();
//깃 웹훅 초기화

View File

@ -25,7 +25,7 @@ namespace Server.Service
if (req.deck_unit[n] == 0)
continue;
long unit_id = req.deck_unit[n];
if( deckUnitInfo.FindIndex(data => data.unit_id == unit_id) == -1)
if( deckUnitInfo.FindIndex(data => data.id == unit_id) == -1)
throw new RuntimeException("Not Unit", Error.nodata);
}
@ -44,25 +44,35 @@ namespace Server.Service
if(deckindex == -1)
throw new RuntimeException("Not Deck", Error.nodata);
//덱 검사
if (deckInfo[deckindex].deck_unit0_id == req.deck_unit[0] &&
deckInfo[deckindex].deck_unit1_id == req.deck_unit[1] &&
deckInfo[deckindex].deck_unit2_id == req.deck_unit[2] &&
deckInfo[deckindex].deck_unit3_id == req.deck_unit[3] &&
deckInfo[deckindex].deck_unit4_id == req.deck_unit[4] &&
deckInfo[deckindex].deck_unit5_id == req.deck_unit[5] &&
deckInfo[deckindex].deck_unit6_id == req.deck_unit[6] &&
deckInfo[deckindex].deck_unit7_id == req.deck_unit[7] &&
deckInfo[deckindex].deck_unit8_id == req.deck_unit[8])
{
//모든 정보가 같으면 업데이트 하지않음
return makeResp(deckInfo[deckindex]);
}
//덱 유닛 저장
DeckInfo changeDeck = new DeckInfo();
deckInfo[deckindex].deck_unit0_id = req.deck_unit[0];
deckInfo[deckindex].deck_unit1_id = req.deck_unit[1];
deckInfo[deckindex].deck_unit2_id = req.deck_unit[2];
deckInfo[deckindex].deck_unit3_id = req.deck_unit[3];
deckInfo[deckindex].deck_unit4_id = req.deck_unit[4];
deckInfo[deckindex].deck_unit5_id = req.deck_unit[5];
deckInfo[deckindex].deck_unit6_id = req.deck_unit[6];
deckInfo[deckindex].deck_unit7_id = req.deck_unit[7];
deckInfo[deckindex].deck_unit8_id = req.deck_unit[8];
changeDeck.id = deckInfo[deckindex].id;
changeDeck.deck_type = deckInfo[deckindex].deck_type;
changeDeck.user_id = deckInfo[deckindex].user_id;
changeDeck.deck_unit0_id = req.deck_unit[0];
changeDeck.deck_unit1_id = req.deck_unit[1];
changeDeck.deck_unit2_id = req.deck_unit[2];
changeDeck.deck_unit3_id = req.deck_unit[3];
changeDeck.deck_unit4_id = req.deck_unit[4];
changeDeck.deck_unit5_id = req.deck_unit[5];
changeDeck.deck_unit6_id = req.deck_unit[6];
changeDeck.deck_unit7_id = req.deck_unit[7];
changeDeck.deck_unit8_id = req.deck_unit[8];
Statics.deckInfoSQL.Update(changeDeck);
return makeResp(changeDeck);
Statics.deckInfoSQL.Update(deckInfo[deckindex]);
return makeResp(deckInfo[deckindex]);
}
public override Protocol ProtocolValue() => Protocol.DeckChange;