mirror of
https://gitee.com/js-yhsec/energy_storage.git
synced 2026-05-28 03:09:24 +08:00
实现HTTP服务架构
This commit is contained in:
@@ -96,9 +96,10 @@ string Fields::toStr()
|
||||
string s;
|
||||
for (auto it = mapFields.begin(); it != mapFields.end(); it++)
|
||||
{
|
||||
s += ("{" + it->first + ":" + it->second + "} ");
|
||||
if (!s.empty()) s += ",";
|
||||
s += ("\"" + it->first + "\":\"" + it->second + "\"");
|
||||
}
|
||||
return s;
|
||||
return "{" + s + "}";
|
||||
}
|
||||
|
||||
string Fields::toSqlInsert(string tableName)
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#include <nlohmann/json.hpp>
|
||||
#pragma once
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <fstream>
|
||||
#include <memory>
|
||||
#include <iostream>
|
||||
@@ -68,7 +70,7 @@ public:
|
||||
}
|
||||
catch (nlohmann::json::parse_error& e)
|
||||
{
|
||||
std::cout << "JSON parse error: " << e.what() << std::endl;
|
||||
std::cout << "JSON parse error: " << e.what() << "\n" << jsonstr << std::endl;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user