|
@@ -641,8 +641,8 @@ std::string HttpSocket::regaccount(std::map<std::string, std::string> getdata)
|
|
//查询第三方平台开通的空账号当天数量不超过1000个
|
|
//查询第三方平台开通的空账号当天数量不超过1000个
|
|
std::int64_t ilogondate = ilocaltime / 86400000 * 86400000;
|
|
std::int64_t ilogondate = ilocaltime / 86400000 * 86400000;
|
|
ilogondate = funclib::getlocaltounixstamp(ilogondate);
|
|
ilogondate = funclib::getlocaltounixstamp(ilogondate);
|
|
- auto findusernull = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("spreaderid", adminuserid), (bsoncxx::builder::basic::kvp("registerlogonip", registerip.c_str())),
|
|
|
|
- bsoncxx::builder::basic::kvp("registerdate", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("$gte", ilogondate))));
|
|
|
|
|
|
+ auto findusernull = make_document(kvp("spreaderid", adminuserid), (kvp("registerlogonip", registerip.c_str())),
|
|
|
|
+ kvp("registerdate", make_document(kvp("$gte", ilogondate))));
|
|
std::int64_t iusernull = m_pcoll->count_documents(findusernull.view());
|
|
std::int64_t iusernull = m_pcoll->count_documents(findusernull.view());
|
|
if (iusernull > 1000)
|
|
if (iusernull > 1000)
|
|
{
|
|
{
|
|
@@ -690,9 +690,9 @@ std::string HttpSocket::regaccount(std::map<std::string, std::string> getdata)
|
|
__int64 iinc = 1;
|
|
__int64 iinc = 1;
|
|
|
|
|
|
//获取索引
|
|
//获取索引
|
|
- auto criteria = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("name", iname));
|
|
|
|
- auto update = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("$inc", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("useridindex", iinc))),
|
|
|
|
- bsoncxx::builder::basic::kvp("$inc", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("gameidindex", iinc))));
|
|
|
|
|
|
+ auto criteria = make_document(kvp("name", iname));
|
|
|
|
+ auto update = make_document(kvp("$inc", make_document(kvp("useridindex", iinc))),
|
|
|
|
+ kvp("$inc", make_document(kvp("gameidindex", iinc))));
|
|
auto newtemp = m_pallindex->find_one_and_update(criteria.view(), update.view());
|
|
auto newtemp = m_pallindex->find_one_and_update(criteria.view(), update.view());
|
|
|
|
|
|
if (newtemp && newtemp->view()["useridindex"] && newtemp->view()["gameidindex"])
|
|
if (newtemp && newtemp->view()["useridindex"] && newtemp->view()["gameidindex"])
|
|
@@ -812,8 +812,8 @@ std::string HttpSocket::regaccount(std::map<std::string, std::string> getdata)
|
|
}
|
|
}
|
|
|
|
|
|
//写注册日志
|
|
//写注册日志
|
|
- auto findlogtime = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("inserttime", irechargetime));
|
|
|
|
- auto findlogset = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("$inc", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("regnum", ione64))));
|
|
|
|
|
|
+ auto findlogtime = make_document(kvp("inserttime", irechargetime));
|
|
|
|
+ auto findlogset = make_document(kvp("$inc", make_document(kvp("regnum", ione64))));
|
|
|
|
|
|
mongocxx::options::find_one_and_update options;
|
|
mongocxx::options::find_one_and_update options;
|
|
options.upsert(true);
|
|
options.upsert(true);
|
|
@@ -821,8 +821,8 @@ std::string HttpSocket::regaccount(std::map<std::string, std::string> getdata)
|
|
|
|
|
|
if (iscore > 0)
|
|
if (iscore > 0)
|
|
{
|
|
{
|
|
- auto vipcriteria = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("userid", adminuserid));
|
|
|
|
- auto vipupdate = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("$inc", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("score", ivipscore))));
|
|
|
|
|
|
+ auto vipcriteria = make_document(kvp("userid", adminuserid));
|
|
|
|
+ auto vipupdate = make_document(kvp("$inc", make_document(kvp("score", ivipscore))));
|
|
auto vipretscore = m_pvipuser->find_one_and_update(vipcriteria.view(), vipupdate.view());
|
|
auto vipretscore = m_pvipuser->find_one_and_update(vipcriteria.view(), vipupdate.view());
|
|
if (!vipretscore)
|
|
if (!vipretscore)
|
|
{
|
|
{
|
|
@@ -831,16 +831,16 @@ std::string HttpSocket::regaccount(std::map<std::string, std::string> getdata)
|
|
}
|
|
}
|
|
|
|
|
|
//记录充值分数
|
|
//记录充值分数
|
|
- auto rechargecriteria = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("userid", userid));
|
|
|
|
- auto rechargeupdate = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("$inc", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("totalczscore", iscore))),
|
|
|
|
- bsoncxx::builder::basic::kvp("$inc", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("todayczscore", iscore))),
|
|
|
|
- bsoncxx::builder::basic::kvp("$set", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("rechargetime", ilocaltime))));
|
|
|
|
|
|
+ auto rechargecriteria = make_document(kvp("userid", userid));
|
|
|
|
+ auto rechargeupdate = make_document(kvp("$inc", make_document(kvp("totalczscore", iscore))),
|
|
|
|
+ kvp("$inc", make_document(kvp("todayczscore", iscore))),
|
|
|
|
+ kvp("$set", make_document(kvp("rechargetime", ilocaltime))));
|
|
m_plosewincoll->find_one_and_update(rechargecriteria.view(), rechargeupdate.view());
|
|
m_plosewincoll->find_one_and_update(rechargecriteria.view(), rechargeupdate.view());
|
|
|
|
|
|
|
|
|
|
__int64 iOne32 = 1;
|
|
__int64 iOne32 = 1;
|
|
- auto vipscorecriteria = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("business", iOne32));
|
|
|
|
- auto vipscoreupdate = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("$inc", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("sellscore", iscore))));
|
|
|
|
|
|
+ auto vipscorecriteria = make_document(kvp("business", iOne32));
|
|
|
|
+ auto vipscoreupdate = make_document(kvp("$inc", make_document(kvp("sellscore", iscore))));
|
|
mongocxx::options::find_one_and_update options;
|
|
mongocxx::options::find_one_and_update options;
|
|
options.upsert(true);
|
|
options.upsert(true);
|
|
auto vipscore = m_pvipscore->find_one_and_update(vipscorecriteria.view(), vipscoreupdate.view(), options);
|
|
auto vipscore = m_pvipscore->find_one_and_update(vipscorecriteria.view(), vipscoreupdate.view(), options);
|
|
@@ -855,7 +855,7 @@ std::string HttpSocket::regaccount(std::map<std::string, std::string> getdata)
|
|
buyscore += iscore;
|
|
buyscore += iscore;
|
|
double buysellrate = buyscore;
|
|
double buysellrate = buyscore;
|
|
buysellrate /= sellscore;
|
|
buysellrate /= sellscore;
|
|
- auto vipscoreupdate = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("$set", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("buysellrate", buysellrate))));
|
|
|
|
|
|
+ auto vipscoreupdate = make_document(kvp("$set", make_document(kvp("buysellrate", buysellrate))));
|
|
m_pvipscore->update_one(vipscorecriteria.view(), vipscoreupdate.view());
|
|
m_pvipscore->update_one(vipscorecriteria.view(), vipscoreupdate.view());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -863,8 +863,8 @@ std::string HttpSocket::regaccount(std::map<std::string, std::string> getdata)
|
|
|
|
|
|
__int64 inserttimetemp = ilocaltime / (24 * 60 * 60 * 1000);
|
|
__int64 inserttimetemp = ilocaltime / (24 * 60 * 60 * 1000);
|
|
inserttimetemp *= (24 * 60 * 60 * 1000);
|
|
inserttimetemp *= (24 * 60 * 60 * 1000);
|
|
- auto vipscoredate = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("inserttime", inserttimetemp));
|
|
|
|
- auto vipscoredateupdate = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("$inc", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("sellscore", iscore))));
|
|
|
|
|
|
+ auto vipscoredate = make_document(kvp("inserttime", inserttimetemp));
|
|
|
|
+ auto vipscoredateupdate = make_document(kvp("$inc", make_document(kvp("sellscore", iscore))));
|
|
auto retvipscore = m_pvipscoredate->find_one_and_update(vipscoredate.view(), vipscoredateupdate.view(), options);
|
|
auto retvipscore = m_pvipscoredate->find_one_and_update(vipscoredate.view(), vipscoredateupdate.view(), options);
|
|
if (retvipscore)
|
|
if (retvipscore)
|
|
{
|
|
{
|
|
@@ -877,7 +877,7 @@ std::string HttpSocket::regaccount(std::map<std::string, std::string> getdata)
|
|
buyscore += iscore;
|
|
buyscore += iscore;
|
|
double buysellrate = buyscore;
|
|
double buysellrate = buyscore;
|
|
buysellrate /= sellscore;
|
|
buysellrate /= sellscore;
|
|
- auto vipscoreupdate = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("$set", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("buysellrate", buysellrate))));
|
|
|
|
|
|
+ auto vipscoreupdate = make_document(kvp("$set", make_document(kvp("buysellrate", buysellrate))));
|
|
m_pvipscoredate->update_one(vipscoredate.view(), vipscoreupdate.view());
|
|
m_pvipscoredate->update_one(vipscoredate.view(), vipscoreupdate.view());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -947,14 +947,17 @@ std::string HttpSocket::updateuserscore(std::map<std::string, std::string> getda
|
|
return strret;
|
|
return strret;
|
|
}
|
|
}
|
|
|
|
|
|
- if (!threeadmin->view()["adminuserid"])
|
|
|
|
|
|
+
|
|
|
|
+ //用户不存在不减商家的分数
|
|
|
|
+ auto firstuser = m_pcoll->find_one(bsoncxx::builder::stream::document{} << "userid" << tuserscore.iuserid << bsoncxx::builder::stream::finalize);
|
|
|
|
+ if (!firstuser || firstuser->view()["spreaderid"])
|
|
{
|
|
{
|
|
- strret = funclib::rettojson(Err_ThreeAdminLackInfo, "id isnot exist");
|
|
|
|
|
|
+ strret = funclib::rettojson(11, "user is not exist");
|
|
return strret;
|
|
return strret;
|
|
}
|
|
}
|
|
|
|
|
|
- std::int64_t adminuserid = threeadmin->view()["adminuserid"].get_int64();
|
|
|
|
|
|
|
|
|
|
+ std::int64_t adminuserid = firstuser->view()["spreaderid"].get_int64();
|
|
auto vipuser = m_pvipuser->find_one(bsoncxx::builder::stream::document{} << "userid" << adminuserid << bsoncxx::builder::stream::finalize);
|
|
auto vipuser = m_pvipuser->find_one(bsoncxx::builder::stream::document{} << "userid" << adminuserid << bsoncxx::builder::stream::finalize);
|
|
if (!vipuser)
|
|
if (!vipuser)
|
|
{
|
|
{
|
|
@@ -1006,14 +1009,7 @@ std::string HttpSocket::updateuserscore(std::map<std::string, std::string> getda
|
|
{
|
|
{
|
|
//可以赠送
|
|
//可以赠送
|
|
if (vipscore + tuserscore.score >= 0)
|
|
if (vipscore + tuserscore.score >= 0)
|
|
- {
|
|
|
|
- //用户不存在不减商家的分数
|
|
|
|
- auto firstuser = m_pcoll->find_one(bsoncxx::builder::stream::document{} << "account" << tuserscore.account.c_str() << bsoncxx::builder::stream::finalize);
|
|
|
|
- if (!firstuser)
|
|
|
|
- {
|
|
|
|
- strret = funclib::rettojson(11, "user is not exist");
|
|
|
|
- return strret;
|
|
|
|
- }
|
|
|
|
|
|
+ {
|
|
|
|
|
|
if (!firstuser->view()["score"] || !firstuser->view()["name"] || !firstuser->view()["account"] || !firstuser->view()["lastlogonip"] || !firstuser->view()["userid"])
|
|
if (!firstuser->view()["score"] || !firstuser->view()["name"] || !firstuser->view()["account"] || !firstuser->view()["lastlogonip"] || !firstuser->view()["userid"])
|
|
{
|
|
{
|
|
@@ -1028,8 +1024,8 @@ std::string HttpSocket::updateuserscore(std::map<std::string, std::string> getda
|
|
iuserid = firstuser->view()["userid"].get_int64();
|
|
iuserid = firstuser->view()["userid"].get_int64();
|
|
|
|
|
|
//减商家分数
|
|
//减商家分数
|
|
- auto criteria = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("userid", adminuserid));
|
|
|
|
- auto update = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("$inc", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("score", tuserscore.score))));
|
|
|
|
|
|
+ auto criteria = make_document(kvp("userid", adminuserid));
|
|
|
|
+ auto update = make_document(kvp("$inc", make_document(kvp("score", tuserscore.score))));
|
|
auto retscore = m_pvipuser->find_one_and_update(criteria.view(), update.view());
|
|
auto retscore = m_pvipuser->find_one_and_update(criteria.view(), update.view());
|
|
if (!retscore)
|
|
if (!retscore)
|
|
{
|
|
{
|
|
@@ -1053,8 +1049,8 @@ std::string HttpSocket::updateuserscore(std::map<std::string, std::string> getda
|
|
//加用户分数
|
|
//加用户分数
|
|
tuserscore.score = -1 * tuserscore.score;
|
|
tuserscore.score = -1 * tuserscore.score;
|
|
tradescore = tuserscore.score;
|
|
tradescore = tuserscore.score;
|
|
- auto usercriteria = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("userid", iuserid));
|
|
|
|
- auto userupdate = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("$inc", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("score", tuserscore.score))));
|
|
|
|
|
|
+ auto usercriteria = make_document(kvp("userid", iuserid));
|
|
|
|
+ auto userupdate = make_document(kvp("$inc", make_document(kvp("score", tuserscore.score))));
|
|
auto userretscore = m_pcoll->find_one_and_update(usercriteria.view(), userupdate.view());
|
|
auto userretscore = m_pcoll->find_one_and_update(usercriteria.view(), userupdate.view());
|
|
if (!userretscore)
|
|
if (!userretscore)
|
|
{
|
|
{
|
|
@@ -1063,8 +1059,8 @@ std::string HttpSocket::updateuserscore(std::map<std::string, std::string> getda
|
|
}
|
|
}
|
|
|
|
|
|
__int64 iOne32 = 1;
|
|
__int64 iOne32 = 1;
|
|
- auto vipscorecriteria = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("business", iOne32));
|
|
|
|
- auto vipscoreupdate = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("$inc", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("sellscore", tradescore))));
|
|
|
|
|
|
+ auto vipscorecriteria = make_document(kvp("business", iOne32));
|
|
|
|
+ auto vipscoreupdate = make_document(kvp("$inc", make_document(kvp("sellscore", tradescore))));
|
|
mongocxx::options::find_one_and_update options;
|
|
mongocxx::options::find_one_and_update options;
|
|
options.upsert(true);
|
|
options.upsert(true);
|
|
auto vipscore = m_pvipscore->find_one_and_update(vipscorecriteria.view(), vipscoreupdate.view(), options);
|
|
auto vipscore = m_pvipscore->find_one_and_update(vipscorecriteria.view(), vipscoreupdate.view(), options);
|
|
@@ -1079,7 +1075,7 @@ std::string HttpSocket::updateuserscore(std::map<std::string, std::string> getda
|
|
buyscore += tradescore;
|
|
buyscore += tradescore;
|
|
double buysellrate = buyscore;
|
|
double buysellrate = buyscore;
|
|
buysellrate /= sellscore;
|
|
buysellrate /= sellscore;
|
|
- auto vipscoreupdate = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("$set", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("buysellrate", buysellrate))));
|
|
|
|
|
|
+ auto vipscoreupdate = make_document(kvp("$set", make_document(kvp("buysellrate", buysellrate))));
|
|
m_pvipscore->update_one(vipscorecriteria.view(), vipscoreupdate.view());
|
|
m_pvipscore->update_one(vipscorecriteria.view(), vipscoreupdate.view());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1087,8 +1083,8 @@ std::string HttpSocket::updateuserscore(std::map<std::string, std::string> getda
|
|
|
|
|
|
__int64 inserttimetemp = ilocaltime / (24 * 60 * 60 * 1000);
|
|
__int64 inserttimetemp = ilocaltime / (24 * 60 * 60 * 1000);
|
|
inserttimetemp *= (24 * 60 * 60 * 1000);
|
|
inserttimetemp *= (24 * 60 * 60 * 1000);
|
|
- auto vipscoredate = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("inserttime", inserttimetemp));
|
|
|
|
- auto vipscoredateupdate = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("$inc", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("sellscore", tradescore))));
|
|
|
|
|
|
+ auto vipscoredate = make_document(kvp("inserttime", inserttimetemp));
|
|
|
|
+ auto vipscoredateupdate = make_document(kvp("$inc", make_document(kvp("sellscore", tradescore))));
|
|
auto retvipscore = m_pvipscoredate->find_one_and_update(vipscoredate.view(), vipscoredateupdate.view(), options);
|
|
auto retvipscore = m_pvipscoredate->find_one_and_update(vipscoredate.view(), vipscoredateupdate.view(), options);
|
|
if (retvipscore)
|
|
if (retvipscore)
|
|
{
|
|
{
|
|
@@ -1101,13 +1097,13 @@ std::string HttpSocket::updateuserscore(std::map<std::string, std::string> getda
|
|
buyscore += tradescore;
|
|
buyscore += tradescore;
|
|
double buysellrate = buyscore;
|
|
double buysellrate = buyscore;
|
|
buysellrate /= sellscore;
|
|
buysellrate /= sellscore;
|
|
- auto vipscoreupdate = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("$set", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("buysellrate", buysellrate))));
|
|
|
|
|
|
+ auto vipscoreupdate = make_document(kvp("$set", make_document(kvp("buysellrate", buysellrate))));
|
|
m_pvipscoredate->update_one(vipscoredate.view(), vipscoreupdate.view());
|
|
m_pvipscoredate->update_one(vipscoredate.view(), vipscoreupdate.view());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//记录充值分数
|
|
//记录充值分数
|
|
- auto rechargecriteria = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("userid", iuserid));
|
|
|
|
|
|
+ auto rechargecriteria = make_document(kvp("userid", iuserid));
|
|
auto findlw = m_plosewincoll->find_one(rechargecriteria.view());
|
|
auto findlw = m_plosewincoll->find_one(rechargecriteria.view());
|
|
|
|
|
|
if (findlw)
|
|
if (findlw)
|
|
@@ -1123,24 +1119,24 @@ std::string HttpSocket::updateuserscore(std::map<std::string, std::string> getda
|
|
irechargetime *= (24 * 60 * 60 * 1000);
|
|
irechargetime *= (24 * 60 * 60 * 1000);
|
|
if (irechargetime != inserttimetemp)
|
|
if (irechargetime != inserttimetemp)
|
|
{
|
|
{
|
|
- auto rechargeupdate = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("$inc", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("totalczscore", tradescore))),
|
|
|
|
- bsoncxx::builder::basic::kvp("$set", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("todayczscore", tradescore))),
|
|
|
|
- bsoncxx::builder::basic::kvp("$set", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("rechargetime", ilocaltime))));
|
|
|
|
|
|
+ auto rechargeupdate = make_document(kvp("$inc", make_document(kvp("totalczscore", tradescore))),
|
|
|
|
+ kvp("$set", make_document(kvp("todayczscore", tradescore))),
|
|
|
|
+ kvp("$set", make_document(kvp("rechargetime", ilocaltime))));
|
|
m_plosewincoll->find_one_and_update(rechargecriteria.view(), rechargeupdate.view());
|
|
m_plosewincoll->find_one_and_update(rechargecriteria.view(), rechargeupdate.view());
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- auto rechargeupdate = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("$inc", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("totalczscore", tradescore))),
|
|
|
|
- bsoncxx::builder::basic::kvp("$inc", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("todayczscore", tradescore))),
|
|
|
|
- bsoncxx::builder::basic::kvp("$set", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("rechargetime", ilocaltime))));
|
|
|
|
|
|
+ auto rechargeupdate = make_document(kvp("$inc", make_document(kvp("totalczscore", tradescore))),
|
|
|
|
+ kvp("$inc", make_document(kvp("todayczscore", tradescore))),
|
|
|
|
+ kvp("$set", make_document(kvp("rechargetime", ilocaltime))));
|
|
m_plosewincoll->find_one_and_update(rechargecriteria.view(), rechargeupdate.view());
|
|
m_plosewincoll->find_one_and_update(rechargecriteria.view(), rechargeupdate.view());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- auto rechargeupdate = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("$inc", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("totalczscore", tradescore))),
|
|
|
|
- bsoncxx::builder::basic::kvp("$inc", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("todayczscore", tradescore))),
|
|
|
|
- bsoncxx::builder::basic::kvp("$set", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("rechargetime", ilocaltime))));
|
|
|
|
|
|
+ auto rechargeupdate = make_document(kvp("$inc", make_document(kvp("totalczscore", tradescore))),
|
|
|
|
+ kvp("$inc", make_document(kvp("todayczscore", tradescore))),
|
|
|
|
+ kvp("$set", make_document(kvp("rechargetime", ilocaltime))));
|
|
m_plosewincoll->find_one_and_update(rechargecriteria.view(), rechargeupdate.view());
|
|
m_plosewincoll->find_one_and_update(rechargecriteria.view(), rechargeupdate.view());
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1216,17 +1212,16 @@ std::string HttpSocket::updateuserscore(std::map<std::string, std::string> getda
|
|
}
|
|
}
|
|
|
|
|
|
//用户不存在不能下分
|
|
//用户不存在不能下分
|
|
- auto userretscore = m_pcoll->find_one(bsoncxx::builder::stream::document{} << "account" << tuserscore.account.c_str() << bsoncxx::builder::stream::finalize);
|
|
|
|
|
|
+ auto userretscore = m_pcoll->find_one(bsoncxx::builder::stream::document{} << "userid" << tuserscore.iuserid << bsoncxx::builder::stream::finalize);
|
|
if (!userretscore || !userretscore->view()["userid"])
|
|
if (!userretscore || !userretscore->view()["userid"])
|
|
{
|
|
{
|
|
strret = funclib::rettojson(Err_No_Player, "user isnot exist");
|
|
strret = funclib::rettojson(Err_No_Player, "user isnot exist");
|
|
return strret;
|
|
return strret;
|
|
}
|
|
}
|
|
|
|
|
|
- iuserid = userretscore->view()["userid"].get_int64();
|
|
|
|
|
|
|
|
//玩家在玩游戏不能下分
|
|
//玩家在玩游戏不能下分
|
|
- auto vipuser = m_pplayuseronline->find_one(bsoncxx::builder::stream::document{} << "userid" << iuserid << bsoncxx::builder::stream::finalize);
|
|
|
|
|
|
+ auto vipuser = m_pplayuseronline->find_one(bsoncxx::builder::stream::document{} << "userid" << tuserscore.iuserid << bsoncxx::builder::stream::finalize);
|
|
if (vipuser)
|
|
if (vipuser)
|
|
{
|
|
{
|
|
strret = funclib::rettojson(Err_Player_InGame, "user is playing");
|
|
strret = funclib::rettojson(Err_Player_InGame, "user is playing");
|
|
@@ -1281,8 +1276,8 @@ std::string HttpSocket::updateuserscore(std::map<std::string, std::string> getda
|
|
|
|
|
|
//减用户分数
|
|
//减用户分数
|
|
tuserscore.score = -1 * tuserscore.score;
|
|
tuserscore.score = -1 * tuserscore.score;
|
|
- auto usercriteria = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("userid", iuserid));
|
|
|
|
- auto userupdate = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("$inc", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("score", tuserscore.score))));
|
|
|
|
|
|
+ auto usercriteria = make_document(kvp("userid", tuserscore.iuserid));
|
|
|
|
+ auto userupdate = make_document(kvp("$inc", make_document(kvp("score", tuserscore.score))));
|
|
auto tempscore = m_pcoll->find_one_and_update(usercriteria.view(), userupdate.view());
|
|
auto tempscore = m_pcoll->find_one_and_update(usercriteria.view(), userupdate.view());
|
|
if (!tempscore)
|
|
if (!tempscore)
|
|
{
|
|
{
|
|
@@ -1298,11 +1293,11 @@ std::string HttpSocket::updateuserscore(std::map<std::string, std::string> getda
|
|
tradescore = tuserscore.score;
|
|
tradescore = tuserscore.score;
|
|
|
|
|
|
//添加玩家总下分
|
|
//添加玩家总下分
|
|
- auto xiafenupdate = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("$inc", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("totalxfscore", tradescore))));
|
|
|
|
|
|
+ auto xiafenupdate = make_document(kvp("$inc", make_document(kvp("totalxfscore", tradescore))));
|
|
m_plosewincoll->find_one_and_update(usercriteria.view(), xiafenupdate.view());
|
|
m_plosewincoll->find_one_and_update(usercriteria.view(), xiafenupdate.view());
|
|
|
|
|
|
- auto admincriteria = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("userid", adminuserid));
|
|
|
|
- auto adminupdate = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("$inc", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("score", tradescore))));
|
|
|
|
|
|
+ auto admincriteria = make_document(kvp("userid", adminuserid));
|
|
|
|
+ auto adminupdate = make_document(kvp("$inc", make_document(kvp("score", tradescore))));
|
|
auto adminretscore = m_pvipuser->find_one_and_update(admincriteria.view(), adminupdate.view());
|
|
auto adminretscore = m_pvipuser->find_one_and_update(admincriteria.view(), adminupdate.view());
|
|
if (!adminretscore)
|
|
if (!adminretscore)
|
|
{
|
|
{
|
|
@@ -1311,8 +1306,8 @@ std::string HttpSocket::updateuserscore(std::map<std::string, std::string> getda
|
|
}
|
|
}
|
|
|
|
|
|
__int64 iOne32 = 1;
|
|
__int64 iOne32 = 1;
|
|
- auto vipscorecriteria = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("business", iOne32));
|
|
|
|
- auto vipscoreupdate = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("$inc", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("buyscore", tradescore))));
|
|
|
|
|
|
+ auto vipscorecriteria = make_document(kvp("business", iOne32));
|
|
|
|
+ auto vipscoreupdate = make_document(kvp("$inc", make_document(kvp("buyscore", tradescore))));
|
|
mongocxx::options::find_one_and_update options;
|
|
mongocxx::options::find_one_and_update options;
|
|
options.upsert(true);
|
|
options.upsert(true);
|
|
auto vipscore = m_pvipscore->find_one_and_update(vipscorecriteria.view(), vipscoreupdate.view(), options);
|
|
auto vipscore = m_pvipscore->find_one_and_update(vipscorecriteria.view(), vipscoreupdate.view(), options);
|
|
@@ -1327,7 +1322,7 @@ std::string HttpSocket::updateuserscore(std::map<std::string, std::string> getda
|
|
buyscore += tradescore;
|
|
buyscore += tradescore;
|
|
double buysellrate = buyscore;
|
|
double buysellrate = buyscore;
|
|
buysellrate /= sellscore;
|
|
buysellrate /= sellscore;
|
|
- auto vipscoreupdate = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("$set", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("buysellrate", buysellrate))));
|
|
|
|
|
|
+ auto vipscoreupdate = make_document(kvp("$set", make_document(kvp("buysellrate", buysellrate))));
|
|
m_pvipscore->update_one(vipscorecriteria.view(), vipscoreupdate.view());
|
|
m_pvipscore->update_one(vipscorecriteria.view(), vipscoreupdate.view());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1335,8 +1330,8 @@ std::string HttpSocket::updateuserscore(std::map<std::string, std::string> getda
|
|
|
|
|
|
__int64 inserttimetemp = ilocaltime / (24 * 60 * 60 * 1000);
|
|
__int64 inserttimetemp = ilocaltime / (24 * 60 * 60 * 1000);
|
|
inserttimetemp *= (24 * 60 * 60 * 1000);
|
|
inserttimetemp *= (24 * 60 * 60 * 1000);
|
|
- auto vipscoredate = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("inserttime", inserttimetemp));
|
|
|
|
- auto vipscoredateupdate = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("$inc", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("buyscore", tradescore))));
|
|
|
|
|
|
+ auto vipscoredate = make_document(kvp("inserttime", inserttimetemp));
|
|
|
|
+ auto vipscoredateupdate = make_document(kvp("$inc", make_document(kvp("buyscore", tradescore))));
|
|
auto retvipscore = m_pvipscoredate->find_one_and_update(vipscoredate.view(), vipscoredateupdate.view(), options);
|
|
auto retvipscore = m_pvipscoredate->find_one_and_update(vipscoredate.view(), vipscoredateupdate.view(), options);
|
|
if (retvipscore)
|
|
if (retvipscore)
|
|
{
|
|
{
|
|
@@ -1349,7 +1344,7 @@ std::string HttpSocket::updateuserscore(std::map<std::string, std::string> getda
|
|
buyscore += tradescore;
|
|
buyscore += tradescore;
|
|
double buysellrate = buyscore;
|
|
double buysellrate = buyscore;
|
|
buysellrate /= sellscore;
|
|
buysellrate /= sellscore;
|
|
- auto vipscoreupdate = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("$set", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("buysellrate", buysellrate))));
|
|
|
|
|
|
+ auto vipscoreupdate = make_document(kvp("$set", make_document(kvp("buysellrate", buysellrate))));
|
|
m_pvipscoredate->update_one(vipscoredate.view(), vipscoreupdate.view());
|
|
m_pvipscoredate->update_one(vipscoredate.view(), vipscoreupdate.view());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1559,7 +1554,7 @@ std::string HttpSocket::adminforbiduser(std::map<std::string, std::string> getda
|
|
return strret;
|
|
return strret;
|
|
}
|
|
}
|
|
|
|
|
|
- auto userupdate = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("$set", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("state", tprohibituser.state))));
|
|
|
|
|
|
+ auto userupdate = make_document(kvp("$set", make_document(kvp("state", tprohibituser.state))));
|
|
//禁止自己玩家
|
|
//禁止自己玩家
|
|
m_pcoll->update_one(bsoncxx::builder::stream::document{} << "spreaderid" << adminuserid << "account" << tprohibituser.account.c_str() << bsoncxx::builder::stream::finalize, userupdate.view());
|
|
m_pcoll->update_one(bsoncxx::builder::stream::document{} << "spreaderid" << adminuserid << "account" << tprohibituser.account.c_str() << bsoncxx::builder::stream::finalize, userupdate.view());
|
|
|
|
|
|
@@ -1921,7 +1916,7 @@ std::string HttpSocket::adminforbidmyuser(std::map<std::string, std::string> get
|
|
return strret;
|
|
return strret;
|
|
}
|
|
}
|
|
|
|
|
|
- auto userupdate = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("$set", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("state", tadminprohibituser.state))));
|
|
|
|
|
|
+ auto userupdate = make_document(kvp("$set", make_document(kvp("state", tadminprohibituser.state))));
|
|
//禁止自己玩家
|
|
//禁止自己玩家
|
|
m_pcoll->update_many(bsoncxx::builder::stream::document{} << "spreaderid" << adminuserid << bsoncxx::builder::stream::finalize, userupdate.view());
|
|
m_pcoll->update_many(bsoncxx::builder::stream::document{} << "spreaderid" << adminuserid << bsoncxx::builder::stream::finalize, userupdate.view());
|
|
|
|
|
|
@@ -1940,7 +1935,7 @@ std::string HttpSocket::sellbuyinfo(std::map<std::string, std::string> getdata)
|
|
if (!bret)
|
|
if (!bret)
|
|
{
|
|
{
|
|
strret = funclib::rettojson(Err_ParamError, "param erro");
|
|
strret = funclib::rettojson(Err_ParamError, "param erro");
|
|
- return strret;(Err_KeyNotExist, "code or key isnot exist");
|
|
|
|
|
|
+ return strret;
|
|
}
|
|
}
|
|
|
|
|
|
rapidjson::Document doc;
|
|
rapidjson::Document doc;
|
|
@@ -1949,13 +1944,15 @@ std::string HttpSocket::sellbuyinfo(std::map<std::string, std::string> getdata)
|
|
doc.AddMember("ret", -1, allocator);
|
|
doc.AddMember("ret", -1, allocator);
|
|
|
|
|
|
__int64 adminuserid = 0;
|
|
__int64 adminuserid = 0;
|
|
|
|
+ __int64 beforuserscore = 0;
|
|
|
|
+ __int64 afteruserscore = 0;
|
|
__int64 itradescore = 0;
|
|
__int64 itradescore = 0;
|
|
double dtradescore = 0.0f;
|
|
double dtradescore = 0.0f;
|
|
__int64 inserttime = 0;
|
|
__int64 inserttime = 0;
|
|
__int32 itype = 0;
|
|
__int32 itype = 0;
|
|
|
|
|
|
//判断三方平台是否存在
|
|
//判断三方平台是否存在
|
|
- auto threeadmin = m_pthreeadmin->find_one(bsoncxx::builder::stream::document{} << "authcode" << tsellbuyscoreinfo.authcode.c_str() \
|
|
|
|
|
|
+ /*auto threeadmin = m_pthreeadmin->find_one(bsoncxx::builder::stream::document{} << "authcode" << tsellbuyscoreinfo.authcode.c_str() \
|
|
<< "authkey" << tsellbuyscoreinfo.authkey.c_str() << bsoncxx::builder::stream::finalize);
|
|
<< "authkey" << tsellbuyscoreinfo.authkey.c_str() << bsoncxx::builder::stream::finalize);
|
|
if (!threeadmin)
|
|
if (!threeadmin)
|
|
{
|
|
{
|
|
@@ -1967,40 +1964,57 @@ std::string HttpSocket::sellbuyinfo(std::map<std::string, std::string> getdata)
|
|
{
|
|
{
|
|
strret = funclib::rettojson(Err_ThreeAdminLackInfo, "id isnot exist");
|
|
strret = funclib::rettojson(Err_ThreeAdminLackInfo, "id isnot exist");
|
|
return strret;
|
|
return strret;
|
|
- }
|
|
|
|
|
|
+ }*/
|
|
|
|
|
|
- adminuserid = threeadmin->view()["adminuserid"].get_int64();
|
|
|
|
|
|
+
|
|
|
|
+ if (tsellbuyscoreinfo.iuserid > 0) // 查询玩家
|
|
|
|
+ {
|
|
|
|
+ auto finduser = m_pcoll->find_one(make_document(kvp("userid", tsellbuyscoreinfo.iuserid)));
|
|
|
|
+ if (!finduser || !finduser->view()["spreaderid"])
|
|
|
|
+ {
|
|
|
|
+ strret = funclib::rettojson(Err_Player_LackInfo, "the account is not exist1");
|
|
|
|
+ return strret;
|
|
|
|
+ }
|
|
|
|
+ adminuserid = finduser->view()["spreaderid"].get_int64();
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ adminuserid = tsellbuyscoreinfo.iagentid;
|
|
|
|
+ }
|
|
auto vipuser = m_pvipuser->find_one(bsoncxx::builder::stream::document{} << "userid" << adminuserid << bsoncxx::builder::stream::finalize);
|
|
auto vipuser = m_pvipuser->find_one(bsoncxx::builder::stream::document{} << "userid" << adminuserid << bsoncxx::builder::stream::finalize);
|
|
if (!vipuser)
|
|
if (!vipuser)
|
|
{
|
|
{
|
|
strret = funclib::rettojson(Err_No_Agent, "spreaderid isnot exist");
|
|
strret = funclib::rettojson(Err_No_Agent, "spreaderid isnot exist");
|
|
return strret;
|
|
return strret;
|
|
}
|
|
}
|
|
-
|
|
|
|
- __int32 vipstate = 0;
|
|
|
|
|
|
+ __int32 vipstate = 1;
|
|
if (vipuser->view()["state"])
|
|
if (vipuser->view()["state"])
|
|
- {
|
|
|
|
vipstate = vipuser->view()["state"].get_int32();
|
|
vipstate = vipuser->view()["state"].get_int32();
|
|
- }
|
|
|
|
- else
|
|
|
|
- vipstate = 1;
|
|
|
|
-
|
|
|
|
if (vipstate != 0)
|
|
if (vipstate != 0)
|
|
{
|
|
{
|
|
strret = funclib::rettojson(Err_OutOfState_Agent, "spreaderid is disabled");
|
|
strret = funclib::rettojson(Err_OutOfState_Agent, "spreaderid is disabled");
|
|
return strret;
|
|
return strret;
|
|
}
|
|
}
|
|
|
|
|
|
- auto timeview = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("inserttime", -1));
|
|
|
|
|
|
+ auto timeview = make_document(kvp("inserttime", -1));
|
|
mongocxx::options::find options;
|
|
mongocxx::options::find options;
|
|
options.sort(timeview.view());
|
|
options.sort(timeview.view());
|
|
options.limit(20);
|
|
options.limit(20);
|
|
options.skip(tsellbuyscoreinfo.ipagenum * 20);
|
|
options.skip(tsellbuyscoreinfo.ipagenum * 20);
|
|
|
|
|
|
- auto findinfo = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("spreaderid", adminuserid),
|
|
|
|
- bsoncxx::builder::basic::kvp("inserttime", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("$lte", tsellbuyscoreinfo.endtime), bsoncxx::builder::basic::kvp("$gt", tsellbuyscoreinfo.begintime))));
|
|
|
|
- auto tradeinfo = m_pusertradeinfo->find(findinfo.view(), options);
|
|
|
|
|
|
+ document findinfo;
|
|
|
|
+ findinfo.append(kvp("inserttime", make_document(kvp("$lte", tsellbuyscoreinfo.endtime), kvp("$gt", tsellbuyscoreinfo.begintime))));
|
|
|
|
+ if (tsellbuyscoreinfo.iuserid > 0)
|
|
|
|
+ findinfo.append(kvp("userid", tsellbuyscoreinfo.iuserid));
|
|
|
|
+ else if(adminuserid > 0)
|
|
|
|
+ findinfo.append(kvp("spreaderid", adminuserid));
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ strret = funclib::rettojson(Err_ParamError, "param erro");
|
|
|
|
+ return strret;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ auto tradeinfo = m_pusertradeinfo->find(findinfo.view(), options);
|
|
rapidjson::Value timeArray(rapidjson::kArrayType);
|
|
rapidjson::Value timeArray(rapidjson::kArrayType);
|
|
|
|
|
|
for (auto &tempinfo:tradeinfo)
|
|
for (auto &tempinfo:tradeinfo)
|
|
@@ -2008,57 +2022,44 @@ std::string HttpSocket::sellbuyinfo(std::map<std::string, std::string> getdata)
|
|
rapidjson::Document sellbuyinfodoc;
|
|
rapidjson::Document sellbuyinfodoc;
|
|
sellbuyinfodoc.SetObject();
|
|
sellbuyinfodoc.SetObject();
|
|
rapidjson::Document::AllocatorType& sallocator = sellbuyinfodoc.GetAllocator();
|
|
rapidjson::Document::AllocatorType& sallocator = sellbuyinfodoc.GetAllocator();
|
|
|
|
+
|
|
|
|
+ if (!tempinfo["userid"])
|
|
|
|
+ continue;
|
|
|
|
+ sellbuyinfodoc.AddMember("userid", tempinfo["userid"].get_int64(), sallocator);
|
|
|
|
|
|
- std::string useraccount{};
|
|
|
|
- if (tempinfo["useraccount"])
|
|
|
|
- {
|
|
|
|
- useraccount = tempinfo["useraccount"].get_utf8().value.data();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- sellbuyinfodoc.AddMember("useraccount", rapidjson::Value(useraccount.c_str(), sallocator), sallocator);
|
|
|
|
-
|
|
|
|
- std::string stritype{ "0" };
|
|
|
|
|
|
+ itype = 0;
|
|
if (tempinfo["type"])
|
|
if (tempinfo["type"])
|
|
- {
|
|
|
|
itype = tempinfo["type"].get_int32();
|
|
itype = tempinfo["type"].get_int32();
|
|
- try
|
|
|
|
- {
|
|
|
|
- stritype = std::to_string(itype);
|
|
|
|
- }
|
|
|
|
- catch (const std::exception&)
|
|
|
|
- {
|
|
|
|
- stritype = "0";
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- sellbuyinfodoc.AddMember("sellbuy", rapidjson::Value(stritype.c_str(), sallocator), sallocator);
|
|
|
|
|
|
+ sellbuyinfodoc.AddMember("type", itype, sallocator);
|
|
|
|
|
|
- std::string stritradescore{"0"};
|
|
|
|
|
|
+ itradescore = 0;
|
|
if (tempinfo["tradescore"])
|
|
if (tempinfo["tradescore"])
|
|
- {
|
|
|
|
itradescore = tempinfo["tradescore"].get_int64();
|
|
itradescore = tempinfo["tradescore"].get_int64();
|
|
- }
|
|
|
|
-
|
|
|
|
- stritradescore = getdouble(itradescore);
|
|
|
|
|
|
+ std::string stritradescore = getdouble(itradescore);
|
|
sellbuyinfodoc.AddMember("tradescore", rapidjson::Value(stritradescore.c_str(), sallocator), sallocator);
|
|
sellbuyinfodoc.AddMember("tradescore", rapidjson::Value(stritradescore.c_str(), sallocator), sallocator);
|
|
|
|
|
|
|
|
+ beforuserscore = 0;
|
|
|
|
+ if (tempinfo["beforeuserscore"])
|
|
|
|
+ beforuserscore = tempinfo["beforeuserscore"].get_int64();
|
|
|
|
+ std::string strbeforuserscore = getdouble(beforuserscore);
|
|
|
|
+ sellbuyinfodoc.AddMember("beforeuserscore", rapidjson::Value(strbeforuserscore.c_str(), sallocator), sallocator);
|
|
|
|
+
|
|
|
|
+ afteruserscore = 0;
|
|
|
|
+ if (tempinfo["afteruserscore"])
|
|
|
|
+ afteruserscore = tempinfo["afteruserscore"].get_int64();
|
|
|
|
+ std::string strafteruserscore = getdouble(afteruserscore);
|
|
|
|
+ sellbuyinfodoc.AddMember("afteruserscore", rapidjson::Value(strafteruserscore.c_str(), sallocator), sallocator);
|
|
|
|
+
|
|
inserttime = 0;
|
|
inserttime = 0;
|
|
if (tempinfo["inserttime"])
|
|
if (tempinfo["inserttime"])
|
|
- {
|
|
|
|
- inserttime = tempinfo["inserttime"].get_int64();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- std::string strinserttime{};
|
|
|
|
- if (inserttime >= 0)
|
|
|
|
- {
|
|
|
|
- strinserttime = funclib::gettimefromstamp(inserttime);
|
|
|
|
- }
|
|
|
|
- sellbuyinfodoc.AddMember("inserttime", rapidjson::Value(strinserttime.c_str(), sallocator), sallocator);
|
|
|
|
|
|
+ inserttime = tempinfo["inserttime"].get_int64();
|
|
|
|
+ sellbuyinfodoc.AddMember("inserttime", inserttime, sallocator);
|
|
|
|
|
|
rapidjson::Value element(rapidjson::kObjectType);
|
|
rapidjson::Value element(rapidjson::kObjectType);
|
|
element.CopyFrom(sellbuyinfodoc, allocator);
|
|
element.CopyFrom(sellbuyinfodoc, allocator);
|
|
timeArray.PushBack(element, allocator);
|
|
timeArray.PushBack(element, allocator);
|
|
}
|
|
}
|
|
- doc.AddMember("sellbuyinfo", timeArray, allocator);
|
|
|
|
|
|
+ doc.AddMember("data", timeArray, allocator);
|
|
|
|
|
|
//操作成功
|
|
//操作成功
|
|
strret = funclib::doctojson(doc);
|
|
strret = funclib::doctojson(doc);
|
|
@@ -2091,13 +2092,21 @@ std::string HttpSocket::playgameinfo(std::map<std::string, std::string> getdata)
|
|
return strret;
|
|
return strret;
|
|
}
|
|
}
|
|
|
|
|
|
- if (!threeadmin->view()["adminuserid"])
|
|
|
|
|
|
+
|
|
|
|
+ auto finduser = m_pcoll->find_one(bsoncxx::builder::stream::document{} << "userid" << tplayinfo.iuserid << bsoncxx::builder::stream::finalize);
|
|
|
|
+ if (!finduser)
|
|
{
|
|
{
|
|
- strret = funclib::rettojson(Err_ThreeAdminLackInfo, "id isnot exist");
|
|
|
|
|
|
+ strret = funclib::rettojson(Err_No_Player, "the account is not exist");
|
|
return strret;
|
|
return strret;
|
|
}
|
|
}
|
|
|
|
|
|
- iadminuserid = threeadmin->view()["adminuserid"].get_int64();
|
|
|
|
|
|
+ if (!finduser->view()["spreaderid"])
|
|
|
|
+ {
|
|
|
|
+ strret = funclib::rettojson(Err_Player_LackInfo, "the account is not exist1");
|
|
|
|
+ return strret;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ iadminuserid = finduser->view()["spreaderid"].get_int64();
|
|
auto vipuser = m_pvipuser->find_one(bsoncxx::builder::stream::document{} << "userid" << iadminuserid << bsoncxx::builder::stream::finalize);
|
|
auto vipuser = m_pvipuser->find_one(bsoncxx::builder::stream::document{} << "userid" << iadminuserid << bsoncxx::builder::stream::finalize);
|
|
if (!vipuser)
|
|
if (!vipuser)
|
|
{
|
|
{
|
|
@@ -2119,35 +2128,15 @@ std::string HttpSocket::playgameinfo(std::map<std::string, std::string> getdata)
|
|
return strret;
|
|
return strret;
|
|
}
|
|
}
|
|
|
|
|
|
- auto finduser = m_pcoll->find_one(bsoncxx::builder::stream::document{} << "account" << tplayinfo.account.c_str() << bsoncxx::builder::stream::finalize);
|
|
|
|
- if (!finduser)
|
|
|
|
- {
|
|
|
|
- strret = funclib::rettojson(Err_No_Player, "the account is not exist");
|
|
|
|
- return strret;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (!finduser->view()["spreaderid"])
|
|
|
|
- {
|
|
|
|
- strret = funclib::rettojson(Err_Player_LackInfo, "the account is not exist1");
|
|
|
|
- return strret;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- userspreadid = finduser->view()["spreaderid"].get_int64();
|
|
|
|
-
|
|
|
|
- if (userspreadid != iadminuserid)
|
|
|
|
- {
|
|
|
|
- strret = funclib::rettojson(Err_UserIdNotMatchSpreadId, "the account is not belong to you");
|
|
|
|
- return strret;
|
|
|
|
- }
|
|
|
|
|
|
|
|
- auto findinfo = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("account", tplayinfo.account.c_str()),
|
|
|
|
- bsoncxx::builder::basic::kvp("inserttime", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("$lte", tplayinfo.endtime), bsoncxx::builder::basic::kvp("$gte", tplayinfo.begintime))));
|
|
|
|
|
|
+ auto findinfo = make_document(kvp("userid", tplayinfo.iuserid), kvp("gametype", tplayinfo.igametype),
|
|
|
|
+ kvp("inserttime", make_document(kvp("$lte", tplayinfo.endtime), kvp("$gte", tplayinfo.begintime))));
|
|
|
|
|
|
- auto timeview = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("inserttime", -1));
|
|
|
|
|
|
+ auto timeview = make_document(kvp("inserttime", -1));
|
|
mongocxx::options::find options;
|
|
mongocxx::options::find options;
|
|
options.sort(timeview.view());
|
|
options.sort(timeview.view());
|
|
- options.limit(1000);
|
|
|
|
- options.skip(tplayinfo.ipagenum*1000);
|
|
|
|
|
|
+ options.limit(tplayinfo.ipagesize);
|
|
|
|
+ options.skip(tplayinfo.ipagenum* tplayinfo.ipagesize);
|
|
auto tradeinfo = m_pgameprizelog->find(findinfo.view(), options);
|
|
auto tradeinfo = m_pgameprizelog->find(findinfo.view(), options);
|
|
|
|
|
|
rapidjson::Document doc;
|
|
rapidjson::Document doc;
|
|
@@ -2167,22 +2156,11 @@ std::string HttpSocket::playgameinfo(std::map<std::string, std::string> getdata)
|
|
gameinfodoc.SetObject();
|
|
gameinfodoc.SetObject();
|
|
rapidjson::Document::AllocatorType& gallocator = gameinfodoc.GetAllocator();
|
|
rapidjson::Document::AllocatorType& gallocator = gameinfodoc.GetAllocator();
|
|
|
|
|
|
- if (tempinfo["dbquestid"])
|
|
|
|
- {
|
|
|
|
- itemp64 = tempinfo["dbquestid"].get_int64();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- std::string betid{};
|
|
|
|
- try
|
|
|
|
- {
|
|
|
|
- betid = std::to_string(itemp64);
|
|
|
|
- }
|
|
|
|
- catch (const std::exception&)
|
|
|
|
- {
|
|
|
|
- betid = "0";
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- gameinfodoc.AddMember("betid", rapidjson::Value(betid.c_str(), gallocator), gallocator);
|
|
|
|
|
|
+ if (!tempinfo["dbquestid"])
|
|
|
|
+ continue;
|
|
|
|
+
|
|
|
|
+ strtemp = tempinfo["dbquestid"].get_utf8().value.data();
|
|
|
|
+ gameinfodoc.AddMember("betid", rapidjson::Value(strtemp.c_str(), gallocator), gallocator);
|
|
|
|
|
|
std::string useraccount{};
|
|
std::string useraccount{};
|
|
if (tempinfo["account"])
|
|
if (tempinfo["account"])
|
|
@@ -2202,26 +2180,15 @@ std::string HttpSocket::playgameinfo(std::map<std::string, std::string> getdata)
|
|
if (tempinfo["tableid"])
|
|
if (tempinfo["tableid"])
|
|
{
|
|
{
|
|
itemp32 = tempinfo["tableid"].get_int32();
|
|
itemp32 = tempinfo["tableid"].get_int32();
|
|
|
|
+ gameinfodoc.AddMember("tableid", itemp32, gallocator);
|
|
}
|
|
}
|
|
-
|
|
|
|
- std::string tableid{};
|
|
|
|
- try
|
|
|
|
- {
|
|
|
|
- tableid = std::to_string(itemp32);
|
|
|
|
- }
|
|
|
|
- catch (const std::exception&)
|
|
|
|
- {
|
|
|
|
- tableid = "0";
|
|
|
|
- }
|
|
|
|
- gameinfodoc.AddMember("tableid", rapidjson::Value(tableid.c_str(), gallocator), gallocator);
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
|
|
itemp64 = 0;
|
|
itemp64 = 0;
|
|
if (tempinfo["betscore"])
|
|
if (tempinfo["betscore"])
|
|
{
|
|
{
|
|
itemp64 = tempinfo["betscore"].get_int64();
|
|
itemp64 = tempinfo["betscore"].get_int64();
|
|
}
|
|
}
|
|
-
|
|
|
|
strtemp = getdouble(itemp64);
|
|
strtemp = getdouble(itemp64);
|
|
gameinfodoc.AddMember("betscore", rapidjson::Value(strtemp.c_str(), gallocator), gallocator);
|
|
gameinfodoc.AddMember("betscore", rapidjson::Value(strtemp.c_str(), gallocator), gallocator);
|
|
|
|
|
|
@@ -2230,7 +2197,6 @@ std::string HttpSocket::playgameinfo(std::map<std::string, std::string> getdata)
|
|
{
|
|
{
|
|
itemp64 = tempinfo["winscore"].get_int64();
|
|
itemp64 = tempinfo["winscore"].get_int64();
|
|
}
|
|
}
|
|
-
|
|
|
|
strtemp = getdouble(itemp64);
|
|
strtemp = getdouble(itemp64);
|
|
gameinfodoc.AddMember("winscore", rapidjson::Value(strtemp.c_str(), gallocator), gallocator);
|
|
gameinfodoc.AddMember("winscore", rapidjson::Value(strtemp.c_str(), gallocator), gallocator);
|
|
|
|
|
|
@@ -2238,8 +2204,7 @@ std::string HttpSocket::playgameinfo(std::map<std::string, std::string> getdata)
|
|
if (tempinfo["userscore"])
|
|
if (tempinfo["userscore"])
|
|
{
|
|
{
|
|
itemp64 = tempinfo["userscore"].get_int64();
|
|
itemp64 = tempinfo["userscore"].get_int64();
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ }
|
|
strtemp = getdouble(itemp64);
|
|
strtemp = getdouble(itemp64);
|
|
gameinfodoc.AddMember("userscore", rapidjson::Value(strtemp.c_str(), gallocator), gallocator);
|
|
gameinfodoc.AddMember("userscore", rapidjson::Value(strtemp.c_str(), gallocator), gallocator);
|
|
|
|
|
|
@@ -2367,8 +2332,8 @@ std::string HttpSocket::getuserplayscoreinfo(std::map<std::string, std::string>
|
|
return strret;
|
|
return strret;
|
|
}
|
|
}
|
|
|
|
|
|
- auto findinfo = bsoncxx::builder::basic::make_document(
|
|
|
|
- bsoncxx::builder::basic::kvp("inserttime", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("$lte", tplayscoreinfo.endtime), bsoncxx::builder::basic::kvp("$gte", tplayscoreinfo.begintime))));
|
|
|
|
|
|
+ auto findinfo = make_document(
|
|
|
|
+ kvp("inserttime", make_document(kvp("$lte", tplayscoreinfo.endtime), kvp("$gte", tplayscoreinfo.begintime))));
|
|
auto tradeinfo = m_pgameprizelog->find(findinfo.view());
|
|
auto tradeinfo = m_pgameprizelog->find(findinfo.view());
|
|
|
|
|
|
//玩家总下注
|
|
//玩家总下注
|
|
@@ -2577,8 +2542,8 @@ std::string HttpSocket::updateuseringot(std::map<std::string, std::string> getda
|
|
itempscore = tupdateingot.score * -1;
|
|
itempscore = tupdateingot.score * -1;
|
|
|
|
|
|
//减商家分数
|
|
//减商家分数
|
|
- auto criteria = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("userid", iadminuserid));
|
|
|
|
- auto update = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("$inc", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("score", itempscore))));
|
|
|
|
|
|
+ auto criteria = make_document(kvp("userid", iadminuserid));
|
|
|
|
+ auto update = make_document(kvp("$inc", make_document(kvp("score", itempscore))));
|
|
auto retscore = m_pvipuser->find_one_and_update(criteria.view(), update.view());
|
|
auto retscore = m_pvipuser->find_one_and_update(criteria.view(), update.view());
|
|
if (!retscore)
|
|
if (!retscore)
|
|
{
|
|
{
|
|
@@ -2600,9 +2565,9 @@ std::string HttpSocket::updateuseringot(std::map<std::string, std::string> getda
|
|
|
|
|
|
//给用户家奖金码
|
|
//给用户家奖金码
|
|
itempscore = tupdateingot.score;
|
|
itempscore = tupdateingot.score;
|
|
- auto usercriteria = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("userid", iuserid));
|
|
|
|
- auto userupdate = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("$inc", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("score", itempscore))),
|
|
|
|
- bsoncxx::builder::basic::kvp("$inc", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("ingot", itempscore))));
|
|
|
|
|
|
+ auto usercriteria = make_document(kvp("userid", iuserid));
|
|
|
|
+ auto userupdate = make_document(kvp("$inc", make_document(kvp("score", itempscore))),
|
|
|
|
+ kvp("$inc", make_document(kvp("ingot", itempscore))));
|
|
auto userretscore = m_pcoll->find_one_and_update(usercriteria.view(), userupdate.view());
|
|
auto userretscore = m_pcoll->find_one_and_update(usercriteria.view(), userupdate.view());
|
|
if (!userretscore)
|
|
if (!userretscore)
|
|
{
|
|
{
|
|
@@ -2614,8 +2579,8 @@ std::string HttpSocket::updateuseringot(std::map<std::string, std::string> getda
|
|
tradescore = tupdateingot.score;
|
|
tradescore = tupdateingot.score;
|
|
|
|
|
|
__int64 iOne32 = 1;
|
|
__int64 iOne32 = 1;
|
|
- auto vipscorecriteria = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("business", iOne32));
|
|
|
|
- auto vipscoreupdate = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("$inc", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("sellscore", tradescore))));
|
|
|
|
|
|
+ auto vipscorecriteria = make_document(kvp("business", iOne32));
|
|
|
|
+ auto vipscoreupdate = make_document(kvp("$inc", make_document(kvp("sellscore", tradescore))));
|
|
mongocxx::options::find_one_and_update options;
|
|
mongocxx::options::find_one_and_update options;
|
|
options.upsert(true);
|
|
options.upsert(true);
|
|
auto vipscore = m_pvipscore->find_one_and_update(vipscorecriteria.view(), vipscoreupdate.view(), options);
|
|
auto vipscore = m_pvipscore->find_one_and_update(vipscorecriteria.view(), vipscoreupdate.view(), options);
|
|
@@ -2630,7 +2595,7 @@ std::string HttpSocket::updateuseringot(std::map<std::string, std::string> getda
|
|
buyscore += tradescore;
|
|
buyscore += tradescore;
|
|
double buysellrate = buyscore;
|
|
double buysellrate = buyscore;
|
|
buysellrate /= sellscore;
|
|
buysellrate /= sellscore;
|
|
- auto vipscoreupdate = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("$set", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("buysellrate", buysellrate))));
|
|
|
|
|
|
+ auto vipscoreupdate = make_document(kvp("$set", make_document(kvp("buysellrate", buysellrate))));
|
|
m_pvipscore->update_one(vipscorecriteria.view(), vipscoreupdate.view());
|
|
m_pvipscore->update_one(vipscorecriteria.view(), vipscoreupdate.view());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -2638,8 +2603,8 @@ std::string HttpSocket::updateuseringot(std::map<std::string, std::string> getda
|
|
|
|
|
|
__int64 inserttimetemp = ilocaltime / (24 * 60 * 60 * 1000);
|
|
__int64 inserttimetemp = ilocaltime / (24 * 60 * 60 * 1000);
|
|
inserttimetemp *= (24 * 60 * 60 * 1000);
|
|
inserttimetemp *= (24 * 60 * 60 * 1000);
|
|
- auto vipscoredate = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("inserttime", inserttimetemp));
|
|
|
|
- auto vipscoredateupdate = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("$inc", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("sellscore", tradescore))));
|
|
|
|
|
|
+ auto vipscoredate = make_document(kvp("inserttime", inserttimetemp));
|
|
|
|
+ auto vipscoredateupdate = make_document(kvp("$inc", make_document(kvp("sellscore", tradescore))));
|
|
auto retvipscore = m_pvipscoredate->find_one_and_update(vipscoredate.view(), vipscoredateupdate.view(), options);
|
|
auto retvipscore = m_pvipscoredate->find_one_and_update(vipscoredate.view(), vipscoredateupdate.view(), options);
|
|
if (retvipscore)
|
|
if (retvipscore)
|
|
{
|
|
{
|
|
@@ -2652,13 +2617,13 @@ std::string HttpSocket::updateuseringot(std::map<std::string, std::string> getda
|
|
buyscore += tradescore;
|
|
buyscore += tradescore;
|
|
double buysellrate = buyscore;
|
|
double buysellrate = buyscore;
|
|
buysellrate /= sellscore;
|
|
buysellrate /= sellscore;
|
|
- auto vipscoreupdate = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("$set", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("buysellrate", buysellrate))));
|
|
|
|
|
|
+ auto vipscoreupdate = make_document(kvp("$set", make_document(kvp("buysellrate", buysellrate))));
|
|
m_pvipscoredate->update_one(vipscoredate.view(), vipscoreupdate.view());
|
|
m_pvipscoredate->update_one(vipscoredate.view(), vipscoreupdate.view());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//记录充值分数
|
|
//记录充值分数
|
|
- auto rechargecriteria = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("userid", iuserid));
|
|
|
|
|
|
+ auto rechargecriteria = make_document(kvp("userid", iuserid));
|
|
auto findlw = m_plosewincoll->find_one(rechargecriteria.view());
|
|
auto findlw = m_plosewincoll->find_one(rechargecriteria.view());
|
|
|
|
|
|
if (findlw)
|
|
if (findlw)
|
|
@@ -2674,29 +2639,29 @@ std::string HttpSocket::updateuseringot(std::map<std::string, std::string> getda
|
|
irechargetime *= (24 * 60 * 60 * 1000);
|
|
irechargetime *= (24 * 60 * 60 * 1000);
|
|
if (irechargetime != inserttimetemp)
|
|
if (irechargetime != inserttimetemp)
|
|
{
|
|
{
|
|
- auto rechargeupdate = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("$inc", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("totalczscore", tradescore))),
|
|
|
|
- bsoncxx::builder::basic::kvp("$set", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("todayczscore", tradescore))),
|
|
|
|
- bsoncxx::builder::basic::kvp("$set", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("rechargetime", ilocaltime))));
|
|
|
|
|
|
+ auto rechargeupdate = make_document(kvp("$inc", make_document(kvp("totalczscore", tradescore))),
|
|
|
|
+ kvp("$set", make_document(kvp("todayczscore", tradescore))),
|
|
|
|
+ kvp("$set", make_document(kvp("rechargetime", ilocaltime))));
|
|
m_plosewincoll->find_one_and_update(rechargecriteria.view(), rechargeupdate.view());
|
|
m_plosewincoll->find_one_and_update(rechargecriteria.view(), rechargeupdate.view());
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- auto rechargeupdate = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("$inc", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("totalczscore", tradescore))),
|
|
|
|
- bsoncxx::builder::basic::kvp("$inc", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("todayczscore", tradescore))),
|
|
|
|
- bsoncxx::builder::basic::kvp("$set", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("rechargetime", ilocaltime))));
|
|
|
|
|
|
+ auto rechargeupdate = make_document(kvp("$inc", make_document(kvp("totalczscore", tradescore))),
|
|
|
|
+ kvp("$inc", make_document(kvp("todayczscore", tradescore))),
|
|
|
|
+ kvp("$set", make_document(kvp("rechargetime", ilocaltime))));
|
|
m_plosewincoll->find_one_and_update(rechargecriteria.view(), rechargeupdate.view());
|
|
m_plosewincoll->find_one_and_update(rechargecriteria.view(), rechargeupdate.view());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- auto rechargeupdate = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("$inc", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("totalczscore", tradescore))),
|
|
|
|
- bsoncxx::builder::basic::kvp("$inc", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("todayczscore", tradescore))),
|
|
|
|
- bsoncxx::builder::basic::kvp("$set", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("rechargetime", ilocaltime))));
|
|
|
|
|
|
+ auto rechargeupdate = make_document(kvp("$inc", make_document(kvp("totalczscore", tradescore))),
|
|
|
|
+ kvp("$inc", make_document(kvp("todayczscore", tradescore))),
|
|
|
|
+ kvp("$set", make_document(kvp("rechargetime", ilocaltime))));
|
|
m_plosewincoll->find_one_and_update(rechargecriteria.view(), rechargeupdate.view());
|
|
m_plosewincoll->find_one_and_update(rechargecriteria.view(), rechargeupdate.view());
|
|
}
|
|
}
|
|
|
|
|
|
//记录奖励码总数
|
|
//记录奖励码总数
|
|
- //auto temptotalingot = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("$inc", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("allingot", tradescore))));
|
|
|
|
|
|
+ //auto temptotalingot = make_document(kvp("$inc", make_document(kvp("allingot", tradescore))));
|
|
//m_plosewincoll->update_one(rechargecriteria.view(), temptotalingot.view());
|
|
//m_plosewincoll->update_one(rechargecriteria.view(), temptotalingot.view());
|
|
|
|
|
|
//生成转账记录
|
|
//生成转账记录
|
|
@@ -2905,9 +2870,9 @@ std::string HttpSocket::backuseringot(std::map<std::string, std::string> getdata
|
|
|
|
|
|
//减用户的奖励码
|
|
//减用户的奖励码
|
|
itempscore = -1* tbackingot.score;
|
|
itempscore = -1* tbackingot.score;
|
|
- auto usercriteria = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("userid", iuserid));
|
|
|
|
- auto userupdate = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("$inc", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("score", itempscore))),
|
|
|
|
- bsoncxx::builder::basic::kvp("$inc", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("ingot", itempscore))));
|
|
|
|
|
|
+ auto usercriteria = make_document(kvp("userid", iuserid));
|
|
|
|
+ auto userupdate = make_document(kvp("$inc", make_document(kvp("score", itempscore))),
|
|
|
|
+ kvp("$inc", make_document(kvp("ingot", itempscore))));
|
|
auto tempscore = m_pcoll->find_one_and_update(usercriteria.view(), userupdate.view());
|
|
auto tempscore = m_pcoll->find_one_and_update(usercriteria.view(), userupdate.view());
|
|
if (!tempscore)
|
|
if (!tempscore)
|
|
{
|
|
{
|
|
@@ -2920,12 +2885,12 @@ std::string HttpSocket::backuseringot(std::map<std::string, std::string> getdata
|
|
tradescore = tbackingot.score;
|
|
tradescore = tbackingot.score;
|
|
|
|
|
|
//添加玩家总下分
|
|
//添加玩家总下分
|
|
- auto xiafenupdate = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("$inc", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("totalxfscore", tradescore))));
|
|
|
|
|
|
+ auto xiafenupdate = make_document(kvp("$inc", make_document(kvp("totalxfscore", tradescore))));
|
|
m_plosewincoll->find_one_and_update(usercriteria.view(), xiafenupdate.view());
|
|
m_plosewincoll->find_one_and_update(usercriteria.view(), xiafenupdate.view());
|
|
|
|
|
|
//增加商家的分数
|
|
//增加商家的分数
|
|
- auto admincriteria = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("userid", iadminuserid));
|
|
|
|
- auto adminupdate = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("$inc", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("score", tradescore))));
|
|
|
|
|
|
+ auto admincriteria = make_document(kvp("userid", iadminuserid));
|
|
|
|
+ auto adminupdate = make_document(kvp("$inc", make_document(kvp("score", tradescore))));
|
|
auto adminretscore = m_pvipuser->find_one_and_update(admincriteria.view(), adminupdate.view());
|
|
auto adminretscore = m_pvipuser->find_one_and_update(admincriteria.view(), adminupdate.view());
|
|
if (!adminretscore)
|
|
if (!adminretscore)
|
|
{
|
|
{
|
|
@@ -2934,8 +2899,8 @@ std::string HttpSocket::backuseringot(std::map<std::string, std::string> getdata
|
|
}
|
|
}
|
|
|
|
|
|
__int64 iOne32 = 1;
|
|
__int64 iOne32 = 1;
|
|
- auto vipscorecriteria = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("business", iOne32));
|
|
|
|
- auto vipscoreupdate = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("$inc", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("buyscore", tradescore))));
|
|
|
|
|
|
+ auto vipscorecriteria = make_document(kvp("business", iOne32));
|
|
|
|
+ auto vipscoreupdate = make_document(kvp("$inc", make_document(kvp("buyscore", tradescore))));
|
|
mongocxx::options::find_one_and_update options;
|
|
mongocxx::options::find_one_and_update options;
|
|
options.upsert(true);
|
|
options.upsert(true);
|
|
auto vipscore = m_pvipscore->find_one_and_update(vipscorecriteria.view(), vipscoreupdate.view(), options);
|
|
auto vipscore = m_pvipscore->find_one_and_update(vipscorecriteria.view(), vipscoreupdate.view(), options);
|
|
@@ -2950,7 +2915,7 @@ std::string HttpSocket::backuseringot(std::map<std::string, std::string> getdata
|
|
buyscore += tradescore;
|
|
buyscore += tradescore;
|
|
double buysellrate = buyscore;
|
|
double buysellrate = buyscore;
|
|
buysellrate /= sellscore;
|
|
buysellrate /= sellscore;
|
|
- auto vipscoreupdate = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("$set", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("buysellrate", buysellrate))));
|
|
|
|
|
|
+ auto vipscoreupdate = make_document(kvp("$set", make_document(kvp("buysellrate", buysellrate))));
|
|
m_pvipscore->update_one(vipscorecriteria.view(), vipscoreupdate.view());
|
|
m_pvipscore->update_one(vipscorecriteria.view(), vipscoreupdate.view());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -2958,8 +2923,8 @@ std::string HttpSocket::backuseringot(std::map<std::string, std::string> getdata
|
|
|
|
|
|
__int64 inserttimetemp = ilocaltime / (24 * 60 * 60 * 1000);
|
|
__int64 inserttimetemp = ilocaltime / (24 * 60 * 60 * 1000);
|
|
inserttimetemp *= (24 * 60 * 60 * 1000);
|
|
inserttimetemp *= (24 * 60 * 60 * 1000);
|
|
- auto vipscoredate = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("inserttime", inserttimetemp));
|
|
|
|
- auto vipscoredateupdate = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("$inc", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("buyscore", tradescore))));
|
|
|
|
|
|
+ auto vipscoredate = make_document(kvp("inserttime", inserttimetemp));
|
|
|
|
+ auto vipscoredateupdate = make_document(kvp("$inc", make_document(kvp("buyscore", tradescore))));
|
|
auto retvipscore = m_pvipscoredate->find_one_and_update(vipscoredate.view(), vipscoredateupdate.view(), options);
|
|
auto retvipscore = m_pvipscoredate->find_one_and_update(vipscoredate.view(), vipscoredateupdate.view(), options);
|
|
if (retvipscore)
|
|
if (retvipscore)
|
|
{
|
|
{
|
|
@@ -2972,7 +2937,7 @@ std::string HttpSocket::backuseringot(std::map<std::string, std::string> getdata
|
|
buyscore += tradescore;
|
|
buyscore += tradescore;
|
|
double buysellrate = buyscore;
|
|
double buysellrate = buyscore;
|
|
buysellrate /= sellscore;
|
|
buysellrate /= sellscore;
|
|
- auto vipscoreupdate = bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("$set", bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("buysellrate", buysellrate))));
|
|
|
|
|
|
+ auto vipscoreupdate = make_document(kvp("$set", make_document(kvp("buysellrate", buysellrate))));
|
|
m_pvipscoredate->update_one(vipscoredate.view(), vipscoreupdate.view());
|
|
m_pvipscoredate->update_one(vipscoredate.view(), vipscoreupdate.view());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -3073,7 +3038,7 @@ std::string HttpSocket::getalluserplayscoreinfo(std::map<std::string, std::strin
|
|
m_mapuseridname.clear();
|
|
m_mapuseridname.clear();
|
|
std::string tempname;
|
|
std::string tempname;
|
|
mongocxx::options::find options;
|
|
mongocxx::options::find options;
|
|
- options.projection(bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("userid", 1), bsoncxx::builder::basic::kvp("name", 1)));
|
|
|
|
|
|
+ options.projection(make_document(kvp("userid", 1), kvp("name", 1)));
|
|
auto finduser = m_pcoll->find(bsoncxx::builder::stream::document{} << "spreaderid" << iadminuserid << bsoncxx::builder::stream::finalize, options);
|
|
auto finduser = m_pcoll->find(bsoncxx::builder::stream::document{} << "spreaderid" << iadminuserid << bsoncxx::builder::stream::finalize, options);
|
|
for (auto& doc : finduser)
|
|
for (auto& doc : finduser)
|
|
{
|
|
{
|
|
@@ -3117,14 +3082,14 @@ std::string HttpSocket::getalluserplayscoreinfo(std::map<std::string, std::strin
|
|
// << " iskipnum=" << iskipnum;
|
|
// << " iskipnum=" << iskipnum;
|
|
|
|
|
|
taggameuserlog tempvect;
|
|
taggameuserlog tempvect;
|
|
- bsoncxx::builder::basic::document files_filter;
|
|
|
|
- files_filter.append(bsoncxx::builder::basic::kvp("spreaderid", iadminuserid));
|
|
|
|
- files_filter.append(bsoncxx::builder::basic::kvp("$and",
|
|
|
|
- bsoncxx::builder::basic::make_array(
|
|
|
|
- bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("inserttime",
|
|
|
|
- bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("$gte", tallplayscoreinfo.begintime)))),
|
|
|
|
- bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("inserttime",
|
|
|
|
- bsoncxx::builder::basic::make_document(bsoncxx::builder::basic::kvp("$lt", tallplayscoreinfo.endtime)))))));
|
|
|
|
|
|
+ document files_filter;
|
|
|
|
+ files_filter.append(kvp("spreaderid", iadminuserid));
|
|
|
|
+ files_filter.append(kvp("$and",
|
|
|
|
+ make_array(
|
|
|
|
+ make_document(kvp("inserttime",
|
|
|
|
+ make_document(kvp("$gte", tallplayscoreinfo.begintime)))),
|
|
|
|
+ make_document(kvp("inserttime",
|
|
|
|
+ make_document(kvp("$lt", tallplayscoreinfo.endtime)))))));
|
|
|
|
|
|
tempvect.allpagenum = m_pgameprizelog->count_documents(files_filter.view());
|
|
tempvect.allpagenum = m_pgameprizelog->count_documents(files_filter.view());
|
|
|
|
|