30 lines
779 B
C++
30 lines
779 B
C++
#pragma once
|
|
|
|
namespace f8
|
|
{
|
|
|
|
typedef void (*AsyncHttpOnOkFunc)(a8::XParams& param, a8::XObject& data);
|
|
typedef void (*AsyncHttpOnErrorFunc)(a8::XParams& param, const std::string& response);
|
|
|
|
class HttpClientPoolImpl;
|
|
class HttpClientPool : public a8::Singleton<HttpClientPool>
|
|
{
|
|
private:
|
|
HttpClientPool() {};
|
|
friend class a8::Singleton<HttpClientPool>;
|
|
|
|
public:
|
|
void Init();
|
|
void UnInit();
|
|
void SetThreadNum(int thread_num);
|
|
|
|
//执行异步http get
|
|
void HttpGet(const char* url, a8::XObject url_params,
|
|
a8::XParams param, AsyncHttpOnOkFunc on_ok, AsyncHttpOnErrorFunc on_error, long long hash_code = 0);
|
|
|
|
private:
|
|
HttpClientPoolImpl* impl_ = nullptr;
|
|
};
|
|
|
|
}
|