This commit is contained in:
aozhiwei 2022-03-31 22:00:15 +08:00
parent d304c823ab
commit c2287771a4
2 changed files with 8 additions and 3 deletions

View File

@ -16,7 +16,7 @@ struct HttpProxyRequest
a8::XParams param;
f8::AsyncHttpOnOkFunc on_ok;
f8::AsyncHttpOnErrorFunc on_error;
const char* url = nullptr;
std::string url;
a8::XObject url_params;
};
@ -33,8 +33,12 @@ static void _ProxyCallback(f8::JsonHttpRequest* request)
if (req) {
a8::XObject data;
data.ReadFromJsonString(request->request.Get("data").GetString());
if (data.HasKey("errcode") && data.Get("errcode").GetInt() == 0) {
data.ReadFromJsonString(request->request.Get("response").GetString());
if (data.GetType() == a8::XOT_SIMPLE) {
data.ReadFromJsonString("{}");
}
if (request->request.HasKey("errcode") &&
request->request.Get("errcode").GetInt() == 0) {
req->on_ok(req->param, data);
} else {
req->on_error(req->param, data.Get("errmsg").GetString());

View File

@ -1791,6 +1791,7 @@ void Human::GenBattleReportData(a8::MutableXObject* params)
params->SetVal("room_uuid", room->GetRoomUuid());
params->SetVal("room_mode", room->GetRoomMode());
params->SetVal("hero_id", meta->i->id());
params->SetVal("hero_uniid", hero_uniid);
params->SetVal("game_time", time(nullptr)); //?
if (!dead) {
params->SetVal("alive_time", room->GetFrameNo() * 1000.0f / SERVER_FRAME_RATE);