1
This commit is contained in:
parent
c88d0f970c
commit
d304c823ab
@ -22,10 +22,17 @@ struct HttpProxyRequest
|
|||||||
|
|
||||||
static void _ProxyCallback(f8::JsonHttpRequest* request)
|
static void _ProxyCallback(f8::JsonHttpRequest* request)
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG
|
||||||
|
a8::UdpLog::Instance()->Debug("ProxyCallbBack request:%s",
|
||||||
|
{
|
||||||
|
request->request.ToJsonStr()
|
||||||
|
});
|
||||||
|
#endif
|
||||||
std::string seq_id = request->request.Get("seq_id");
|
std::string seq_id = request->request.Get("seq_id");
|
||||||
HttpProxyRequest* req = HttpProxy::Instance()->GetRequest(seq_id);
|
HttpProxyRequest* req = HttpProxy::Instance()->GetRequest(seq_id);
|
||||||
if (req) {
|
if (req) {
|
||||||
a8::XObject data;
|
a8::XObject data;
|
||||||
|
|
||||||
data.ReadFromJsonString(request->request.Get("data").GetString());
|
data.ReadFromJsonString(request->request.Get("data").GetString());
|
||||||
if (data.HasKey("errcode") && data.Get("errcode").GetInt() == 0) {
|
if (data.HasKey("errcode") && data.Get("errcode").GetInt() == 0) {
|
||||||
req->on_ok(req->param, data);
|
req->on_ok(req->param, data);
|
||||||
@ -78,20 +85,33 @@ std::string HttpProxy::HttpGet(a8::XParams param,
|
|||||||
std::string proxy_url;
|
std::string proxy_url;
|
||||||
JsonDataMgr::Instance()->GetHttpProxyUrl(proxy_url);
|
JsonDataMgr::Instance()->GetHttpProxyUrl(proxy_url);
|
||||||
f8::HttpClientPool::Instance()->HttpGet
|
f8::HttpClientPool::Instance()->HttpGet
|
||||||
(a8::XParams()
|
(a8::XParams()
|
||||||
.SetSender(request->req_id),
|
.SetSender(request->req_id),
|
||||||
[] (a8::XParams& param, a8::XObject& data)
|
[] (a8::XParams& param, a8::XObject& data)
|
||||||
{
|
{
|
||||||
HttpProxyRequest* req = HttpProxy::Instance()->GetRequest(param.sender.GetString());
|
HttpProxyRequest* req = HttpProxy::Instance()->GetRequest(param.sender.GetString());
|
||||||
if (req) {
|
if (req) {
|
||||||
req->on_ok(req->param, data);
|
#ifdef DEBUG
|
||||||
|
a8::UdpLog::Instance()->Debug("ProxyHttpGet ok url:%s params:%s",
|
||||||
|
{
|
||||||
|
req->url,
|
||||||
|
req->url_params.ToJsonStr(),
|
||||||
|
});
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
HttpProxy::Instance()->DestoryRequest(req);
|
|
||||||
},
|
},
|
||||||
[] (a8::XParams& param, const std::string& response)
|
[] (a8::XParams& param, const std::string& response)
|
||||||
{
|
{
|
||||||
HttpProxyRequest* req = HttpProxy::Instance()->GetRequest(param.sender.GetString());
|
HttpProxyRequest* req = HttpProxy::Instance()->GetRequest(param.sender.GetString());
|
||||||
if (req) {
|
if (req) {
|
||||||
|
#ifdef DEBUG
|
||||||
|
a8::UdpLog::Instance()->Debug("ProxyHttpGet error url:%s params:%s response:%s",
|
||||||
|
{
|
||||||
|
req->url,
|
||||||
|
req->url_params.ToJsonStr(),
|
||||||
|
response
|
||||||
|
});
|
||||||
|
#endif
|
||||||
req->on_error(req->param, response);
|
req->on_error(req->param, response);
|
||||||
}
|
}
|
||||||
HttpProxy::Instance()->DestoryRequest(req);
|
HttpProxy::Instance()->DestoryRequest(req);
|
||||||
|
@ -3,7 +3,7 @@ package cs;
|
|||||||
|
|
||||||
enum Constant_e
|
enum Constant_e
|
||||||
{
|
{
|
||||||
ProtoVersion = 2021073001;
|
ProtoVersion = 2022032201;
|
||||||
}
|
}
|
||||||
|
|
||||||
message CMPing
|
message CMPing
|
||||||
@ -755,6 +755,8 @@ message CMJoin
|
|||||||
optional int32 show_team_ui = 62;
|
optional int32 show_team_ui = 62;
|
||||||
optional int32 hero_skin = 63;
|
optional int32 hero_skin = 63;
|
||||||
optional string pre_battle_payload = 70;
|
optional string pre_battle_payload = 70;
|
||||||
|
|
||||||
|
optional string hero_uniid = 71;
|
||||||
}
|
}
|
||||||
|
|
||||||
message CMReconnect
|
message CMReconnect
|
||||||
|
Loading…
x
Reference in New Issue
Block a user