#include "stdafx.h" #include "UserIDTable.h" #include "UIDAgentDispatch.h" #include "SendAgentPacket.h" #include #include #include #include #include #include // ´ë¸¸ÀÇ °ú±ÝŸÀÔÀº, ¸Å 30ºÐ¸¶´Ù ½Ã°£À» Á¦ÇÏ´Â ¹æ½ÄÀ¸·Î ÁøÇàµÈ´Ù. // ½Ã°£À» Á¦ÇÏ´Â ·çƾÀº, Áß°è¼­¹ö¿¡¼­ ÁøÇàÇÑ´Ù. bool CUIDAgentDispatch::ProcessBillingYouxiLand(PktUUT* lpPktUUT) { unsigned char Cmd = lpPktUUT->m_cCmd; unsigned long ServerID = lpPktUUT->m_dwServerID; unsigned long SessionID = lpPktUUT->m_dwSessionID; unsigned long UserID = lpPktUUT->m_dwUserID; unsigned long CharID = lpPktUUT->m_dwCharID; char *AccountName = lpPktUUT->m_strAccount; char *Password = lpPktUUT->m_strPassword; IN_ADDR& IPAddress = lpPktUUT->m_IPAddress; // »õ Áߺ¹·Î±×ÀÎ ¹× ·Î±×Àηα׾ƿô ·Î±× ·çƾ switch(Cmd) { case PktUUT::UpdateUIDTableUserLogin: { CPerformanceInstrument userLogin("UserLogin"); CAutoInstrument autoInstrument(userLogin); // ŰÆÛ °ü·Ã ó¸® RE_USPCheckBilling_Login GetData = {0,}; if(!DBComponent::BillingDB::USPCheckBilling_Login(CDBSingleObject::GetInstance(), AccountName, UserID, 0, inet_ntoa(IPAddress), GetGroup(), &GetData)) { SERLOG6(g_Log, "À¯Àú(%u) [%s] ¼­¹ö(0x%08x) ST:%d USPCheckBilling_Login È£Ãâ ½ÇÆÐ %s : %s", UserID, AccountName, ServerID, Cmd, inet_ntoa(IPAddress), CDBSingleObject::GetInstance().GetErrorString()); // DB Query½ÇÆÐ(Ŭ¶óÀÌ¾ðÆ®¿¡´Â ¿¡·¯ 1¹ø (¼­¹ö¿¡¼­ ¿¡·¯°¡ ³µ½À´Ï´Ù) ¹ß»ý AgentSendPacket::SendUpdateUIDTable(GetGroup(), Cmd, UserID, 4, 0, 0, 'N', 0, 0); return true; } // ¾÷µ¥ÀÌÆ® Ack if(0 != GetData.Flag) { AgentSendPacket::SendUpdateUIDTable(GetGroup(), Cmd, UserID, 20, 0, 0, 'N', 0, 0); return true; } // DETLOG7(g_Log, "À¯Àú(%u) [%s] ¼­¹ö(0x%08x) ST:%d USPCheckBilling_Login È£Ãâ ¸®ÅÏ °ª Ãâ·Â. %u, %u [%s]", // UserID, AccountName, ServerID, Cmd, GetData.Flag, GetData.intCRMIndex1, inet_ntoa(IPAddress)); } break; case PktUUT::UpdateUIDTableCharLogin: { CPerformanceInstrument charLogin("CharLogin"); CAutoInstrument autoInstrument(charLogin); // ŰÆÛ °ü·Ã ó¸® RE_USPCheckBilling_Login GetData = {0,}; if(!DBComponent::BillingDB::USPCheckBilling_CharIDLogin(CDBSingleObject::GetInstance(), AccountName, UserID, 0, inet_ntoa(IPAddress), GetGroup(), &GetData)) { SERLOG6(g_Log, "À¯Àú(%u) [%s] ¼­¹ö(0x%08x) ST:%d USPCheckBilling_CharIDLogin È£Ãâ ½ÇÆÐ %s : %s", UserID, AccountName, ServerID, Cmd, inet_ntoa(IPAddress), CDBSingleObject::GetInstance().GetErrorString()); // DB Query½ÇÆÐ(Ŭ¶óÀÌ¾ðÆ®¿¡´Â ¿¡·¯ 1¹ø (¼­¹ö¿¡¼­ ¿¡·¯°¡ ³µ½À´Ï´Ù) ¹ß»ý AgentSendPacket::SendUpdateUIDTable(GetGroup(), Cmd, UserID, 4, 0, 0, 'N', 0, 0); return true; } // ¾÷µ¥ÀÌÆ® Ack if(0 != GetData.Flag) { AgentSendPacket::SendUpdateUIDTable(GetGroup(), Cmd, UserID, 20, 0, 0, 'N', 0, 0); return true; } // DETLOG7(g_Log, "À¯Àú(%u) [%s] ¼­¹ö(0x%08x) ST:%d USPCheckBilling_CharIDLogin È£Ãâ ¸®ÅÏ °ª Ãâ·Â. %u, %u [%s]", // UserID, AccountName, ServerID, Cmd, GetData.Flag, GetData.intCRMIndex1, inet_ntoa(IPAddress)); } break; case PktUUT::UpdateUIDTableUserLogout: case PktUUT::UpdateUIDTableCharLogout: { CPerformanceInstrument logout("Logout"); CAutoInstrument autoInstrument(logout); // ŰÆÛ ó¸® unsigned long Return = 0; if(!DBComponent::BillingDB::USPCheckBilling_LogOut(CDBSingleObject::GetInstance(), AccountName, &Return)) { SERLOG5(g_Log, "À¯Àú(%u) [%s] ¼­¹ö(0x%08x) ST:%d USPCheckBilling_LogOut È£Ãâ ½ÇÆÐ : %s", UserID, AccountName, ServerID, Cmd, CDBSingleObject::GetInstance().GetErrorString()); return true; } if(0 != Return) { SERLOG5(g_Log, "À¯Àú(%u) [%s] ¼­¹ö(0x%08x) ST:%d USPCheckBilling_LogOut È£Ãâ ¸®ÅÏ ¿¡·¯. %u", UserID, AccountName, ServerID, Cmd, Return); } /* else { DETLOG5(g_Log, "À¯Àú(%u) [%s] ¼­¹ö(0x%08x) ST:%d USPCheckBilling_LogOut È£Ãâ ¸®ÅÏ °ª Ãâ·Â. %u", UserID, AccountName, ServerID, Cmd, Return); } */ } break; case PktUUT::UpdateUIDTableUserMove: case PktUUT::UpdateUIDTableCharMove: { CPerformanceInstrument move("ZoneMove"); CAutoInstrument autoInstrument(move); // ŰÆÛ ó¸® unsigned long Return = 0; if(!DBComponent::BillingDB::USPCheckBilling_LogOut(CDBSingleObject::GetInstance(), AccountName, &Return)) { SERLOG5(g_Log, "À¯Àú(%u) [%s] ¼­¹ö(0x%08x) ST:%d USPCheckBilling_LogOut È£Ãâ ½ÇÆÐ : %s", UserID, AccountName, ServerID, Cmd, CDBSingleObject::GetInstance().GetErrorString()); return true; } if(0 != Return) { SERLOG5(g_Log, "À¯Àú(%u) [%s] ¼­¹ö(0x%08x) ST:%d USPCheckBilling_LogOut È£Ãâ ¸®ÅÏ ¿¡·¯. %u", UserID, AccountName, ServerID, Cmd, Return); } /* else { DETLOG5(g_Log, "À¯Àú(%u) [%s] ¼­¹ö(0x%08x) ST:%d USPCheckBilling_LogOut È£Ãâ ¸®ÅÏ °ª Ãâ·Â. %u", UserID, AccountName, ServerID, Cmd, Return); } */ } break; }; // ¿ä½Ã·£µå °ú±Ý ó¸® ·çƾ switch(Cmd) { case PktUUT::UpdateUIDTableUserLogin: case PktUUT::UpdateUIDTableBillingCheck: { // ´ë¸¸ ºô¸µ PAY_AUTH PayAuth = {0,}; // 12ºÐ´ç 20Æ÷ÀÎÆ®¸¦ °ú±Ý󸮸¦ Çϴµí // PayAUthMyth Äõ¸®¾È¿¡ °¡¸é °Å±â¼­ 12, 20À̶õ ¼ýÀÚ¸¦ °¡Áö°í 󸮸¦ ÇÑ´Ù. if (!DBComponent::BillingDB::PayAuthMyth(CDBSingleObject::GetInstance(), AccountName, inet_ntoa(IPAddress), &PayAuth)) { SERLOG6(g_Log, "À¯Àú(%u) [%s] ¼­¹ö(0x%08x) ST:%d PayAuthMyth È£Ãâ ½ÇÆÐ %s : %s", UserID, AccountName, ServerID, Cmd, inet_ntoa(IPAddress), CDBSingleObject::GetInstance().GetErrorString()); if(PktUUT::UpdateUIDTableUserLogin == Cmd) { // À¯Àú ·Î±×ÀÎÀ̸é, ·Î±×ÀÎ Ãë¼Ò! unsigned long Return = 0; if(!DBComponent::BillingDB::USPCheckBilling_LogOut(CDBSingleObject::GetInstance(), AccountName, &Return)) { SERLOG5(g_Log, "À¯Àú(%u) [%s] ¼­¹ö(0x%08x) ST:%d PayAuthMyth È£Ãâ ½ÇÆÐ·Î ·Î±×¾Æ¿ôÇÔ. USPCheckBilling_LogOut È£Ãâ ½ÇÆÐ : %s", UserID, AccountName, ServerID, Cmd, CDBSingleObject::GetInstance().GetErrorString()); return true; } if(0 != Return) { SERLOG5(g_Log, "À¯Àú(%u) [%s] ¼­¹ö(0x%08x) ST:%d - ºô¸µ ÇÁ·Î½ÃÀú È£Ãâ ½ÇÆÐ ·Î±×¾Æ¿ô - USPCheckBilling_LogOut È£Ãâ ¸®ÅÏ ¿¡·¯. %u", UserID, AccountName, ServerID, Cmd, Return); } else { DETLOG5(g_Log, "À¯Àú(%u) [%s] ¼­¹ö(0x%08x) ST:%d - ºô¸µ ÇÁ·Î½ÃÀú È£Ãâ ½ÇÆÐ ·Î±×¾Æ¿ô - USPCheckBilling_LogOut È£Ãâ ¸®ÅÏ °ª Ãâ·Â. %u", UserID, AccountName, ServerID, Cmd, Return); } } return true; } // ¾÷µ¥ÀÌÆ® Ack if(FALSE == CServerSetup::GetInstance().GetIgnoreFlag()) { if(0 != PayAuth.Errcode && Cmd == PktUUT::UpdateUIDTableUserLogin) { // À¯Àú ·Î±×ÀÎÀ̸é, ·Î±×ÀÎ Ãë¼Ò! unsigned long Return = 0; if(!DBComponent::BillingDB::USPCheckBilling_LogOut(CDBSingleObject::GetInstance(), AccountName, &Return)) { SERLOG6(g_Log, "À¯Àú(%u) [%s] ¼­¹ö(0x%08x) ST:%d PayAuthMyth(Err:%d) USPCheckBilling_LogOut È£Ãâ ½ÇÆÐ : %s", UserID, AccountName, ServerID, Cmd, PayAuth.Errcode, CDBSingleObject::GetInstance().GetErrorString()); return true; } if(0 != Return) { SERLOG5(g_Log, "À¯Àú(%u) [%s] ¼­¹ö(0x%08x) ST:%d - ºô¸µ ÇÁ·Î½ÃÀú °á°ú ½ÇÆÐ ·Î±×¾Æ¿ô - USPCheckBilling_LogOut È£Ãâ ¸®ÅÏ ¿¡·¯. %u", UserID, AccountName, ServerID, Cmd, Return); } else { DETLOG5(g_Log, "À¯Àú(%u) [%s] ¼­¹ö(0x%08x) ST:%d - ºô¸µ ÇÁ·Î½ÃÀú °á°ú ½ÇÆÐ ·Î±×¾Æ¿ô - USPCheckBilling_LogOut È£Ãâ ¸®ÅÏ °ª Ãâ·Â. %u", UserID, AccountName, ServerID, Cmd, Return); } } AgentSendPacket::SendUpdateUIDTable(GetGroup(), Cmd, UserID, PayAuth.Errcode, PayAuth.Time, 0, 'Y', static_cast(PayAuth.WarningCode), 0); } else { AgentSendPacket::SendUpdateUIDTable(GetGroup(), Cmd, UserID, 0, 0, 0, 'N', 0, 0); } // DETLOG7(g_Log, "À¯Àú(%u) [%s] ¼­¹ö(0x%08x) ST:%d - PayAuthMyth È£Ãâ ¸®ÅÏ °ª Ãâ·Â. Error:%u Time:%u, [%s]", // UserID, AccountName, ServerID, Cmd, PayAuth.Errcode, PayAuth.Time, inet_ntoa(IPAddress)); } break; case PktUUT::UpdateUIDTableCharLogin: { AgentSendPacket::SendUpdateUIDTable(GetGroup(), Cmd, UserID, 0, 0, 0, 'N', 0, 0); } break; case PktUUT::UpdateUIDTableUserLogout: case PktUUT::UpdateUIDTableCharLogout: case PktUUT::UpdateUIDTableUserMove: case PktUUT::UpdateUIDTableCharMove: break; } return true; } bool CUIDAgentDispatch::ProcessDisconnectYouxiLand() { unsigned long dwResult = 0; if(!DBComponent::BillingDB::USPServer_End(CDBSingleObject::GetInstance(), m_Group, &dwResult)) { SERLOG3(g_Log, "%d ±×·ì ·Î±×¾Æ¿ô ½ÇÆÐ. °á°ú°ª:0x%08x DB¿¡·¯ ·Î±×:%s", m_Group, dwResult, CDBSingleObject::GetInstance().GetErrorString()); } else { SERLOG1(g_Log, "%d ±×·ì USEServer_End È£Ãâ ¼º°ø", m_Group); } return true; }