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)
|
||||
{
|
||||
bool ret = false;
|
||||
auto url_params = a8::MutableXObject::CreateObject();
|
||||
url_params->SetVal("c", "Login");
|
||||
url_params->SetVal("a", "auth");
|
||||
url_params->SetVal("gameid", 2006);
|
||||
url_params->SetVal("channel", 6513);
|
||||
url_params->SetVal("openid", idx);
|
||||
std::shared_ptr<a8::XObject> rsp;
|
||||
co->CoAwait
|
||||
(HttpProxy::Instance()->CoHttpGet
|
||||
(
|
||||
"https://login-test.kingsome.cn/webapp/index.php",
|
||||
*url_params,
|
||||
&ret,
|
||||
&rsp
|
||||
)
|
||||
);
|
||||
if (ret) {
|
||||
a8::XPrintf("rsp:%s\n", {rsp->ToJsonStr()});
|
||||
} else {
|
||||
abort();
|
||||
std::string account_id;
|
||||
std::string session_id;
|
||||
{
|
||||
bool ret = false;
|
||||
auto url_params = a8::MutableXObject::CreateObject();
|
||||
url_params->SetVal("c", "Login");
|
||||
url_params->SetVal("a", "auth");
|
||||
url_params->SetVal("gameid", 2006);
|
||||
url_params->SetVal("channel", 6513);
|
||||
url_params->SetVal("openid", idx);
|
||||
std::shared_ptr<a8::XObject> rsp;
|
||||
co->CoAwait
|
||||
(HttpProxy::Instance()->CoHttpGet
|
||||
(
|
||||
"https://login-test.kingsome.cn/webapp/index.php",
|
||||
*url_params,
|
||||
&ret,
|
||||
&rsp
|
||||
)
|
||||
);
|
||||
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