|
@@ -375,6 +375,11 @@ void HttpSocket::makegamelist(staticdata& tstaticdata)
|
|
|
|
|
|
std::string strkindname = ksubdoc["KindName"].get_utf8().value.data();
|
|
|
std::string strsubgid = "";
|
|
|
+ if (ikindid != 0)
|
|
|
+ {
|
|
|
+ tstaticdata.m_mapkindid2name[ikindid] = strkindname;
|
|
|
+ }
|
|
|
+
|
|
|
if (ksubdoc["GID"] && ikindid != 0)
|
|
|
{
|
|
|
strsubgid = ksubdoc["GID"].get_utf8().value.data();
|
|
@@ -3283,18 +3288,18 @@ std::string HttpSocket::reelplay(std::map<std::string, std::string> getdata, std
|
|
|
std::int32_t iareaid{ 0 };
|
|
|
std::int64_t ispreaderid{ 0 };
|
|
|
//验证代理是否存在
|
|
|
- auto findagentview = make_document(kvp("account", treelplayuser.strextension1.c_str()), kvp("cert", treelplayuser.strcert.c_str()));
|
|
|
- auto vipuser = m_pvipuser->find_one(findagentview.view());
|
|
|
- if (!vipuser || !vipuser->view()["userid"] || !vipuser->view()["areaid"] || !vipuser->view()["apitype"])
|
|
|
- {
|
|
|
- strret = funclib::errotojson(Err_No_Agent);
|
|
|
- return strret;
|
|
|
- }
|
|
|
+ //auto findagentview = make_document(kvp("account", treelplayuser.strextension1.c_str()));
|
|
|
+ //auto vipuser = m_pvipuser->find_one(findagentview.view());
|
|
|
+ //if (!vipuser || !vipuser->view()["userid"] || !vipuser->view()["areaid"] || !vipuser->view()["apitype"])
|
|
|
+ //{
|
|
|
+ // strret = funclib::errotojson(Err_No_Agent);
|
|
|
+ // return strret;
|
|
|
+ //}
|
|
|
|
|
|
- iareaid = vipuser->view()["areaid"].get_int32();
|
|
|
- ispreaderid = vipuser->view()["areaid"].get_int32();
|
|
|
+ //iareaid = vipuser->view()["areaid"].get_int32();
|
|
|
+ //ispreaderid = vipuser->view()["areaid"].get_int32();
|
|
|
|
|
|
- std::int32_t userstate = 1;
|
|
|
+ /*std::int32_t userstate = 1;
|
|
|
if (vipuser && vipuser->view()["state"])
|
|
|
{
|
|
|
userstate = vipuser->view()["state"].get_int32();
|
|
@@ -3304,16 +3309,15 @@ std::string HttpSocket::reelplay(std::map<std::string, std::string> getdata, std
|
|
|
{
|
|
|
strret = funclib::rettojson(Err_OutOfState_Agent, "agent statue error");
|
|
|
return strret;
|
|
|
- }
|
|
|
-
|
|
|
- std::int32_t iapitype = vipuser->view()["apitype"].get_int32();
|
|
|
+ }*/
|
|
|
+ /*std::int32_t iapitype = vipuser->view()["apitype"].get_int32();
|
|
|
if (iapitype != 2)
|
|
|
{
|
|
|
strret = funclib::rettojson(Err_OutOfState_Agent, "agent type error");
|
|
|
return strret;
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
- auto findwebuser = make_document(kvp("account", treelplayuser.struseracc.c_str()));
|
|
|
+ auto findwebuser = make_document(kvp("account", treelplayuser.struseracc.c_str()), kvp("dynamicpass", treelplayuser.strcert.c_str()));
|
|
|
auto findneuserdata = m_pcoll->find_one(findwebuser.view());
|
|
|
if (!findneuserdata)
|
|
|
{
|
|
@@ -3329,7 +3333,7 @@ std::string HttpSocket::reelplay(std::map<std::string, std::string> getdata, std
|
|
|
}
|
|
|
std::string struseracc = treelplayuser.struseracc;
|
|
|
|
|
|
- createreeluser(struseracc, iscore, dofun);
|
|
|
+ createreeluser(struseracc, treelplayuser.ikindid, iscore, dofun);
|
|
|
|
|
|
return {};
|
|
|
}
|
|
@@ -3369,7 +3373,7 @@ void HttpSocket::checkreeluserbalance(std::string struseracc, std::int64_t iscor
|
|
|
}
|
|
|
|
|
|
//创建玩家
|
|
|
-void HttpSocket::createreeluser(std::string struseracc, std::int64_t iscore, std::function<void(std::string&, int)>& dofun)
|
|
|
+void HttpSocket::createreeluser(std::string struseracc, __int32 ikindid, std::int64_t iscore, std::function<void(std::string&, int)>& dofun)
|
|
|
{
|
|
|
m_writelog("--------------------createreeluser-------------------------");
|
|
|
rapidjson::Document doc;
|
|
@@ -3386,7 +3390,7 @@ void HttpSocket::createreeluser(std::string struseracc, std::int64_t iscore, std
|
|
|
std::string strtarget = "v2/tw/createPlayer";
|
|
|
|
|
|
//创建玩家
|
|
|
- sendreelmsg(struseracc, strtarget, strjson, std::move([this, struseracc, iscore, dofun](std::string strdata, int iret) {
|
|
|
+ sendreelmsg(struseracc, strtarget, strjson, std::move([this, struseracc, iscore, ikindid, dofun](std::string strdata, int iret) {
|
|
|
|
|
|
std::stringstream strlog;
|
|
|
strlog << "创建玩家: iret=" << iret << " strdata=" << strdata;
|
|
@@ -3415,7 +3419,7 @@ void HttpSocket::createreeluser(std::string struseracc, std::int64_t iscore, std
|
|
|
//玩家创建成功
|
|
|
if (bhaveuser)
|
|
|
{
|
|
|
- reelusertrans(struseracc, iscore, dofun);
|
|
|
+ reelusertrans(struseracc, ikindid, iscore, dofun);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -3426,7 +3430,7 @@ void HttpSocket::createreeluser(std::string struseracc, std::int64_t iscore, std
|
|
|
}));
|
|
|
}
|
|
|
|
|
|
-void HttpSocket::reelusertrans(std::string struseracc, std::int64_t iscore, std::function<void(std::string&, int)> dofun)
|
|
|
+void HttpSocket::reelusertrans(std::string struseracc, __int32 ikindid, std::int64_t iscore, std::function<void(std::string&, int)> dofun)
|
|
|
{
|
|
|
m_writelog("--------------------reelusertrans-------------------------");
|
|
|
if (iscore > 0)
|
|
@@ -3445,7 +3449,7 @@ void HttpSocket::reelusertrans(std::string struseracc, std::int64_t iscore, std:
|
|
|
std::string strjson = funclib::doctojson(doc);
|
|
|
std::string strtarget = "v2/tw/transfer";
|
|
|
|
|
|
- sendreelmsg(struseracc, strtarget, strjson, std::move([this, struseracc, dofun, iscore](std::string strdata, int iret) {
|
|
|
+ sendreelmsg(struseracc, strtarget, strjson, std::move([this, struseracc, dofun, iscore, ikindid](std::string strdata, int iret) {
|
|
|
|
|
|
std::stringstream strlog;
|
|
|
strlog << "转账: iscore=" << iscore << " iret=" << iret << " strdata=" << strdata;
|
|
@@ -3489,20 +3493,18 @@ void HttpSocket::reelusertrans(std::string struseracc, std::int64_t iscore, std:
|
|
|
if (bscore)
|
|
|
{
|
|
|
//执行扣分操作
|
|
|
- m_postmsg(std::move([this]() {
|
|
|
-
|
|
|
- //验证代理是否存在
|
|
|
- //auto findagentview = make_document(kvp("account", treelplayuser.strextension1.c_str()), kvp("cert", treelplayuser.strcert.c_str()));
|
|
|
- //auto vipuser = m_pvipuser->find_one(findagentview.view());
|
|
|
- //if (!vipuser || !vipuser->view()["userid"] || !vipuser->view()["areaid"] || !vipuser->view()["apitype"])
|
|
|
- //{
|
|
|
- //strret = funclib::errotojson(Err_No_Agent);
|
|
|
- //return strret;
|
|
|
- //}
|
|
|
-
|
|
|
+ m_postmsg(std::move([this, struseracc, iscore, ikindid]() {
|
|
|
+ auto findwebuser = make_document(kvp("account", struseracc.c_str()));
|
|
|
+ auto findneuserdata = m_pcoll->find_one(findwebuser.view());
|
|
|
+ if (findneuserdata)
|
|
|
+ {
|
|
|
+ __int64 itradescore = iscore * -1;
|
|
|
+ auto scoreupdate = make_document(kvp("$inc", make_document(kvp("score", itradescore))));
|
|
|
+ m_pcoll->find_one_and_update(findneuserdata->view(), scoreupdate.view());
|
|
|
+ }
|
|
|
}));
|
|
|
//直接拉取游戏
|
|
|
- getreelgameurl(struseracc, dofun);
|
|
|
+ getreelgameurl(struseracc, ikindid, dofun);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -3516,12 +3518,12 @@ void HttpSocket::reelusertrans(std::string struseracc, std::int64_t iscore, std:
|
|
|
{
|
|
|
m_writelog("iscore = 0, 直接拉取游戏");
|
|
|
//直接拉取游戏
|
|
|
- getreelgameurl(struseracc, dofun);
|
|
|
+ getreelgameurl(struseracc, ikindid, dofun);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//拉取游戏
|
|
|
-void HttpSocket::getreelgameurl(std::string struseracc, std::function<void(std::string&, int)> dofun)
|
|
|
+void HttpSocket::getreelgameurl(std::string struseracc, __int32 ikindid, std::function<void(std::string&, int)> dofun)
|
|
|
{
|
|
|
m_writelog("--------------------getreelgameurl-------------------------");
|
|
|
rapidjson::Document doc;
|
|
@@ -3532,9 +3534,10 @@ void HttpSocket::getreelgameurl(std::string struseracc, std::function<void(std::
|
|
|
//homepage:URL for returning to Lobby page on Casino site. This link is used for Exit button in mobile version of games.
|
|
|
//{"casino":"whitebom","playerId":"testPlayer_1","launchAlias":"launch_main_rol_01","language":"en","cashier":"https://cashier.com","homepage":"https://home.com"}
|
|
|
std::string strtransid = funclib::getonlytoken(1, m_ucurid);
|
|
|
+ std::string strAlias = m_staticdata.m_mapkindid2name[ikindid];
|
|
|
doc.AddMember("casino", rapidjson::Value("luckybet777", allocator), allocator);
|
|
|
doc.AddMember("playerId", rapidjson::Value(struseracc.c_str(), allocator), allocator);
|
|
|
- doc.AddMember("launchAlias", rapidjson::Value("launch_main_rol_01", allocator), allocator);
|
|
|
+ doc.AddMember("launchAlias", rapidjson::Value(strAlias.c_str(), allocator), allocator);
|
|
|
doc.AddMember("language", rapidjson::Value("en", allocator), allocator);
|
|
|
doc.AddMember("cashier", rapidjson::Value("https://cashier.com", allocator), allocator);
|
|
|
doc.AddMember("homepage", rapidjson::Value("https://home.com", allocator), allocator);
|