|
@@ -133,14 +133,14 @@ bool FromWebAPI::getDeviceInfo(QMap<QString, DeviceInfo>& mapDevice)
|
|
|
|
|
|
try
|
|
|
{
|
|
|
- nJson json1 = nJson::parse(strRet.toStdString());
|
|
|
- int retCode = json1["code"].get<int>();
|
|
|
+ nJson lowerKeyJson = convertJsonKeyToLower(nJson::parse(strRet.toStdString()));
|
|
|
+ int retCode = lowerKeyJson["code"].get<int>();
|
|
|
if(retCode != 0)
|
|
|
{
|
|
|
LH_WRITE_ERROR("获取设备数据失败");
|
|
|
return false;
|
|
|
}
|
|
|
- nJson result = json1["result"];
|
|
|
+ nJson result = lowerKeyJson["result"];
|
|
|
for(auto& it : result)
|
|
|
{
|
|
|
DeviceInfo DevInfo;
|
|
@@ -229,14 +229,14 @@ bool FromWebAPI::getChannelInfo(QMap<int, ChannelInfo>& mapFreq)
|
|
|
|
|
|
try
|
|
|
{
|
|
|
- nJson json1 = nJson::parse(strRet.toStdString());
|
|
|
- int retCode = json1["code"].get<int>();
|
|
|
+ nJson lowerKeyJson = convertJsonKeyToLower(nJson::parse(strRet.toStdString()));
|
|
|
+ int retCode = lowerKeyJson["code"].get<int>();
|
|
|
if(retCode != 0)
|
|
|
{
|
|
|
LH_WRITE_ERROR("获取频率数据失败");
|
|
|
return false;
|
|
|
}
|
|
|
- nJson result = json1["result"];
|
|
|
+ nJson result = lowerKeyJson["result"];
|
|
|
for(auto& it : result)
|
|
|
{
|
|
|
ChannelInfo freqInfo;
|
|
@@ -390,25 +390,25 @@ bool FromWebAPI::getExecPlanData(int chnID, QList<OnePlanItemInfo>& list)
|
|
|
// SPDLOG_LOGGER_DEBUG(m_logger,"获取执行计划:\n{}",strRet.toStdString());
|
|
|
try
|
|
|
{
|
|
|
- nJson json2 = nJson::parse(strRet.toStdString());
|
|
|
- int retCode = json2["code"].get<int>();
|
|
|
+ nJson lowerKeyJson = convertJsonKeyToLower(nJson::parse(strRet.toStdString()));
|
|
|
+ int retCode = lowerKeyJson["code"].get<int>();
|
|
|
if(retCode != 0)
|
|
|
{
|
|
|
LH_WRITE_ERROR("获取tExecPlan表格数据失败");
|
|
|
return false;
|
|
|
}
|
|
|
- nJson result = json2["result"];
|
|
|
+ nJson result = lowerKeyJson["result"];
|
|
|
for(auto& it : result)
|
|
|
{
|
|
|
OnePlanItemInfo info;
|
|
|
info.ChannelID = chnID;
|
|
|
info.ChannelName = QString::fromStdString(it["channelName"].get<std::string>());
|
|
|
- info.onWeekDay = static_cast<enum_WeekDay>(it["onWeekDay"].get<int>());
|
|
|
- info.onDateTime.setDate(QDate::fromString(QString::fromStdString(it["onDate"].get<std::string>()), "yyyy-MM-dd"));
|
|
|
- info.onDateTime.setTime(QTime::fromString(QString::fromStdString(it["onTime"].get<std::string>()), "hh:mm:ss"));
|
|
|
- info.offWeekDay = static_cast<enum_WeekDay>(it["offWeekDay"].get<int>());
|
|
|
- info.offDateTime.setDate(QDate::fromString(QString::fromStdString(it["offDate"].get<std::string>()), "yyyy-MM-dd"));
|
|
|
- info.offDateTime.setTime(QTime::fromString(QString::fromStdString(it["offTime"].get<std::string>()), "hh:mm:ss"));
|
|
|
+ info.onWeekDay = static_cast<enum_WeekDay>(it["onWeekday"].get<int>());
|
|
|
+ info.onDateTime.setDate(QDate::fromString(QString::fromStdString(it["ondate"].get<std::string>()), "yyyy-MM-dd"));
|
|
|
+ info.onDateTime.setTime(QTime::fromString(QString::fromStdString(it["ontime"].get<std::string>()), "hh:mm:ss"));
|
|
|
+ info.offWeekDay = static_cast<enum_WeekDay>(it["offWeekday"].get<int>());
|
|
|
+ info.offDateTime.setDate(QDate::fromString(QString::fromStdString(it["offdate"].get<std::string>()), "yyyy-MM-dd"));
|
|
|
+ info.offDateTime.setTime(QTime::fromString(QString::fromStdString(it["offtime"].get<std::string>()), "hh:mm:ss"));
|
|
|
|
|
|
list.append(info);
|
|
|
}
|
|
@@ -458,25 +458,25 @@ bool FromWebAPI::getExecPlanData(QMap<int, QList<OnePlanItemInfo>>& mapPlan)
|
|
|
// SPDLOG_LOGGER_DEBUG(m_logger,"获取执行计划:\n{}",strRet.toStdString());
|
|
|
try
|
|
|
{
|
|
|
- nJson json2 = nJson::parse(strRet.toStdString());
|
|
|
- int retCode = json2["code"].get<int>();
|
|
|
+ nJson lowerKeyJson = convertJsonKeyToLower(nJson::parse(strRet.toStdString()));
|
|
|
+ int retCode = lowerKeyJson["code"].get<int>();
|
|
|
if(retCode != 0)
|
|
|
{
|
|
|
LH_WRITE_ERROR("获取tExecPlan表格数据失败");
|
|
|
return false;
|
|
|
}
|
|
|
- nJson result = json2["result"];
|
|
|
+ nJson result = lowerKeyJson["result"];
|
|
|
for(auto& it : result)
|
|
|
{
|
|
|
OnePlanItemInfo info;
|
|
|
- info.ChannelID = it["channelID"].is_null() ? -1 : it["channelID"].get<int>();
|
|
|
- info.ChannelName = QString::fromStdString(it["channelName"].get<std::string>());
|
|
|
- info.onWeekDay = static_cast<enum_WeekDay>(it["onWeekDay"].get<int>());
|
|
|
- info.onDateTime.setDate(QDate::fromString(QString::fromStdString(it["onDate"].get<std::string>()), "yyyy-MM-dd"));
|
|
|
- info.onDateTime.setTime(QTime::fromString(QString::fromStdString(it["onTime"].get<std::string>()), "hh:mm:ss"));
|
|
|
- info.offWeekDay = static_cast<enum_WeekDay>(it["offWeekDay"].get<int>());
|
|
|
- info.offDateTime.setDate(QDate::fromString(QString::fromStdString(it["offDate"].get<std::string>()), "yyyy-MM-dd"));
|
|
|
- info.offDateTime.setTime(QTime::fromString(QString::fromStdString(it["offTime"].get<std::string>()), "hh:mm:ss"));
|
|
|
+ info.ChannelID = it["channelid"].is_null() ? -1 : it["channelid"].get<int>();
|
|
|
+ info.ChannelName = QString::fromStdString(it["channelname"].get<std::string>());
|
|
|
+ info.onWeekDay = static_cast<enum_WeekDay>(it["onweekday"].get<int>());
|
|
|
+ info.onDateTime.setDate(QDate::fromString(QString::fromStdString(it["ondate"].get<std::string>()), "yyyy-MM-dd"));
|
|
|
+ info.onDateTime.setTime(QTime::fromString(QString::fromStdString(it["ontime"].get<std::string>()), "hh:mm:ss"));
|
|
|
+ info.offWeekDay = static_cast<enum_WeekDay>(it["offweekday"].get<int>());
|
|
|
+ info.offDateTime.setDate(QDate::fromString(QString::fromStdString(it["offdate"].get<std::string>()), "yyyy-MM-dd"));
|
|
|
+ info.offDateTime.setTime(QTime::fromString(QString::fromStdString(it["offtime"].get<std::string>()), "hh:mm:ss"));
|
|
|
|
|
|
/* 查找对应的设备列表 */
|
|
|
auto list = mapPlan.find(info.ChannelID);
|
|
@@ -698,23 +698,24 @@ bool FromWebAPI::getConfigData(QMap<int, ConfigData>& list)
|
|
|
return false;
|
|
|
}
|
|
|
/* 解析获取到的JSON数据 */
|
|
|
- // LH_WRITE_LOG_DEBUG(QString("Ret:%1").arg(ret));
|
|
|
- // LH_WRITE_LOG_DEBUG(strRet);
|
|
|
+
|
|
|
try{
|
|
|
- nJson json1 = nJson::parse(strRet.toStdString());
|
|
|
- int retCode = json1["code"].get<int>();
|
|
|
+ nJson lowerKeyJson = convertJsonKeyToLower(nJson::parse(strRet.toStdString()));
|
|
|
+ // LH_WRITE_LOG_DEBUG(QString::fromStdString(lowerKeyJson.dump(4)));
|
|
|
+
|
|
|
+ int retCode = lowerKeyJson["code"].get<int>();
|
|
|
if(retCode != 0)
|
|
|
{
|
|
|
LH_WRITE_ERROR("获取tExecPlanConfig失败");
|
|
|
return false;
|
|
|
}
|
|
|
- nJson result = json1["result"];
|
|
|
+ nJson result = lowerKeyJson["result"];
|
|
|
for(auto& it : result)
|
|
|
{
|
|
|
ConfigData data;
|
|
|
- data.key = it["keyWord"].get<int>();
|
|
|
+ data.key = it["keyword"].get<int>();
|
|
|
data.value = it["value1"].get<int>();
|
|
|
- data.updateTime = QDateTime::fromString(QString::fromStdString(it["updateTime"].get<std::string>()),"yyyy-MM-dd hh:mm:ss");
|
|
|
+ data.updateTime = QDateTime::fromString(QString::fromStdString(it["updatetime"].get<std::string>()),"yyyy-MM-dd hh:mm:ss");
|
|
|
data.notes = QString::fromStdString(it["notes"].get<std::string>());
|
|
|
list.insert(data.key, data);
|
|
|
}
|
|
@@ -764,24 +765,24 @@ bool FromWebAPI::getConfigData(int key, ConfigData& data)
|
|
|
/* 解析获取到的JSON数据 */
|
|
|
LH_WRITE_LOG_DEBUG(strRet);
|
|
|
try{
|
|
|
- nJson json1 = nJson::parse(strRet.toStdString());
|
|
|
- int retCode = json1["code"].get<int>();
|
|
|
+ nJson lowerKeyJson = convertJsonKeyToLower(nJson::parse(strRet.toStdString()));
|
|
|
+ int retCode = lowerKeyJson["code"].get<int>();
|
|
|
if(retCode != 0)
|
|
|
{
|
|
|
LH_WRITE_ERROR("获取tExecPlanConfig失败");
|
|
|
return false;
|
|
|
}
|
|
|
- nJson result = json1["result"];
|
|
|
+ nJson result = lowerKeyJson["result"];
|
|
|
for(auto& it : result)
|
|
|
{
|
|
|
- data.key = it["keyWord"].get<int>();
|
|
|
+ data.key = it["keyword"].get<int>();
|
|
|
if(data.key != key)
|
|
|
{
|
|
|
LH_WRITE_ERROR("获取到的数据和传入的关键字不匹配");
|
|
|
continue;
|
|
|
}
|
|
|
data.value = it["value1"].get<int>();
|
|
|
- data.updateTime = QDateTime::fromString(QString::fromStdString(it["updateTime"].get<std::string>()),"yyyy-MM-dd hh:mm:ss");
|
|
|
+ data.updateTime = QDateTime::fromString(QString::fromStdString(it["updatetime"].get<std::string>()),"yyyy-MM-dd hh:mm:ss");
|
|
|
data.notes = QString::fromStdString(it["notes"].get<std::string>());
|
|
|
break;
|
|
|
}
|
|
@@ -832,14 +833,14 @@ bool FromWebAPI::getEQMTemplateID(QList<int>& listId)
|
|
|
LH_WRITE_LOG_DEBUG(strRet);
|
|
|
try
|
|
|
{
|
|
|
- nJson json1 = nJson::parse(strRet.toStdString());
|
|
|
- int retCode = json1["code"].get<int>();
|
|
|
+ nJson lowerKeyJson = convertJsonKeyToLower(nJson::parse(strRet.toStdString()));
|
|
|
+ int retCode = lowerKeyJson["code"].get<int>();
|
|
|
if(retCode != 0)
|
|
|
{
|
|
|
LH_WRITE_ERROR("获取模版编号失败");
|
|
|
return false;
|
|
|
}
|
|
|
- nJson result = json1["result"];
|
|
|
+ nJson result = lowerKeyJson["result"];
|
|
|
for(auto& it : result)
|
|
|
{
|
|
|
if(it["templateNum"].is_null())
|
|
@@ -847,7 +848,7 @@ bool FromWebAPI::getEQMTemplateID(QList<int>& listId)
|
|
|
LH_WRITE_ERROR("模版编号为空");
|
|
|
continue;
|
|
|
}
|
|
|
- auto id = it["templateNum"].get<int>();
|
|
|
+ auto id = it["templatenum"].get<int>();
|
|
|
if(listId.contains(id))
|
|
|
{
|
|
|
continue;
|
|
@@ -1008,26 +1009,26 @@ bool FromWebAPI::getOneTemplateData(OneTemplateInfo tmpInfo, QList<OnePlanItemIn
|
|
|
/* 解析获取到的JSON数据 */
|
|
|
try
|
|
|
{
|
|
|
- nJson json2 = nJson::parse(strRet.toStdString());
|
|
|
- int retCode = json2["code"].get<int>();
|
|
|
+ nJson lowerKeyJson = convertJsonKeyToLower(nJson::parse(strRet.toStdString()));
|
|
|
+ int retCode = lowerKeyJson["code"].get<int>();
|
|
|
if(retCode != 0)
|
|
|
{
|
|
|
LH_WRITE_ERROR("获取模板失败");
|
|
|
return false;
|
|
|
}
|
|
|
- nJson result = json2["result"];
|
|
|
+ nJson result = lowerKeyJson["result"];
|
|
|
for(auto& it : result)
|
|
|
{
|
|
|
OnePlanItemInfo info;
|
|
|
|
|
|
- info.ChannelID = it["channelID"].is_null() ? -1 : it["channelID"].get<int>();
|
|
|
- info.ChannelName = QString::fromStdString(it["channelName"].get<std::string>());
|
|
|
- info.onWeekDay = static_cast<enum_WeekDay>(it["onWeekDay"].get<int>());
|
|
|
- info.onDateTime.setDate(QDate::fromString(QString::fromStdString(it["onDate"].get<std::string>()), "yyyy-MM-dd"));
|
|
|
- info.onDateTime.setTime(QTime::fromString(QString::fromStdString(it["onTime"].get<std::string>()), "hh:mm:ss"));
|
|
|
- info.offWeekDay = static_cast<enum_WeekDay>(it["offWeekDay"].get<int>());
|
|
|
- info.offDateTime.setDate(QDate::fromString(QString::fromStdString(it["offDate"].get<std::string>()), "yyyy-MM-dd"));
|
|
|
- info.offDateTime.setTime(QTime::fromString(QString::fromStdString(it["offTime"].get<std::string>()), "hh:mm:ss"));
|
|
|
+ info.ChannelID = it["channelid"].is_null() ? -1 : it["channelid"].get<int>();
|
|
|
+ info.ChannelName = QString::fromStdString(it["channelname"].get<std::string>());
|
|
|
+ info.onWeekDay = static_cast<enum_WeekDay>(it["onweekday"].get<int>());
|
|
|
+ info.onDateTime.setDate(QDate::fromString(QString::fromStdString(it["ondate"].get<std::string>()), "yyyy-MM-dd"));
|
|
|
+ info.onDateTime.setTime(QTime::fromString(QString::fromStdString(it["ontime"].get<std::string>()), "hh:mm:ss"));
|
|
|
+ info.offWeekDay = static_cast<enum_WeekDay>(it["offweekday"].get<int>());
|
|
|
+ info.offDateTime.setDate(QDate::fromString(QString::fromStdString(it["offdate"].get<std::string>()), "yyyy-MM-dd"));
|
|
|
+ info.offDateTime.setTime(QTime::fromString(QString::fromStdString(it["offtime"].get<std::string>()), "hh:mm:ss"));
|
|
|
|
|
|
list.append(info);
|
|
|
}
|
|
@@ -1091,17 +1092,17 @@ bool FromWebAPI::getTemplateData(QList<OneTemplateInfo>& listTemplate, QMap<int,
|
|
|
/* 解析获取到的JSON数据 */
|
|
|
try
|
|
|
{
|
|
|
- nJson jsonRet = nJson::parse(strRet.toStdString());
|
|
|
+ nJson lowerKeyJson = convertJsonKeyToLower(nJson::parse(strRet.toStdString()));
|
|
|
|
|
|
// LH_WRITE_LOG_DEBUG(QString("\n: %1").arg(QString::fromStdString(jsonRet.dump(4))));
|
|
|
|
|
|
- int retCode = jsonRet["code"].get<int>();
|
|
|
+ int retCode = lowerKeyJson["code"].get<int>();
|
|
|
if(retCode != 0)
|
|
|
{
|
|
|
LH_WRITE_ERROR("获取模板数据失败");
|
|
|
return false;
|
|
|
}
|
|
|
- nJson data = jsonRet["data"];
|
|
|
+ nJson data = lowerKeyJson["data"];
|
|
|
for(auto& it : data)
|
|
|
{
|
|
|
/* 逐步获取对应频率的计划信息 */
|
|
@@ -1130,14 +1131,14 @@ bool FromWebAPI::getTemplateData(QList<OneTemplateInfo>& listTemplate, QMap<int,
|
|
|
|
|
|
OnePlanItemInfo info;
|
|
|
|
|
|
- info.ChannelID = plan["channelID"].is_null() ? -1 : plan["channelID"].get<int>();
|
|
|
- info.ChannelName = plan["channelName"].is_null() ? "" : QString::fromStdString(plan["channelName"].get<std::string>());
|
|
|
- info.onWeekDay = static_cast<enum_WeekDay>(plan["onWeekDay"].get<int>());
|
|
|
- info.onDateTime.setDate(QDate::fromString(QString::fromStdString(plan["onDate"].get<std::string>()), "yyyy-MM-dd"));
|
|
|
- info.onDateTime.setTime(QTime::fromString(QString::fromStdString(plan["onTime"].get<std::string>()), "hh:mm:ss"));
|
|
|
- info.offWeekDay = static_cast<enum_WeekDay>(plan["offWeekDay"].get<int>());
|
|
|
- info.offDateTime.setDate(QDate::fromString(QString::fromStdString(plan["offDate"].get<std::string>()), "yyyy-MM-dd"));
|
|
|
- info.offDateTime.setTime(QTime::fromString(QString::fromStdString(plan["offTime"].get<std::string>()), "hh:mm:ss"));
|
|
|
+ info.ChannelID = plan["channelid"].is_null() ? -1 : plan["channelid"].get<int>();
|
|
|
+ info.ChannelName = plan["channelname"].is_null() ? "" : QString::fromStdString(plan["channelname"].get<std::string>());
|
|
|
+ info.onWeekDay = static_cast<enum_WeekDay>(plan["onweekday"].get<int>());
|
|
|
+ info.onDateTime.setDate(QDate::fromString(QString::fromStdString(plan["ondate"].get<std::string>()), "yyyy-MM-dd"));
|
|
|
+ info.onDateTime.setTime(QTime::fromString(QString::fromStdString(plan["ontime"].get<std::string>()), "hh:mm:ss"));
|
|
|
+ info.offWeekDay = static_cast<enum_WeekDay>(plan["offweekday"].get<int>());
|
|
|
+ info.offDateTime.setDate(QDate::fromString(QString::fromStdString(plan["offdate"].get<std::string>()), "yyyy-MM-dd"));
|
|
|
+ info.offDateTime.setTime(QTime::fromString(QString::fromStdString(plan["offtime"].get<std::string>()), "hh:mm:ss"));
|
|
|
|
|
|
listPlan.append(info);
|
|
|
}
|
|
@@ -1189,19 +1190,19 @@ bool FromWebAPI::getTemplateList(QMultiMap<int, OneTemplateInfo>& mapTemplate)
|
|
|
// LH_WRITE_LOG_DEBUG(strRet);
|
|
|
try
|
|
|
{
|
|
|
- nJson json1 = nJson::parse(strRet.toStdString());
|
|
|
- int retCode = json1["code"].get<int>();
|
|
|
+ nJson lowerKeyJson = convertJsonKeyToLower(nJson::parse(strRet.toStdString()));
|
|
|
+ int retCode = lowerKeyJson["code"].get<int>();
|
|
|
if(retCode != 0)
|
|
|
{
|
|
|
LH_WRITE_ERROR("获取模板列表失败");
|
|
|
return false;
|
|
|
}
|
|
|
- nJson result = json1["result"];
|
|
|
+ nJson result = lowerKeyJson["result"];
|
|
|
for(auto& it : result)
|
|
|
{
|
|
|
OneTemplateInfo info;
|
|
|
- info.channelInfo.ChannelID = it["channelID"].get<int>();
|
|
|
- info.templateName = QString::fromStdString(it["templateName"].get<std::string>());
|
|
|
+ info.channelInfo.ChannelID = it["channelid"].get<int>();
|
|
|
+ info.templateName = QString::fromStdString(it["templatename"].get<std::string>());
|
|
|
mapTemplate.insert(info.channelInfo.ChannelID, info);
|
|
|
}
|
|
|
|
|
@@ -1256,19 +1257,19 @@ bool FromWebAPI::getTemplateList(int chnID, QList<OneTemplateInfo>& listTemplate
|
|
|
// LH_WRITE_LOG_DEBUG(strRet);
|
|
|
try
|
|
|
{
|
|
|
- nJson json1 = nJson::parse(strRet.toStdString());
|
|
|
- int retCode = json1["code"].get<int>();
|
|
|
+ nJson lowerKeyJson = convertJsonKeyToLower(nJson::parse(strRet.toStdString()));
|
|
|
+ int retCode = lowerKeyJson["code"].get<int>();
|
|
|
if(retCode != 0)
|
|
|
{
|
|
|
LH_WRITE_ERROR("获取模板列表失败");
|
|
|
return false;
|
|
|
}
|
|
|
- nJson result = json1["result"];
|
|
|
+ nJson result = lowerKeyJson["result"];
|
|
|
for(auto& it : result)
|
|
|
{
|
|
|
OneTemplateInfo info;
|
|
|
- info.channelInfo.ChannelID = it["channelID"].get<int>();
|
|
|
- info.templateName = QString::fromStdString(it["templateName"].get<std::string>());
|
|
|
+ info.channelInfo.ChannelID = it["channelid"].get<int>();
|
|
|
+ info.templateName = QString::fromStdString(it["templatename"].get<std::string>());
|
|
|
listTemplate.append(info);
|
|
|
}
|
|
|
|
|
@@ -1441,3 +1442,58 @@ bool FromWebAPI::updateTemplateName(const QMap<OneTemplateInfo, QString>& mapTem
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+/* 将json的key转换成小写 */
|
|
|
+nJson FromWebAPI::convertJsonKeyToLower(const nJson& json)
|
|
|
+{
|
|
|
+ nJson result;
|
|
|
+ for(auto& it : json.items())
|
|
|
+ {
|
|
|
+ std::string key = it.key();
|
|
|
+ std::transform(key.begin(), key.end(), key.begin(), ::tolower); // 转换成小写
|
|
|
+ /* 是object */
|
|
|
+ if(it.value().is_object())
|
|
|
+ {
|
|
|
+ result[key] = convertJsonKeyToLower(it.value()); // 递归处理嵌套的对象
|
|
|
+ }
|
|
|
+ /* 是array */
|
|
|
+ else if(it.value().is_array())
|
|
|
+ {
|
|
|
+ nJson arrayResult = nJson::array();
|
|
|
+ for(auto& item : it.value())
|
|
|
+ {
|
|
|
+ if(item.is_object())
|
|
|
+ {
|
|
|
+ arrayResult.push_back(convertJsonKeyToLower(item));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ arrayResult.push_back(item);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ result[key] = arrayResult;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ /* 直接赋值非对象和非数组类型 */
|
|
|
+ result[key] = it.value();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return result;
|
|
|
+}
|
|
|
+
|
|
|
+// #include <regex>
|
|
|
+// #include <string>
|
|
|
+// #include <algorithm>
|
|
|
+// std::string FromWebAPI::convertJsonKeyToLower(const std::string& str)
|
|
|
+// {
|
|
|
+// std::regex reg(R"(\"([a-zA-Z0-9_]+)\":)");
|
|
|
+// std::string strStd = str;
|
|
|
+// std::string result = std::regex_replace(strStd, reg, [](const std::smatch& match) {
|
|
|
+// std::string key = match[1].str();
|
|
|
+// std::transform(key.begin(), key.end(), key.begin(), ::tolower); // 转换成小写
|
|
|
+// return "\"" + key + "\":";
|
|
|
+// });
|
|
|
+// return result;
|
|
|
+// }
|
|
|
+
|