1
This commit is contained in:
parent
196646803e
commit
6d2528d470
@ -39,26 +39,59 @@ void PlayerMgr::Update()
|
|||||||
|
|
||||||
void PlayerMgr::CoCreatePlayer(int idx, f8::Coroutine* co)
|
void PlayerMgr::CoCreatePlayer(int idx, f8::Coroutine* co)
|
||||||
{
|
{
|
||||||
bool ret = false;
|
std::string account_id;
|
||||||
auto url_params = a8::MutableXObject::CreateObject();
|
std::string session_id;
|
||||||
url_params->SetVal("c", "Login");
|
{
|
||||||
url_params->SetVal("a", "auth");
|
bool ret = false;
|
||||||
url_params->SetVal("gameid", 2006);
|
auto url_params = a8::MutableXObject::CreateObject();
|
||||||
url_params->SetVal("channel", 6513);
|
url_params->SetVal("c", "Login");
|
||||||
url_params->SetVal("openid", idx);
|
url_params->SetVal("a", "auth");
|
||||||
std::shared_ptr<a8::XObject> rsp;
|
url_params->SetVal("gameid", 2006);
|
||||||
co->CoAwait
|
url_params->SetVal("channel", 6513);
|
||||||
(HttpProxy::Instance()->CoHttpGet
|
url_params->SetVal("openid", idx);
|
||||||
(
|
std::shared_ptr<a8::XObject> rsp;
|
||||||
"https://login-test.kingsome.cn/webapp/index.php",
|
co->CoAwait
|
||||||
*url_params,
|
(HttpProxy::Instance()->CoHttpGet
|
||||||
&ret,
|
(
|
||||||
&rsp
|
"https://login-test.kingsome.cn/webapp/index.php",
|
||||||
)
|
*url_params,
|
||||||
);
|
&ret,
|
||||||
if (ret) {
|
&rsp
|
||||||
a8::XPrintf("rsp:%s\n", {rsp->ToJsonStr()});
|
)
|
||||||
} else {
|
);
|
||||||
abort();
|
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()});
|
||||||
|
} else {
|
||||||
|
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