|
@@ -234,6 +234,73 @@ INT CDataImpl::InsertReportInfo(std::string url, std::string content, bool repor
|
|
|
return sqlite_error;
|
|
|
}
|
|
|
|
|
|
+INT CDataImpl::InsertReportInfo(std::string content)
|
|
|
+{
|
|
|
+ if (m_psqlite3 == NULL)
|
|
|
+ return -1;
|
|
|
+
|
|
|
+ std::string strInsert = "INSERT INTO report(url, content)VALUES ('";
|
|
|
+ strInsert.append("'https://cn.ota.qhmoka.com/ota-services/upmp/reportToolsLog.do'");
|
|
|
+ strInsert.append("','");
|
|
|
+ strInsert.append(content);
|
|
|
+ strInsert.append("');");
|
|
|
+ char* psqlite_error = NULL;
|
|
|
+ int sqlite_error = sqlite3_exec(m_psqlite3, strInsert.c_str(), NULL, 0, &psqlite_error);
|
|
|
+ if (SQLITE_OK != sqlite_error)
|
|
|
+ {
|
|
|
+ //Global::WriteTextLog(_T("InsertContactsType:%s"), psqlite_error);
|
|
|
+ FREE_MSG;
|
|
|
+ }
|
|
|
+
|
|
|
+ return sqlite_error;
|
|
|
+}
|
|
|
+
|
|
|
+INT CDataImpl::InsertReportInfo(std::string report_type, std::map<std::string, std::string> report_data)
|
|
|
+{
|
|
|
+ if (m_psqlite3 == NULL)
|
|
|
+ return -1;
|
|
|
+
|
|
|
+ // JsonÊý¾Ý;
|
|
|
+ std::string content;
|
|
|
+ cJSON* pJson = cJSON_CreateObject();
|
|
|
+ if (!pJson)
|
|
|
+ return -1;
|
|
|
+ cJSON_AddStringToObject(pJson, "reportType", report_type.c_str());
|
|
|
+
|
|
|
+ cJSON* pObj = cJSON_AddObjectToObject(pJson, _T("reportData"));
|
|
|
+ for (auto it : report_data)
|
|
|
+ {
|
|
|
+ cJSON_AddStringToObject(pObj, it.first.c_str(), it.second.c_str());
|
|
|
+ }
|
|
|
+
|
|
|
+ char* pJsonText = cJSON_Print(pJson);
|
|
|
+ if (!pJsonText)
|
|
|
+ {
|
|
|
+ cJSON_Delete(pJson);
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+
|
|
|
+ content = pJsonText;
|
|
|
+ if (pJsonText)
|
|
|
+ free(pJsonText);
|
|
|
+ cJSON_Delete(pJson);
|
|
|
+
|
|
|
+ std::string strInsert = "INSERT INTO report(url, content)VALUES ('";
|
|
|
+ strInsert.append("'https://cn.ota.qhmoka.com/ota-services/upmp/reportToolsLog.do'");
|
|
|
+ strInsert.append("','");
|
|
|
+ strInsert.append(content);
|
|
|
+ strInsert.append("');");
|
|
|
+ char* psqlite_error = NULL;
|
|
|
+ int sqlite_error = sqlite3_exec(m_psqlite3, strInsert.c_str(), NULL, 0, &psqlite_error);
|
|
|
+ if (SQLITE_OK != sqlite_error)
|
|
|
+ {
|
|
|
+ //Global::WriteTextLog(_T("InsertContactsType:%s"), psqlite_error);
|
|
|
+ FREE_MSG;
|
|
|
+ }
|
|
|
+
|
|
|
+ return sqlite_error;
|
|
|
+}
|
|
|
+
|
|
|
INT CDataImpl::RemoveReportInfo()
|
|
|
{
|
|
|
if (m_psqlite3 == NULL)
|