diff --git a/server/gameserver/httpproxy.cc b/server/gameserver/httpproxy.cc index 50cf5e12..85c58ec7 100644 --- a/server/gameserver/httpproxy.cc +++ b/server/gameserver/httpproxy.cc @@ -1,10 +1,16 @@ #include "precompile.h" +#include + #include "httpproxy.h" +#include "app.h" + +#include "framework/cpp/httpclientpool.h" + void HttpProxy::Init() { - + request_prefix_ = "game2006_" + a8::XValue(a8::GetMilliSecond()).GetString() + "_"; } void HttpProxy::UnInit() @@ -19,10 +25,23 @@ std::string HttpProxy::HttpGet(a8::XParams param, a8::XObject url_params ) { - + std::string request_id = CreateRequestId(); + request_hash_[request_id] = param; + f8::HttpClientPool::Instance()->HttpGet + (a8::XParams() + //.SetSender(instance_id) + //.SetParam1(host) + .SetParam2(1), + on_ok, + on_error, + url, + url_params, + rand() % MAX_SYS_HTTP_NUM + ); + return request_id; } std::string HttpProxy::CreateRequestId() { - + return request_prefix_ + a8::XValue(App::Instance()->NewUuid()).GetString(); } diff --git a/server/gameserver/httpproxy.h b/server/gameserver/httpproxy.h index 11b7785f..65e750a0 100644 --- a/server/gameserver/httpproxy.h +++ b/server/gameserver/httpproxy.h @@ -26,6 +26,7 @@ class HttpProxy : public a8::Singleton std::string CreateRequestId(); private: - std::map get_hash_; + std::map request_hash_; + std::string request_prefix_; };