📄 sbillingplayer.cpp
字号:
__END_CATCH}// send interval validation packetvoid SBillingPlayer::sendIntervalValidation() throw ( ProtocolException, Error ){ __BEGIN_TRY CBillingPacketHeader header; CBillingPacketRequestIntervalValidationBody body; header.Packet_Type = CBILLING_PACKET_REQUEST; header.Method_Code = CBILLING_METHOD_CODE_INTERVAL_VALIDATION; header.Session_ID = 1; header.Body_Length = szCBillingPacketRequestIntervalValidationBodyInfo; header.write( *m_pOutputStream ); body.write( *m_pOutputStream );#ifdef __Cout_CBILLING_SYSTEM__ cout << "----------------------------------------------------------------" << endl; cout << "Request Interval Validation : " << body.Parameter_Value << " min" << endl; cout << header.toString().c_str() << endl; cout << body.toString().c_str() << endl;#endif filelog( LOGFILE_CBILLING_PLAYER, "Request Interval Validation : %s\n%s\n%s", body.Parameter_Value, header.toString().c_str(), body.toString().c_str() ); __END_CATCH}// send login packetvoid SBillingPlayer::sendLogin( PayUser* pPayUser ) throw ( ProtocolException, Error ){ __BEGIN_TRY CBillingPacketHeader header; CBillingPacketRequestLoginBody body; header.Packet_Type = CBILLING_PACKET_REQUEST; header.Method_Code = CBILLING_METHOD_CODE_LOGIN; header.Session_ID = 1; header.Body_Length = szCBillingPacketRequestLoginBodyInfo; strcpy( body.Login_Name, pPayUser->getName().c_str() ); strcpy( body.Player_IP, pPayUser->getName().c_str() ); strcpy( body.Player_MAC, pPayUser->getName().c_str() ); header.write( *m_pOutputStream ); body.write( *m_pOutputStream ); pPayUser->setSendTime();#ifdef __Cout_CBILLING_SYSTEM__ cout << "----------------------------------------------------------------" << endl; cout << "Request Login : " << body.Login_Name << endl; cout << header.toString().c_str() << endl; cout << body.toString().c_str() << endl;#endif filelog( LOGFILE_CBILLING_PLAYER, "Request Login : %s\n%s\n%s", body.Login_Name, header.toString().c_str(), body.toString().c_str() ); __END_CATCH}// send minus point packetvoid SBillingPlayer::sendMinusPoint( PayUser* pPayUser ) throw ( ProtocolException, Error ){ __BEGIN_TRY CBillingPacketHeader header; CBillingPacketRequestMinusPointBody body; header.Packet_Type = CBILLING_PACKET_REQUEST; header.Method_Code = CBILLING_METHOD_CODE_MINUS_POINT; header.Session_ID = 1; header.Body_Length = szCBillingPacketRequestMinusPointBodyInfo; strcpy( body.Login_Name, pPayUser->getName().c_str() ); header.write( *m_pOutputStream ); body.write( *m_pOutputStream ); pPayUser->setSendTime();#ifdef __Cout_CBILLING_SYSTEM__ cout << "----------------------------------------------------------------" << endl; cout << "Request Minus Point : " << body.Login_Name << endl; cout << header.toString().c_str() << endl; cout << body.toString().c_str() << endl;#endif filelog( LOGFILE_CBILLING_PLAYER, "Request Minus Point : %s\n%s\n%s", body.Login_Name, header.toString().c_str(), body.toString().c_str() ); __END_CATCH}// send minus minute packetvoid SBillingPlayer::sendMinusMinute( PayUser* pPayUser ) throw ( ProtocolException, Error ){ __BEGIN_TRY CBillingPacketHeader header; CBillingPacketRequestMinusMinuteBody body; header.Packet_Type = CBILLING_PACKET_REQUEST; header.Method_Code = CBILLING_METHOD_CODE_MINUS_MINUTE; header.Session_ID = 1; header.Body_Length = szCBillingPacketRequestMinusMinuteBodyInfo; strcpy( body.Login_Name, pPayUser->getName().c_str() ); header.write( *m_pOutputStream ); body.write( *m_pOutputStream ); pPayUser->setSendTime();#ifdef __Cout_CBILLING_SYSTEM__ cout << "----------------------------------------------------------------" << endl; cout << "Request Minus Minute : " << body.Login_Name << endl; cout << header.toString().c_str() << endl; cout << body.toString().c_str() << endl;#endif filelog( LOGFILE_CBILLING_PLAYER, "Request Minus Minute : %s\n%s\n%s", body.Login_Name, header.toString().c_str(), body.toString().c_str() ); __END_CATCH}// send logout packetvoid SBillingPlayer::sendLogout( PayUser* pPayUser ) throw ( ProtocolException, Error ){ __BEGIN_TRY CBillingPacketHeader header; CBillingPacketRequestLogoutBody body; header.Packet_Type = CBILLING_PACKET_REQUEST; header.Method_Code = CBILLING_METHOD_CODE_LOGOUT; header.Session_ID = 1; header.Body_Length = szCBillingPacketRequestLogoutBodyInfo; strcpy( body.Login_Name, pPayUser->getName().c_str() ); header.write( *m_pOutputStream ); body.write( *m_pOutputStream ); pPayUser->setSendTime();#ifdef __Cout_CBILLING_SYSTEM__ cout << "----------------------------------------------------------------" << endl; cout << "Request Logout : " << body.Login_Name << endl; cout << header.toString().c_str() << endl; cout << body.toString().c_str() << endl;#endif filelog( LOGFILE_CBILLING_PLAYER, "Request Logout : %s\n%s\n%s", body.Login_Name, header.toString().c_str(), body.toString().c_str() ); __END_CATCH}void SBillingPlayer::executeError( CBillingPacketHeader& header, CBillingPacketErrorBody& body ) throw ( IOException, Error ){ __BEGIN_TRY // 蜡丰 场车促 漏妨扼~ PayUser* pPayUser = g_pPayUserManager->getUser( body.Login_Name ); pPayUser->setRecvTime(); pPayUser->setLeftTime( 0 );#ifdef __Cout_CBILLING_SYSTEM__ cout << "----------------------------------------------------------------" << endl; cout << "Response Error : " << body.Login_Name << endl; cout << body.Return_Message << endl; cout << header.toString().c_str() << endl; cout << body.toString().c_str() << endl;#endif filelog( LOGFILE_CBILLING_PACKET, "Response Error : %s\n%s\n%s", body.Login_Name, header.toString().c_str(), body.toString().c_str() ); __END_CATCH}void SBillingPlayer::executeIntervalValidation( CBillingPacketHeader& header, CBillingPacketResponseIntervalValidationBody& body ) throw ( IOException, Error ){ __BEGIN_TRY if ( atoi(body.Parameter_Value) != g_pSBillingPlayerManager->getMinusIntervalInt() ) { // 霸烙辑滚客 吝惫 呼傅 辑滚埃俊 minus interval 捞 嘎瘤 臼促. 磷绢具 茄促. cerr << "-------------------------------------------------------------------------------" << endl; cerr << "Interval configuration is different between gameserver and china billing server" << endl; cerr << "gameserver interval : " << g_pSBillingPlayerManager->getMinusIntervalInt() << ", china billing server interval : " << body.Parameter_Value << endl; cerr << "-------------------------------------------------------------------------------" << endl; filelog( LOGFILE_CBILLING_ERROR, "Different Interval between gameserver and china billing server\ngameserver interval : %d, china billing server interval : %s", g_pSBillingPlayerManager->getMinusIntervalInt(), body.Parameter_Value ); // 磷绢扼. 孺孺 ばば. //kill( getpid(), 9 ); }#ifdef __Cout_CBILLING_SYSTEM__ cout << "----------------------------------------------------------------" << endl; cout << "Response Interval Validation : " << body.Parameter_Value << endl; cout << header.toString().c_str() << endl; cout << body.toString().c_str() << endl;#endif filelog( LOGFILE_CBILLING_PACKET, "Response Interval Validation : %s\n%s\n%s", body.Parameter_Value, header.toString().c_str(), body.toString().c_str() ); __END_CATCH}void SBillingPlayer::executeLogin( CBillingPacketHeader& header, CBillingPacketResponseLoginBody& body ) throw ( IOException, Error ){ __BEGIN_TRY PayUser* pPayUser = g_pPayUserManager->getUser( body.Login_Name ); pPayUser->setRecvTime(); if ( body.Free_Left_Time + body.Rating_Left_Time <= 0 ) pPayUser->setLeftTime( 0 ); // disconnect if no Left Time#ifdef __Cout_CBILLING_SYSTEM__ cout << "----------------------------------------------------------------" << endl; cout << "Response Login OK : " << body.Login_Name << " has no left time. DISCONNECT" << endl; cout << header.toString().c_str() << endl; cout << body.toString().c_str() << endl;#endif filelog( LOGFILE_CBILLING_PACKET, "Response Login OK : %s has no left time. DISCONNECT\n%s\n%s", body.Login_Name, header.toString().c_str(), body.toString().c_str() );#ifdef __Cout_CBILLING_SYSTEM__ // cout << "----------------------------------------------------------------" << endl; // cout << "Response Login OK : " << body.Login_Name << endl; // cout << header.toString().c_str() << endl; // cout << body.toString().c_str() << endl;#endif // filelog( LOGFILE_CBILLING_PACKET, "Response Login OK : %s\n%s\n%s", body.Login_Name, header.toString().c_str(), body.toString().c_str() ); __END_CATCH}void SBillingPlayer::executeMinusPoint( CBillingPacketHeader& header, CBillingPacketResponseMinusPointBody& body ) throw ( IOException, Error ){ __BEGIN_TRY PayUser* pPayUser = g_pPayUserManager->getUser( body.Login_Name ); pPayUser->setRecvTime();#ifdef __Cout_CBILLING_SYSTEM__ cout << "----------------------------------------------------------------" << endl; cout << "Response Minus Point : " << body.Login_Name << endl; cout << header.toString().c_str() << endl; cout << body.toString().c_str() << endl;#endif filelog( LOGFILE_CBILLING_PACKET, "Response Minus Point : %s\n%s\n%s", body.Login_Name, header.toString().c_str(), body.toString().c_str() ); __END_CATCH}void SBillingPlayer::executeMinusMinute( CBillingPacketHeader& header, CBillingPacketResponseMinusMinuteBody& body ) throw ( IOException, Error ){ __BEGIN_TRY PayUser* pPayUser = g_pPayUserManager->getUser( body.Login_Name ); pPayUser->setRecvTime();#ifdef __Cout_CBILLING_SYSTEM__ cout << "----------------------------------------------------------------" << endl; cout << "Response Minus Minute : " << body.Login_Name << endl; cout << header.toString().c_str() << endl; cout << body.toString().c_str() << endl;#endif filelog( LOGFILE_CBILLING_PACKET, "Response Minus Minute : %s\n%s\n%s", body.Login_Name, header.toString().c_str(), body.toString().c_str() ); __END_CATCH}void SBillingPlayer::executeLogout( CBillingPacketHeader& header, CBillingPacketResponseLogoutBody& body ) throw ( IOException, Error ){ __BEGIN_TRY PayUser* pPayUser = g_pPayUserManager->getUser( body.Login_Name ); pPayUser->setRecvTime();#ifdef __Cout_CBILLING_SYSTEM__ cout << "----------------------------------------------------------------" << endl; cout << "Response Logout OK : " << body.Login_Name << endl; cout << header.toString().c_str() << endl; cout << body.toString().c_str() << endl;#endif filelog( LOGFILE_CBILLING_PACKET, "Response Logout OK : %s\n%s\n%s", body.Login_Name, header.toString().c_str(), body.toString().c_str() ); __END_CATCH}// get debug stringstring SBillingPlayer::toString() const throw ( Error ){ __BEGIN_TRY StringStream msg; msg << "SBillingPlayer(" << "SocketID:" << m_pSocket->getSOCKET() << ",Host:"<< m_pSocket->getHost() << ",ID:" << m_ID << ")"; return msg.toString(); __END_CATCH}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -