닉네임 변경 수정

This commit is contained in:
김판돌 2024-02-25 02:40:47 +09:00
parent 1a1c8f5e78
commit ec0ec91c20
1 changed files with 15 additions and 6 deletions

View File

@ -18,17 +18,24 @@ namespace Server.Service
User user = Statics.userSQL.SelectUuid(req.uuid);
string newNickname = req.newNickname;
string regular = @"^[가-힣a-zA-Z0-9\s]*$";
string defaultNick = Statics.dynamicDataSQL.SelectName("defaultNick").value;
int buy;
//만약 시스템 설정과 같은 닉네임이 온다면 중복 처리
if (newNickname == defaultNick)
{
throw new RuntimeException("Duplicate nickname", Error.errordata);
}
//닉네임 체크
//if(!Regex.IsMatch(newNickname, regular) || (newNickname.Length < 2 || newNickname.Length > 16) || user.nickname == newNickname)
//{
// //해당 데이터가 들어온다면 유저 정보와 같이 로그를 남기게 만들것
// throw new RuntimeException("Nickname not allowed", Error.errordata);
//}
if (!Regex.IsMatch(newNickname, regular) || (newNickname.Length < 2 || newNickname.Length > 16) || user.nickname == newNickname)
{
//해당 데이터가 들어온다면 유저 정보와 같이 로그를 남기게 만들것
throw new RuntimeException("Nickname not allowed", Error.errordata);
}
//가격 체크
if (user.nickname == Statics.dynamicDataSQL.SelectName("defaultNick").value)
if (user.nickname == defaultNick)
buy = 0;
else
buy = int.Parse(Statics.dynamicDataSQL.SelectName("nicknameCash").value);
@ -39,6 +46,8 @@ namespace Server.Service
throw new RuntimeException("Cache shortage", Error.nogold);
}
//닉네임 중복 검사
user.nickname = newNickname;
SaveSQL();