log add rpt control and log control

This commit is contained in:
lnk
2025-08-19 20:56:35 +08:00
parent 2134a43e31
commit 78f95f2c96
2 changed files with 68 additions and 14 deletions

View File

@@ -2703,6 +2703,24 @@ void Set_xml_databaseinfo(char* MODEL_ID, char* TMNL_TYPE, char* FILE_PATH, char
if (fileContent != NULL) {
// 创建并打开文件
//判断返回的是不是错误json响应
bool isErrorJson = false;
cJSON* root = cJSON_Parse(fileContent);
if (root != NULL) {
cJSON* codeItem = cJSON_GetObjectItem(root, "code");
cJSON* dataItem = cJSON_GetObjectItem(root, "data");
if (codeItem && codeItem->valuestring &&
strcmp(codeItem->valuestring, "A00555") == 0 &&
(dataItem == NULL || (dataItem->type == cJSON_NULL))) {
isErrorJson = true;
std::cerr << "Error: Server returned empty file stream, code=A00555." << std::endl;
DIY_ERRORLOG_CODE("process", LOG_CODE_ICD_AND_DOWNLOAD,
"【ERROR】前置下载文件失败服务端返回A00555(文件流为空),文件=%s",
save_name);
}
cJSON_Delete(root);
}
//测试
//std::ofstream outFile(downpath, std::ios::binary);//二进制的方式打开