1
This commit is contained in:
parent
196646803e
commit
6d2528d470
@ -38,6 +38,9 @@ void PlayerMgr::Update()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PlayerMgr::CoCreatePlayer(int idx, f8::Coroutine* co)
|
void PlayerMgr::CoCreatePlayer(int idx, f8::Coroutine* co)
|
||||||
|
{
|
||||||
|
std::string account_id;
|
||||||
|
std::string session_id;
|
||||||
{
|
{
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
auto url_params = a8::MutableXObject::CreateObject();
|
auto url_params = a8::MutableXObject::CreateObject();
|
||||||
@ -57,8 +60,38 @@ void PlayerMgr::CoCreatePlayer(int idx, f8::Coroutine* co)
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
auto rsp_obj = a8::XObject();
|
||||||
|
rsp_obj.ReadFromJsonString(rsp->ToJsonStr());
|
||||||
|
account_id = rsp_obj.At("account_id")->AsXValue().GetString();
|
||||||
|
session_id = rsp_obj.At("session_id")->AsXValue().GetString();
|
||||||
a8::XPrintf("rsp:%s\n", {rsp->ToJsonStr()});
|
a8::XPrintf("rsp:%s\n", {rsp->ToJsonStr()});
|
||||||
} else {
|
} else {
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
bool ret = false;
|
||||||
|
auto url_params = a8::MutableXObject::CreateObject();
|
||||||
|
url_params->SetVal("c", "User");
|
||||||
|
url_params->SetVal("a", "login");
|
||||||
|
url_params->SetVal("account_id", account_id);
|
||||||
|
url_params->SetVal("session_id", session_id);
|
||||||
|
std::shared_ptr<a8::XObject> rsp;
|
||||||
|
co->CoAwait
|
||||||
|
(HttpProxy::Instance()->CoHttpGet
|
||||||
|
(
|
||||||
|
"https://game2006api-test.kingsome.cn/webapp/index.php",
|
||||||
|
*url_params,
|
||||||
|
&ret,
|
||||||
|
&rsp
|
||||||
|
)
|
||||||
|
);
|
||||||
|
if (ret) {
|
||||||
|
auto rsp_obj = a8::XObject();
|
||||||
|
rsp_obj.ReadFromJsonString(rsp->ToJsonStr());
|
||||||
|
a8::XPrintf("rsp:%s\n", {rsp->ToJsonStr()});
|
||||||
|
} else {
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user