1
This commit is contained in:
parent
be4a0d0bdf
commit
b79e9ce548
@ -1,3 +1,4 @@
|
|||||||
{
|
{
|
||||||
"api_url": "https://game2006api-test.kingsome.cn/webapp/index.php"
|
"api_url": "https://game2006api-test.kingsome.cn/webapp/index.php",
|
||||||
|
"api_secret_key": "BIgDh5J%uUktooKxT!IM7#m$NtB51%la"
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
{
|
{
|
||||||
"api_url": "https://game2006api-test.kingsome.cn/webapp/index.php"
|
"api_url": "https://game2006api-test.kingsome.cn/webapp/index.php",
|
||||||
|
"api_secret_key": "BIgDh5J%uUktooKxT!IM7#m$NtB51%la"
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ void BoxDrop::RequestAllocBoxNum()
|
|||||||
int nowtime = f8::App::Instance()->GetNowTime();
|
int nowtime = f8::App::Instance()->GetNowTime();
|
||||||
auto url_params = a8::MutableXObject::CreateObject();
|
auto url_params = a8::MutableXObject::CreateObject();
|
||||||
url_params->SetVal("c", "Battle");
|
url_params->SetVal("c", "Battle");
|
||||||
url_params->SetVal("a", "requestBoxNum");
|
url_params->SetVal("a", "requestAllocBoxNum");
|
||||||
url_params->SetVal("timestamp", a8::XValue(nowtime));
|
url_params->SetVal("timestamp", a8::XValue(nowtime));
|
||||||
HttpProxy::Instance()->HttpGet
|
HttpProxy::Instance()->HttpGet
|
||||||
(
|
(
|
||||||
@ -110,5 +110,46 @@ void BoxDrop::RequestAllocBoxNum()
|
|||||||
|
|
||||||
void BoxDrop::RequestReturnBoxNum()
|
void BoxDrop::RequestReturnBoxNum()
|
||||||
{
|
{
|
||||||
|
if (alloc_box_num_ <= 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (room_->GetMapModeMeta() && room_->GetMapModeMeta()->mapMode() == mt::kTreasureBoxMode) {
|
||||||
|
if (returned_) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
returned_ = true;
|
||||||
|
std::string url;
|
||||||
|
JsonDataMgr::Instance()->GetApiUrl(url);
|
||||||
|
auto url_params = a8::MutableXObject::CreateObject();
|
||||||
|
url_params->SetVal("c", "Battle");
|
||||||
|
url_params->SetVal("a", "requestReturnBoxNum");
|
||||||
|
HttpProxy::Instance()->HttpGet
|
||||||
|
(
|
||||||
|
[]
|
||||||
|
(bool ok, a8::XObject* rsp_obj, f8::HttpContext* ctx)
|
||||||
|
{
|
||||||
|
if (ok) {
|
||||||
|
f8::UdpLog::Instance()->Info
|
||||||
|
("GetBattleData ok %s",
|
||||||
|
{
|
||||||
|
rsp_obj->ToJsonStr()
|
||||||
|
});
|
||||||
|
if (rsp_obj->GetType() != a8::XOT_OBJECT ||
|
||||||
|
!rsp_obj->HasKey("errcode")) {
|
||||||
|
//cb(1, "", nullptr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
f8::UdpLog::Instance()->Warning
|
||||||
|
("GetCustomBattleData error %s",
|
||||||
|
{
|
||||||
|
""
|
||||||
|
});
|
||||||
|
//cb(1, "custom battle data error", nullptr);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
url.c_str(),
|
||||||
|
*url_params
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,6 +55,7 @@ void JsonDataMgr::Init()
|
|||||||
if (setting_json_.GetType() == a8::XOT_OBJECT &&
|
if (setting_json_.GetType() == a8::XOT_OBJECT &&
|
||||||
setting_json_.HasKey("api_url")) {
|
setting_json_.HasKey("api_url")) {
|
||||||
api_url_ = setting_json_.Get("api_url").GetString();
|
api_url_ = setting_json_.Get("api_url").GetString();
|
||||||
|
api_secret_key_ = setting_json_.Get("api_secret_key").GetString();
|
||||||
}
|
}
|
||||||
|
|
||||||
ip = GetConf()->At("ip")->AsXValue().GetString();
|
ip = GetConf()->At("ip")->AsXValue().GetString();
|
||||||
|
@ -21,11 +21,13 @@ public:
|
|||||||
std::string server_info;
|
std::string server_info;
|
||||||
|
|
||||||
void GetApiUrl(std::string& url);
|
void GetApiUrl(std::string& url);
|
||||||
|
std::string GetApiSecretKey() { return api_secret_key_; };
|
||||||
void GetHttpGetProxyUrl(std::string& url);
|
void GetHttpGetProxyUrl(std::string& url);
|
||||||
void GetHttpPostProxyUrl(std::string& url);
|
void GetHttpPostProxyUrl(std::string& url);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string api_url_;
|
std::string api_url_;
|
||||||
|
std::string api_secret_key_;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string work_path_ = "../config";
|
std::string work_path_ = "../config";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user