Browse Source

修复由于reportToolslog本身上报失败,造成嵌套content内容过大的Bug;

scbc.sat2 5 năm trước cách đây
mục cha
commit
d34eb8b4dd
2 tập tin đã thay đổi với 6 bổ sung3 xóa
  1. 4 3
      TCL Copy Tool/TCL Copy Tool/OTA.cpp
  2. 2 0
      TCL Copy Tool/TCL Copy Tool/db.cpp

+ 4 - 3
TCL Copy Tool/TCL Copy Tool/OTA.cpp

@@ -1552,7 +1552,8 @@ BOOL COTA::HttpPost(std::string host, std::string context, std::string &result,
 		_stprintf_s(szMsg, _T("http(post) request failed, curl error code = %d\r"), nRecCode);
 		ShowMessage(szMsg);
 		LOG4C((LOG_NOTICE, "请求失败:%s, 错误码=%ld\n", context.c_str(), nRecCode));
-		Global::WriteReportLog(0, __FUNCTION__, "Request(post) Failure, Curl Error Code=%ld: host=%s, content=%s, result=%s", nRecCode, host.c_str(), context.c_str(), result.c_str());
+		if ( _tcsicmp("https://cn.ota.qhmoka.com/ota-services/report/reportToolsLog", host.c_str()) )
+			Global::WriteReportLog(0, __FUNCTION__, "Request(post) Failure, Curl Error Code=%ld: host=%s, content=%s, result=%s", nRecCode, host.c_str(), context.c_str(), result.c_str());
 	}
 
 	std::string api = host.substr(host.find_last_of('/') + 1);
@@ -2150,7 +2151,7 @@ BOOL COTA::ReportLog(std::string url, std::string content)
 	if (pJson == NULL)
 	{
 		LOG4C((LOG_WARN, "解析JSON失败:post=%s;return=%s", content.c_str(), result.c_str()));
-		Global::WriteReportLog(0, __FUNCTION__, "JSON Parsing Error: host=%s, content=%s, result=%s", url.c_str(), content.c_str(), result.c_str());
+		//Global::WriteReportLog(0, __FUNCTION__, "JSON Parsing Error: host=%s, content=%s, result=%s", url.c_str(), content.c_str(), result.c_str());
 
 		return FALSE;
 	}
@@ -2163,7 +2164,7 @@ BOOL COTA::ReportLog(std::string url, std::string content)
 		return TRUE;
 	}
 
-	Global::WriteReportLog(0, __FUNCTION__, "http Code is not equal to 1000: host=%s, content=%s, result=%s", url.c_str(), content.c_str(), result.c_str());
+	//Global::WriteReportLog(0, __FUNCTION__, "http Code is not equal to 1000: host=%s, content=%s, result=%s", url.c_str(), content.c_str(), result.c_str());
 
 	return FALSE;
 }

+ 2 - 0
TCL Copy Tool/TCL Copy Tool/db.cpp

@@ -326,6 +326,8 @@ INT CDataImpl::RemoveReportInfo()
 	std::string strSql = "delete from report where report_date <> '' and report_date < '";
 	strSql.append(ct.Format("%Y-%m-%d %H:%M:%S").GetString());
 	strSql.append("';");
+	// ɾ³ýǶÌ×µÄcontentÊý¾Ý;
+	strSql.append("delete from report where length(content) > 8192 and url = 'https://cn.ota.qhmoka.com/ota-services/report/reportToolsLog';");
 	int sqlite_error = sqlite3_exec(m_psqlite3, strSql.c_str(),0, 0, &psqlite_error);
 	if (sqlite_error != SQLITE_OK)
 	{