1
This commit is contained in:
parent
e2c8be1f25
commit
c3d8b2e565
@ -1,10 +1,16 @@
|
||||
#include "precompile.h"
|
||||
|
||||
#include <a8/sysutils.h>
|
||||
|
||||
#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();
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ class HttpProxy : public a8::Singleton<HttpProxy>
|
||||
std::string CreateRequestId();
|
||||
|
||||
private:
|
||||
std::map<std::string, a8::XParams> get_hash_;
|
||||
std::map<std::string, a8::XParams> request_hash_;
|
||||
std::string request_prefix_;
|
||||
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user