فهرست منبع

更新分数接口参数,改为account

qingjie 1 ماه پیش
والد
کامیت
fec60c7151
2فایلهای تغییر یافته به همراه7 افزوده شده و 7 حذف شده
  1. 4 4
      webapi/webapi/HttpSocket.cpp
  2. 3 3
      webapi/webapi/data.h

+ 4 - 4
webapi/webapi/HttpSocket.cpp

@@ -961,7 +961,7 @@ std::string HttpSocket::updateuserscore(std::map<std::string, std::string> getda
 
 
 	//用户不存在不减商家的分数
-	auto firstuser = m_pcoll->find_one(bsoncxx::builder::stream::document{} << "userid" << tuserscore.iuserid << bsoncxx::builder::stream::finalize);
+	auto firstuser = m_pcoll->find_one(bsoncxx::builder::stream::document{} << "account" << tuserscore.account.c_str() << bsoncxx::builder::stream::finalize);
 	if (!firstuser || firstuser->view()["spreaderid"])
 	{
 		strret = funclib::rettojson(11, "user is not exist");
@@ -1225,7 +1225,7 @@ std::string HttpSocket::updateuserscore(std::map<std::string, std::string> getda
 		}
 
 		//用户不存在不能下分
-		auto userretscore = m_pcoll->find_one(bsoncxx::builder::stream::document{} << "userid" << tuserscore.iuserid << bsoncxx::builder::stream::finalize);
+		auto userretscore = m_pcoll->find_one(bsoncxx::builder::stream::document{} << "account" << tuserscore.account.c_str() << bsoncxx::builder::stream::finalize);
 		if (!userretscore || !userretscore->view()["userid"])
 		{
 			strret = funclib::rettojson(Err_No_Player, "user isnot exist");
@@ -1234,7 +1234,7 @@ std::string HttpSocket::updateuserscore(std::map<std::string, std::string> getda
 
 
 		//玩家在玩游戏不能下分
-		auto vipuser = m_pplayuseronline->find_one(bsoncxx::builder::stream::document{} << "userid" << tuserscore.iuserid << bsoncxx::builder::stream::finalize);
+		auto vipuser = m_pplayuseronline->find_one(bsoncxx::builder::stream::document{} << "account" << tuserscore.account.c_str() << bsoncxx::builder::stream::finalize);
 		if (vipuser)
 		{
 			strret = funclib::rettojson(Err_Player_InGame, "user is playing");
@@ -1290,7 +1290,7 @@ std::string HttpSocket::updateuserscore(std::map<std::string, std::string> getda
 
 		//减用户分数
 		tuserscore.score = -1 * tuserscore.score;
-		auto usercriteria = make_document(kvp("userid", tuserscore.iuserid));
+		auto usercriteria = make_document(kvp("account", tuserscore.account.c_str()));
 		auto userupdate = make_document(kvp("$inc", make_document(kvp("score", tuserscore.score))));
 		auto tempscore = m_pcoll->find_one_and_update(usercriteria.view(), userupdate.view());
 		if (!tempscore)

+ 3 - 3
webapi/webapi/data.h

@@ -221,13 +221,13 @@ struct userscore
 {
 	std::string authcode{};
 	std::string authkey{};
-	std::int64_t iuserid{};			//鯤소瑯뵀
+	std::string account{};			//鯤소瑯뵀
 	std::int64_t score{0};			//鯤소롸鑒
 
 public:
 	std::string getfieldvalue(std::int32_t index)
 	{
-		const char* value[] = { "authcode", "authkey", "userid", "score"};
+		const char* value[] = { "authcode", "authkey", "account", "score"};
 		return value[index];
 	}
 
@@ -240,7 +240,7 @@ public:
 	bool datavalue()
 	{
 
-		if (authcode.empty() || authkey.empty() || iuserid < 0)
+		if (authcode.empty() || authkey.empty() || account.empty())
 		{
 			return false;
 		}