diff --git a/server/textserver/jsondatamgr.cc b/server/textserver/jsondatamgr.cc index dc1653e..8938b7d 100644 --- a/server/textserver/jsondatamgr.cc +++ b/server/textserver/jsondatamgr.cc @@ -9,14 +9,14 @@ void JsonDataMgr::Init() { if (!f8::IsOnlineEnv()) { if (f8::IsTestEnv()) { - work_path_ = a8::Format("/root/pub/%d/%d/conf_test/game%d/rankserver.test", + work_path_ = a8::Format("/root/pub/%d/%d/conf_test/game%d/textserver.test", { GAME_ID, App::Instance()->instance_id, GAME_ID }); } else { - work_path_ = a8::Format("/root/pub/%d/%d/conf_test/game%d/rankserver.dev", + work_path_ = a8::Format("/root/pub/%d/%d/conf_test/game%d/textserver.dev", { GAME_ID, App::Instance()->instance_id, @@ -24,19 +24,12 @@ void JsonDataMgr::Init() }); } } - std::string rankserver_cluster_json_file; - std::string mysql_cluster_json_file; - mysql_cluster_json_file = a8::Format("%s/node1/friend.rankserver.mysql.cluster.json", - { - work_path_, - }); - - rankserver_cluster_json_file = a8::Format("%s/node1/friend.rankserver.cluster.json", - { - work_path_, - }); - rankserver_cluster_json_.ReadFromFile(rankserver_cluster_json_file); - mysql_cluster_json_.ReadFromFile(mysql_cluster_json_file); + std::string textserver_cluster_json_file; + textserver_cluster_json_file = a8::Format("%s/textserver.cluster.json", + { + work_path_, + }); + textserver_cluster_json_.ReadFromFile(textserver_cluster_json_file); } void JsonDataMgr::UnInit() @@ -45,18 +38,8 @@ void JsonDataMgr::UnInit() std::shared_ptr JsonDataMgr::GetConf() { - if (App::Instance()->instance_id < 1 || App::Instance()->instance_id > rankserver_cluster_json_.Size()) { + if (App::Instance()->instance_id < 1 || App::Instance()->instance_id > textserver_cluster_json_.Size()) { abort(); } - return rankserver_cluster_json_[App::Instance()->instance_id - 1]; -} - -std::shared_ptr JsonDataMgr::GetMysqlClusterConf() -{ - return std::make_shared(mysql_cluster_json_); -} - -std::shared_ptr JsonDataMgr::GetMysqlConf(int instance_id) -{ - return mysql_cluster_json_[instance_id - 1]; + return textserver_cluster_json_[App::Instance()->instance_id - 1]; } diff --git a/server/textserver/jsondatamgr.h b/server/textserver/jsondatamgr.h index 8668e3f..95f9076 100644 --- a/server/textserver/jsondatamgr.h +++ b/server/textserver/jsondatamgr.h @@ -10,12 +10,9 @@ class JsonDataMgr : public a8::Singleton void Init(); void UnInit(); - std::shared_ptr GetMysqlClusterConf(); std::shared_ptr GetConf(); - std::shared_ptr GetMysqlConf(int instance_id); private: std::string work_path_ = "../config"; - a8::XObject mysql_cluster_json_; - a8::XObject rankserver_cluster_json_; + a8::XObject textserver_cluster_json_; }; diff --git a/server/textserver/metamgr.cc b/server/textserver/metamgr.cc index b8f83a4..c7d0830 100644 --- a/server/textserver/metamgr.cc +++ b/server/textserver/metamgr.cc @@ -41,20 +41,18 @@ public: { if (!f8::IsOnlineEnv()) { if (f8::IsTestEnv()) { - res_path = a8::Format("/root/pub/%d/%d/conf_test/game%d/rankserver.test/res%d/", + res_path = a8::Format("/root/pub/%d/%d/conf_test/game%d/res/", { GAME_ID, App::Instance()->instance_id, GAME_ID, - App::Instance()->instance_id }); } else { - res_path = a8::Format("/root/pub/%d/%d/conf_test/game%d/rankserver.dev/res%d/", + res_path = a8::Format("/root/pub/%d/%d/conf_test/game%d/res/", { GAME_ID, App::Instance()->instance_id, GAME_ID, - App::Instance()->instance_id }); } } else { diff --git a/server/textserver/textmgr.cc b/server/textserver/textmgr.cc index 8602f5c..80d0d9f 100644 --- a/server/textserver/textmgr.cc +++ b/server/textserver/textmgr.cc @@ -26,12 +26,22 @@ void TextMgr::UnInit() void TextMgr::__DirtyWordCheck(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 TextMgr::__DirtyWordReplace(f8::JsonHttpRequest* request) { - + std::string text = request->request.At("text")->AsXValue(); + std::string new_text = MetaMgr::Instance()->ReplaceDirtyWord(text, '*'); + request->resp_xobj->SetVal("errcode", 0); + request->resp_xobj->SetVal("errmsg", ""); + request->resp_xobj->SetVal("new_text", new_text); } void TextMgr::__RandName(f8::JsonHttpRequest* request) @@ -41,5 +51,11 @@ void TextMgr::__RandName(f8::JsonHttpRequest* request) void TextMgr::__IsValidName(f8::JsonHttpRequest* request) { - + request->resp_xobj->SetVal("errcode", 0); + request->resp_xobj->SetVal("errmsg", ""); + std::string name = request->request.At("name")->AsXValue(); + if (MetaMgr::Instance()->HasDirtyWord(name)) { + request->resp_xobj->SetVal("errcode", 1); + request->resp_xobj->SetVal("errmsg", "含有屏蔽字符"); + } }