Selaa lähdekoodia

下载脚本失败时的日志打印;

scbc.sat2 5 vuotta sitten
vanhempi
commit
54b752813c
1 muutettua tiedostoa jossa 12 lisäystä ja 8 poistoa
  1. 12 8
      SATHTTP/SATHTTP/SATHTTP.cpp

+ 12 - 8
SATHTTP/SATHTTP/SATHTTP.cpp

@@ -139,7 +139,6 @@ SATHTTP_API int Login(std::string url, const SATHTTP::STLoginReq &stLoginReq, SA
 	{
 		// 添加到根结点中;
 		cJSON_AddItemToObject(pRoot, "data", pData);
-
 		cJSON_AddStringToObject(pData, "userName", stLoginReq.strUserName.c_str());
 		cJSON_AddStringToObject(pData, "status", stLoginReq.strStatus.c_str());
 		cJSON_AddStringToObject(pData, "deleteStatus", stLoginReq.strDeleteStatus.c_str());
@@ -913,7 +912,6 @@ SATHTTP_API int DownloadScript(std::string url, std::string strCaseId, std::stri
 
 		if ( curlCode == CURLE_OK ) {
 			reponse = CharEncoding::DeCode_URLUTF8(reponse.c_str());
-
 			// 解析返回值;
 			pRoot = cJSON_Parse(reponse.c_str());
 			if (pRoot != NULL) {
@@ -943,12 +941,8 @@ SATHTTP_API int DownloadScript(std::string url, std::string strCaseId, std::stri
 										strSaveDir.append(strFileName);
 										// 创建目录;
 										if ( MKDIR(strSaveDir.c_str()) ) {
-											// 同时下载脚本目录到指定目录中;
-#ifdef _DEBUG
-											OutputDebugString((stScriptUrlResp.strURL+"\n").c_str());
-#endif
-											// url地址可能包含中文,此处需要转码;
-											stScriptUrlResp.strURL = CCurlClient::ParseURLAndEncode(stScriptUrlResp.strURL);
+											// 同时下载脚本目录到指定目录中;// url地址可能包含中文,此处需要转码;
+											stScriptUrlResp.strURL = CCurlClient::ParseURLAndEncode(stScriptUrlResp.strURL);											
 											if ( g_curl.Download(stScriptUrlResp.strURL, strSaveDir, 20000) ) {
 												stScriptUrlResp._strFileName = strFileName.substr(0, strFileName.find_first_of('.'));
 												stScriptUrlResp._strScripFile = strSaveDir;
@@ -957,12 +951,22 @@ SATHTTP_API int DownloadScript(std::string url, std::string strCaseId, std::stri
 												// 返回结果;
 												return TRUE;
 											}
+											else
+											{
+												GLOBAL::WriteTextLog(_T("【Error】下载脚本失败:%s"), stScriptUrlResp.strURL.c_str());
+											}
 										}
+
+										GLOBAL::WriteTextLog(_T("【Error】创建目录失败:%s"), strSaveDir.c_str());
 									}							
 								}
 							}
 						}						
 					}
+					else
+					{
+						GLOBAL::WriteTextLog(_T("【Error】文件不可下载:%s"), reponse.c_str());
+					}
 				}
 
 				// 错误产生,可输出msg方便查询;