forked from limingfan2016/game_service_system
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
9 changed files
with
1,342 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
|
||
/* author : limingfan | ||
* date : 2017.09.18 | ||
* description : 基础类型定义 | ||
*/ | ||
|
||
#ifndef __BASE_DEFINE_H__ | ||
#define __BASE_DEFINE_H__ | ||
|
||
#include "../common/MessageCenterProtocolId.h" | ||
#include "../common/MessageCenterErrorCode.h" | ||
#include "../common/CommonType.h" | ||
#include "../common/CServiceOperation.h" | ||
#include "../common/OperationManagerProtocolId.h" | ||
#include "../common/DBProxyProtocolId.h" | ||
|
||
#include "_MsgCenterCfg_.h" | ||
#include "protocol/appsrv_message_center.pb.h" | ||
|
||
|
||
using namespace NProject; | ||
|
||
typedef unordered_map<string, unsigned int> UserNameToServiceID; | ||
|
||
// 大厅、棋牌室信息 | ||
struct SHallInfo | ||
{ | ||
unsigned int serviceId; | ||
string hallId; | ||
|
||
SHallInfo() {}; | ||
SHallInfo(unsigned int srvId, const string& hId) : serviceId(srvId), hallId(hId) {}; | ||
~SHallInfo() {}; | ||
}; | ||
|
||
typedef unordered_map<string, SHallInfo> UserNameToHallInfo; | ||
|
||
|
||
#endif // __BASE_DEFINE_H__ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
|
||
/* author : liuxu | ||
* date : 2015.04.28 | ||
* description : 消息中心服务框架代码 | ||
*/ | ||
|
||
#include "CMessageSrvFrame.h" | ||
#include "CMsgCenterHandler.h" | ||
|
||
|
||
using namespace NCommon; | ||
using namespace NFrame; | ||
|
||
|
||
int CMessageSrvFrame::onInit(const char* name, const unsigned int id) | ||
{ | ||
ReleaseInfoLog("--- onInit service ---, name = %s, id = %d", name, id); | ||
return 0; | ||
} | ||
|
||
void CMessageSrvFrame::onUnInit(const char* name, const unsigned int id) | ||
{ | ||
ReleaseInfoLog("--- onUnInit service ---, name = %s, id = %d", name, id); | ||
} | ||
|
||
void CMessageSrvFrame::onRegister(const char* name, const unsigned int id) | ||
{ | ||
ReleaseInfoLog("--- onRegister module ---, name = %s, id = %d", name, id); | ||
|
||
// 注册模块实例 | ||
static CMsgCenterHandler handler1; | ||
m_pMsgHandler = &handler1; | ||
registerModule(0, &handler1); | ||
} | ||
|
||
void CMessageSrvFrame::onUpdateConfig(const char* name, const unsigned int id) | ||
{ | ||
m_pMsgHandler->loadConfig(true); | ||
} | ||
|
||
|
||
CMessageSrvFrame::CMessageSrvFrame() :IService::IService(ServiceType::MessageCenterSrv) | ||
{ | ||
|
||
} | ||
|
||
CMessageSrvFrame::~CMessageSrvFrame() | ||
{ | ||
} | ||
|
||
|
||
REGISTER_SERVICE(CMessageSrvFrame); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
|
||
/* author : liuxu | ||
* date : 2015.04.28 | ||
* description : 消息中心服务框架代码 | ||
*/ | ||
|
||
#ifndef __CMESSAGE_SVR_FRAME_H__ | ||
#define __CMESSAGE_SVR_FRAME_H__ | ||
|
||
#include "SrvFrame/IService.h" | ||
|
||
|
||
class CMsgCenterHandler; | ||
|
||
|
||
class CMessageSrvFrame : public NFrame::IService | ||
{ | ||
public: | ||
CMessageSrvFrame(); | ||
~CMessageSrvFrame(); | ||
|
||
public: | ||
virtual int onInit(const char* name, const unsigned int id); // 服务启动时被调用 | ||
virtual void onUnInit(const char* name, const unsigned int id); // 服务停止时被调用 | ||
virtual void onRegister(const char* name, const unsigned int id); // 服务启动后被调用,服务需在此注册本服务的各模块信息 | ||
virtual void onUpdateConfig(const char* name, const unsigned int id); // 服务配置更新 | ||
|
||
private: | ||
CMsgCenterHandler* m_pMsgHandler; | ||
}; | ||
|
||
#endif // __CMESSAGE_SVR_FRAME_H__ |
Oops, something went wrong.