Ver Fonte

Merge branch 'master' of http://110.40.64.236:3000/qingjie/webapi333

qingjie há 2 meses atrás
pai
commit
c966b9440b
2 ficheiros alterados com 12 adições e 11 exclusões
  1. 11 10
      webapi/webapi/HttpSocket.cpp
  2. 1 1
      webapi/webapi/HttpSocket.h

+ 11 - 10
webapi/webapi/HttpSocket.cpp

@@ -97,10 +97,11 @@ void HttpSocket::stopmsg()
 
 void HttpSocket::init()
 {
-
+	staticdata tstaticdata;
 	try
 	{
-		makegamelist(m_staticdata);
+		makegamelist(tstaticdata);
+		m_updatestatic("staticdata", tstaticdata);
 	}
 	catch (const std::exception&)
 	{
@@ -220,6 +221,13 @@ bool HttpSocket::postmsg(std::function<void(std::string&)> funhttpmsg, std::map<
 	return true;
 }
 
+void HttpSocket::updatemsg(std::string strtype, boost::any getdata)
+{
+	if (strtype == "staticdata")
+	{
+		m_staticdata = boost::any_cast<staticdata>(getdata);
+	}
+}
 
 void HttpSocket::makegamelist(staticdata& tstaticdata)
 {
@@ -2213,14 +2221,7 @@ std::string HttpSocket::playgameinfo(std::map<std::string, std::string> getdata)
 		{
 			itemp64 = tempinfo["inserttime"].get_int64();
 		}
-		
-		std::string inserttime{};
-		if (itemp64 >= 0)
-		{
-			inserttime = funclib::gettimefromstamp(itemp64);
-		}
-
-		gameinfodoc.AddMember("inserttime", rapidjson::Value(inserttime.c_str(), gallocator), gallocator);
+		gameinfodoc.AddMember("inserttime", itemp64, gallocator);
 
 		rapidjson::Value element(rapidjson::kObjectType);
 		element.CopyFrom(gameinfodoc, allocator);

+ 1 - 1
webapi/webapi/HttpSocket.h

@@ -84,7 +84,7 @@ public:
 	void makegamelist(staticdata& tstaticdata);
 	void init();
 	bool postmsg(std::function<void(std::string&)> funhttpmsg, std::map<std::string, std::string> getdata);
-	void updatemsg(std::string strtype, boost::any getdata) {};
+	void updatemsg(std::string strtype, boost::any getdata);
 
 protected:
 	//»ñµÃÓÎÏ·Áбí