add mq log and add test type in test mod

This commit is contained in:
lnk
2025-05-28 16:09:15 +08:00
parent 8bc9f3c5e8
commit 59ea59f918
11 changed files with 327 additions and 123 deletions

View File

@@ -23,6 +23,8 @@
//lnk20241031用于上传和下载文件
#include "../json/cjson.h"
#include "../log4cplus/log4.h"//lnk添加log4
///////////////////////////////////////////////////lnk2024-10-21////////////////////////////////////////////////////////
extern void SendJsonAPI_web(const std::string& strUrl, const char* code, const std::string& json, char** ptr);
extern std::string WEB_INTEGRITY;
@@ -2518,6 +2520,9 @@ void Set_xml_databaseinfo(char* MODEL_ID, char* TMNL_TYPE, char* FILE_PATH, char
sprintf(save_name, "%s", Qsavename.toAscii().data());
cout << file_name << "!!!!!!!!!!!!!!!!!!!!!!!!!!" << save_name << endl;
//mq日志
DIY_WARNLOG("process","【WARN】前置获取到终端类型%s,该终端类型对应的映射文件为%s,映射文件将下载并保存在本地为%s",TMNL_TYPE,FILE_PATH,save_name);
//20241028 lnk 替换为文件下载web接口
//构造文件下载接口参数
//接口示例http://192.168.1.125:10215/file/download?filePath=/path/xxx.txt
@@ -2547,14 +2552,18 @@ void Set_xml_databaseinfo(char* MODEL_ID, char* TMNL_TYPE, char* FILE_PATH, char
outFile.write(fileContent, strlen(fileContent));
outFile.close();
std::cout << "File saved successfully!" << std::endl;
//mq日志
DIY_WARNLOG("process","【WARN】前置下载映射文件%s成功",save_name);
} else {
std::cerr << "Error: Unable to open file for writing." << std::endl;
DIY_ERRORLOG("process","【ERROR】前置写入本地映射文件%s失败",save_name);
}
// 释放分配的内存
free(fileContent);
} else {
std::cerr << "Error: Unable to download file." << std::endl;
DIY_ERRORLOG("process","【ERROR】前置调用文件下载接口下载远端文件文件%s失败",FILE_PATH);
}
}