1
This commit is contained in:
parent
d7ef8221df
commit
5151dadc0c
@ -101,6 +101,7 @@ void HandlerMgr::RegisterNetMsgHandlers()
|
|||||||
|
|
||||||
RegisterNetMsgHandler(&wsmsghandler, &Player::_CMSendChatMsg);
|
RegisterNetMsgHandler(&wsmsghandler, &Player::_CMSendChatMsg);
|
||||||
RegisterNetMsgHandler(&wsmsghandler, &Player::_CMSendCustomMsg);
|
RegisterNetMsgHandler(&wsmsghandler, &Player::_CMSendCustomMsg);
|
||||||
|
RegisterNetMsgHandler(&wsmsghandler, &Player::_CMDirtyWordCheck);
|
||||||
|
|
||||||
RegisterNetMsgHandler(&wsmsghandler, &Player::_CMTeamCreate);
|
RegisterNetMsgHandler(&wsmsghandler, &Player::_CMTeamCreate);
|
||||||
RegisterNetMsgHandler(&wsmsghandler, &Player::_CMTeamJoin);
|
RegisterNetMsgHandler(&wsmsghandler, &Player::_CMTeamJoin);
|
||||||
|
@ -552,6 +552,49 @@ void Player::_CMSendCustomMsg(f8::MsgHdr& hdr, const cs::CMSendCustomMsg& msg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Player::_CMDirtyWordCheck(f8::MsgHdr& hdr, const cs::CMDirtyWordCheck& msg)
|
||||||
|
{
|
||||||
|
std::string ip;
|
||||||
|
int port = 0;
|
||||||
|
JsonDataMgr::Instance()->GetRankServerConf(ip, port);
|
||||||
|
|
||||||
|
a8::MutableXObject* params = a8::MutableXObject::NewObject();
|
||||||
|
params->SetVal("text", msg.text());
|
||||||
|
f8::HttpClientPool::Instance()->HttpGet
|
||||||
|
(
|
||||||
|
a8::XParams()
|
||||||
|
.SetSender(AccountId())
|
||||||
|
.SetParam1(hdr.socket_handle),
|
||||||
|
[] (a8::XParams& param, a8::XObject& data)
|
||||||
|
{
|
||||||
|
cs::SMDirtyWordCheck respmsg;
|
||||||
|
Player* hum = PlayerMgr::Instance()->GetPlayerByAccountId(param.sender);
|
||||||
|
if (hum) {
|
||||||
|
if (data.At("errcode")->AsXValue().GetInt() == 0) {
|
||||||
|
hum->SendMsg(respmsg);
|
||||||
|
} else {
|
||||||
|
respmsg.set_errcode(data.At("errcode")->AsXValue());
|
||||||
|
respmsg.set_errmsg(data.At("errmsg")->AsXValue());
|
||||||
|
hum->SendMsg(respmsg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[] (a8::XParams& param, const std::string& response)
|
||||||
|
{
|
||||||
|
Player* hum = PlayerMgr::Instance()->GetPlayerByAccountId(param.sender);
|
||||||
|
if (hum) {
|
||||||
|
#if 0
|
||||||
|
hum->ShowErrorMsg("服务器内部错误");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
},
|
||||||
|
a8::Format("http://%s:%d/webapp/index.php?c=Guild&a=dirtyWordCheck", {ip, port}).c_str(),
|
||||||
|
*params,
|
||||||
|
rand()
|
||||||
|
);
|
||||||
|
delete params;
|
||||||
|
}
|
||||||
|
|
||||||
void Player::_CMTeamCreate(f8::MsgHdr& hdr, const cs::CMTeamCreate& msg)
|
void Player::_CMTeamCreate(f8::MsgHdr& hdr, const cs::CMTeamCreate& msg)
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -95,6 +95,7 @@ class Player
|
|||||||
|
|
||||||
void _CMSendChatMsg(f8::MsgHdr& hdr, const cs::CMSendChatMsg& msg);
|
void _CMSendChatMsg(f8::MsgHdr& hdr, const cs::CMSendChatMsg& msg);
|
||||||
void _CMSendCustomMsg(f8::MsgHdr& hdr, const cs::CMSendCustomMsg& msg);
|
void _CMSendCustomMsg(f8::MsgHdr& hdr, const cs::CMSendCustomMsg& msg);
|
||||||
|
void _CMDirtyWordCheck(f8::MsgHdr& hdr, const cs::CMDirtyWordCheck& msg);
|
||||||
|
|
||||||
void _CMTeamCreate(f8::MsgHdr& hdr, const cs::CMTeamCreate& msg);
|
void _CMTeamCreate(f8::MsgHdr& hdr, const cs::CMTeamCreate& msg);
|
||||||
void _CMTeamJoin(f8::MsgHdr& hdr, const cs::CMTeamJoin& msg);
|
void _CMTeamJoin(f8::MsgHdr& hdr, const cs::CMTeamJoin& msg);
|
||||||
|
@ -497,6 +497,17 @@ void GuildMgr::__GuildConfirmed(f8::JsonHttpRequest* request)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GuildMgr::__GuildDirtyWordCheck(f8::JsonHttpRequest* request)
|
||||||
|
{
|
||||||
|
request->resp_xobj->SetVal("errcode", 0);
|
||||||
|
request->resp_xobj->SetVal("errmsg", "");
|
||||||
|
std::string text = request->request.At("text")->AsXValue();
|
||||||
|
if (MetaMgr::Instance()->HasDirtyWord(text)) {
|
||||||
|
request->resp_xobj->SetVal("errcode", 1);
|
||||||
|
request->resp_xobj->SetVal("errmsg", "含有屏蔽字符");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void GuildMgr::__GenTestData(f8::JsonHttpRequest* request)
|
void GuildMgr::__GenTestData(f8::JsonHttpRequest* request)
|
||||||
{
|
{
|
||||||
if (!load_done_) {
|
if (!load_done_) {
|
||||||
|
@ -25,6 +25,7 @@ class GuildMgr : public a8::Singleton<GuildMgr>
|
|||||||
void __GuildRename(f8::JsonHttpRequest* request);
|
void __GuildRename(f8::JsonHttpRequest* request);
|
||||||
void __GuildRank(f8::JsonHttpRequest* request);
|
void __GuildRank(f8::JsonHttpRequest* request);
|
||||||
void __GuildConfirmed(f8::JsonHttpRequest* request);
|
void __GuildConfirmed(f8::JsonHttpRequest* request);
|
||||||
|
void __GuildDirtyWordCheck(f8::JsonHttpRequest* request);
|
||||||
void __GenTestData(f8::JsonHttpRequest* request);
|
void __GenTestData(f8::JsonHttpRequest* request);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -60,6 +60,11 @@ void HandlerMgr::Init()
|
|||||||
{
|
{
|
||||||
GuildMgr::Instance()->__GuildConfirmed(request);
|
GuildMgr::Instance()->__GuildConfirmed(request);
|
||||||
});
|
});
|
||||||
|
RegisterGMMsgHandler("Guild@dirtyWordCheck",
|
||||||
|
[] (f8::JsonHttpRequest* request)
|
||||||
|
{
|
||||||
|
GuildMgr::Instance()->__GuildDirtyWordCheck(request);
|
||||||
|
});
|
||||||
RegisterGMMsgHandler("Guild@genTestData",
|
RegisterGMMsgHandler("Guild@genTestData",
|
||||||
[] (f8::JsonHttpRequest* request)
|
[] (f8::JsonHttpRequest* request)
|
||||||
{
|
{
|
||||||
|
@ -25,6 +25,7 @@ enum CMMessageId_e
|
|||||||
_CMSendCustomMsg = 152;
|
_CMSendCustomMsg = 152;
|
||||||
_CMUpdateTempCustomData = 153;
|
_CMUpdateTempCustomData = 153;
|
||||||
_CMUpdateUserInfo = 154;
|
_CMUpdateUserInfo = 154;
|
||||||
|
_CMDirtyWordCheck = 155;
|
||||||
|
|
||||||
_CMGuildMsgBegin = 230;
|
_CMGuildMsgBegin = 230;
|
||||||
_CMGuildCreate = 231;
|
_CMGuildCreate = 231;
|
||||||
@ -76,6 +77,8 @@ enum SMMessageId_e
|
|||||||
_SMRecommandFriend = 117;
|
_SMRecommandFriend = 117;
|
||||||
_SMFriendIdList = 118;
|
_SMFriendIdList = 118;
|
||||||
|
|
||||||
|
_SMDirtyWordCheck = 155;
|
||||||
|
|
||||||
_SMGuildMsgBegin = 230;
|
_SMGuildMsgBegin = 230;
|
||||||
_SMGuildCreate = 231;
|
_SMGuildCreate = 231;
|
||||||
_SMGuildJoin = 232;
|
_SMGuildJoin = 232;
|
||||||
|
@ -169,6 +169,18 @@ message CMUpdateUserInfo
|
|||||||
optional int32 delay_flag = 101; //延迟更新标志(只能为1-16),相同的flag定时器覆盖
|
optional int32 delay_flag = 101; //延迟更新标志(只能为1-16),相同的flag定时器覆盖
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//屏蔽字检查
|
||||||
|
message CMDirtyWordCheck
|
||||||
|
{
|
||||||
|
optional string text = 2; //待检查文本
|
||||||
|
}
|
||||||
|
//屏蔽字检查回复
|
||||||
|
message SMDirtyWordCheck
|
||||||
|
{
|
||||||
|
optional int32 errcode = 1; //错误消息
|
||||||
|
optional string errmsg = 2; //错误消息
|
||||||
|
}
|
||||||
|
|
||||||
//获取好友列表
|
//获取好友列表
|
||||||
message CMFriendList
|
message CMFriendList
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user