|  | @@ -30,12 +30,30 @@ int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
 | 
	
		
			
				|  |  |  	else
 | 
	
		
			
				|  |  |  	{
 | 
	
		
			
				|  |  |  		// TODO: 在此处为应用程序的行为编写代码。
 | 
	
		
			
				|  |  | -		std::string host = "10.118.158.52:8580";//"http://10.118.158.198:8090";
 | 
	
		
			
				|  |  | +		//std::string host = "http://10.118.158.52:8580";//"http://10.118.158.198:8090";
 | 
	
		
			
				|  |  | +		std::string host = "http://10.118.158.198:8090";
 | 
	
		
			
				|  |  | +		SATParameters::STDevice stDevice;
 | 
	
		
			
				|  |  | +		stDevice.strStatus = "0";
 | 
	
		
			
				|  |  | +		stDevice.strDeviceSerial = "192.168.1.119:5555";
 | 
	
		
			
				|  |  | +		stDevice.strHardwareVersion = "MS6488";
 | 
	
		
			
				|  |  | +		stDevice.strManu = "MStar";
 | 
	
		
			
				|  |  | +		stDevice.strDeviceMac = "";
 | 
	
		
			
				|  |  | +		stDevice.strLastJobStartTime = "";
 | 
	
		
			
				|  |  | +		stDevice.strLastTimeBreak = "";
 | 
	
		
			
				|  |  | +		stDevice.strComments = "";
 | 
	
		
			
				|  |  | +		stDevice.strCPU = "";
 | 
	
		
			
				|  |  | +		stDevice.strSoftwareVersion = "1522659174";
 | 
	
		
			
				|  |  | +		stDevice.strPhoneNumber = "";
 | 
	
		
			
				|  |  | +		stDevice.strLastJobFinishTime = "";
 | 
	
		
			
				|  |  | +		stDevice.strMemory = "";
 | 
	
		
			
				|  |  | +		stDevice.strModel = "Generic Linux on tcl_ms6488_cn_64_n";
 | 
	
		
			
				|  |  | +		stDevice.strLastJob = "";
 | 
	
		
			
				|  |  | +		stDevice.strLastTimeConnected = "2019-12-16 10:16:01";
 | 
	
		
			
				|  |  | +		stDevice.strElectric = "";
 | 
	
		
			
				|  |  |  		//////////////////////////////////////////////////////////////////////////
 | 
	
		
			
				|  |  |  		SATParameters::STLoginReq stLoginReq;
 | 
	
		
			
				|  |  |  		SATParameters::STLoginResp stLoginResp;
 | 
	
		
			
				|  |  |  		std::string url = host + "/btc_execute_se/ajaxInteractiveManage!executeLogin.action";
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |  		// 示例值;
 | 
	
		
			
				|  |  |  		stLoginReq.strUserName = "superAdmin";
 | 
	
		
			
				|  |  |  		stLoginReq.strStatus = "0";
 | 
	
	
		
			
				|  | @@ -64,10 +82,6 @@ int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
 | 
	
		
			
				|  |  |  			stLoginResp.nCompanyId,
 | 
	
		
			
				|  |  |  			stLoginResp.strRunnerToken.c_str());
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -		SATParameters::STDevice stDevice;
 | 
	
		
			
				|  |  | -		stDevice.strStatus = "0";
 | 
	
		
			
				|  |  | -		stDevice.strDeviceSerial = "192.168.1.119:5555";
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |  		// ##########################更新设备信息##############################;
 | 
	
		
			
				|  |  |  		SATParameters::STUpdateDeviceReq stUpdateDeviceReq;
 | 
	
		
			
				|  |  |  		SATParameters::STUpdateDeviceResp stUpdateDeviceResp;
 | 
	
	
		
			
				|  | @@ -91,6 +105,7 @@ int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
 | 
	
		
			
				|  |  |  		stUpdateDeviceReq.strMemory = "8938544KB";
 | 
	
		
			
				|  |  |  		stUpdateDeviceReq.strEndTime = "";
 | 
	
		
			
				|  |  |  		stUpdateDeviceReq.strCPU = "24.7%";
 | 
	
		
			
				|  |  | +		stUpdateDeviceReq.devicelist.push_back(stDevice);
 | 
	
		
			
				|  |  |  		if ( UpdateDeviceMessage(url, stUpdateDeviceReq, stUpdateDeviceResp) )
 | 
	
		
			
				|  |  |  		{
 | 
	
		
			
				|  |  |  			printf("更新设备信息成功:code=%s, msg=%s, str=%s\n",
 | 
	
	
		
			
				|  | @@ -103,37 +118,38 @@ int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
 | 
	
		
			
				|  |  |  			printf("更新设备信息失败!\n");
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -		// ##########################心跳包机制##############################;
 | 
	
		
			
				|  |  | -		SATParameters::STHeartbeatReq stHeartbeatReq;
 | 
	
		
			
				|  |  | -		SATParameters::STHeartbeatResp stHeartbeatResp;
 | 
	
		
			
				|  |  | -		__if_not_exists(url)
 | 
	
		
			
				|  |  | -		{			
 | 
	
		
			
				|  |  | -			std::string url = host + "/btc_execute_se/ajaxInteractiveManage!executeHeartbeat.action";
 | 
	
		
			
				|  |  | -		}
 | 
	
		
			
				|  |  | -		__if_exists(url)
 | 
	
		
			
				|  |  | +		while(true)
 | 
	
		
			
				|  |  |  		{
 | 
	
		
			
				|  |  | -			url = host + "/btc_execute_se/ajaxInteractiveManage!executeHeartbeat.action";
 | 
	
		
			
				|  |  | -		}
 | 
	
		
			
				|  |  | +			// ##########################心跳包机制##############################;
 | 
	
		
			
				|  |  | +			SATParameters::STHeartbeatReq stHeartbeatReq;
 | 
	
		
			
				|  |  | +			SATParameters::STHeartbeatResp stHeartbeatResp;
 | 
	
		
			
				|  |  | +			__if_not_exists(url)
 | 
	
		
			
				|  |  | +			{			
 | 
	
		
			
				|  |  | +				std::string url = host + "/btc_execute_se/ajaxInteractiveManage!executeHeartbeat.action";
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +			__if_exists(url)
 | 
	
		
			
				|  |  | +			{
 | 
	
		
			
				|  |  | +				url = host + "/btc_execute_se/ajaxInteractiveManage!executeHeartbeat.action";
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -		// 示例值;
 | 
	
		
			
				|  |  | -		stDevice.strStatus = "0";
 | 
	
		
			
				|  |  | -		stDevice.strDeviceSerial = "192.168.1.119:5555";
 | 
	
		
			
				|  |  | +			// 示例值;
 | 
	
		
			
				|  |  | +			stDevice.strStatus = "0";
 | 
	
		
			
				|  |  | +			stDevice.strDeviceSerial = "192.168.1.119:5555";
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -		stHeartbeatReq.strUserName = "superAdmin";
 | 
	
		
			
				|  |  | -		stHeartbeatReq.strRunnerMac = "40:16:7e:23:10:53";
 | 
	
		
			
				|  |  | -		stHeartbeatReq.devicelist.push_back(stDevice);
 | 
	
		
			
				|  |  | -		if ( Heartbeat(url, stHeartbeatReq, stHeartbeatResp) )
 | 
	
		
			
				|  |  | -		{
 | 
	
		
			
				|  |  | -			printf("登录返回:code=%s, msg=%s, str=%s, portCount=%d, companyid=%d, runnertoken=%s\n",
 | 
	
		
			
				|  |  | -				stLoginResp.strCode.c_str(),
 | 
	
		
			
				|  |  | -				stLoginResp.strMessage.c_str(),
 | 
	
		
			
				|  |  | -				stLoginResp.strStr.c_str(),
 | 
	
		
			
				|  |  | -				stLoginResp.nPortCount,
 | 
	
		
			
				|  |  | -				stLoginResp.nCompanyId,
 | 
	
		
			
				|  |  | -				stLoginResp.strRunnerToken.c_str());
 | 
	
		
			
				|  |  | +			stHeartbeatReq.strUserName = "superAdmin";
 | 
	
		
			
				|  |  | +			stHeartbeatReq.strRunnerMac = "40:16:7e:23:10:53";
 | 
	
		
			
				|  |  | +			stHeartbeatReq.devicelist.push_back(stDevice);
 | 
	
		
			
				|  |  | +			if ( Heartbeat(url, stHeartbeatReq, stHeartbeatResp) )
 | 
	
		
			
				|  |  | +			{
 | 
	
		
			
				|  |  | +				printf("登录返回:code=%s, msg=%s, str=%s\n",
 | 
	
		
			
				|  |  | +					stHeartbeatResp.strCode.c_str(),
 | 
	
		
			
				|  |  | +					stHeartbeatResp.strMessage.c_str(),
 | 
	
		
			
				|  |  | +					stHeartbeatResp.strStr.c_str());
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +			Sleep(3000);
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  |  		
 | 
	
		
			
				|  |  | -		
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	system("pause");
 | 
	
	
		
			
				|  | @@ -178,7 +194,7 @@ SATHTTP_API int Login(std::string url, const SATParameters::STLoginReq &stLoginR
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	char *pText = cJSON_Print(pRoot);
 | 
	
		
			
				|  |  |  	std::string post_data = "requestMsg=";
 | 
	
		
			
				|  |  | -	post_data.append(pText, strlen(pText));
 | 
	
		
			
				|  |  | +	post_data.append(CharEncoding::EnCode_UTF8URL(pText));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	// 释放堆内存;
 | 
	
		
			
				|  |  |  	if (pText)
 | 
	
	
		
			
				|  | @@ -221,12 +237,12 @@ SATHTTP_API int Login(std::string url, const SATParameters::STLoginReq &stLoginR
 | 
	
		
			
				|  |  |  							stLoginResp.nPortCount = cJSON_GetObjectItem(pObj, "portCount") ? cJSON_GetObjectItem(pObj, "portCount")->valueint : -1;
 | 
	
		
			
				|  |  |  							stLoginResp.nCompanyId = cJSON_GetObjectItem(pObj, "companyId") ? cJSON_GetObjectItem(pObj, "companyId")->valueint : -1;
 | 
	
		
			
				|  |  |  							stLoginResp.strRunnerToken = cJSON_GetObjectItem(pObj, "runnerToken") ? cJSON_GetObjectItem(pObj, "runnerToken")->valuestring : "";
 | 
	
		
			
				|  |  | -							// 释放内存;
 | 
	
		
			
				|  |  | -							cJSON_Delete(pRoot);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -							// 返回结果;
 | 
	
		
			
				|  |  | -							return TRUE;
 | 
	
		
			
				|  |  |  						}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +						// 释放内存;
 | 
	
		
			
				|  |  | +						cJSON_Delete(pRoot);
 | 
	
		
			
				|  |  | +						// 返回结果;
 | 
	
		
			
				|  |  | +						return TRUE;
 | 
	
		
			
				|  |  |  					}
 | 
	
		
			
				|  |  |  				}
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -274,6 +290,21 @@ SATHTTP_API int UpdateDeviceMessage(std::string url, const SATParameters::STUpda
 | 
	
		
			
				|  |  |  				{
 | 
	
		
			
				|  |  |  					ASSERT(cJSON_AddStringToObject(pObj, "status", it->strStatus.c_str()));
 | 
	
		
			
				|  |  |  					ASSERT(cJSON_AddStringToObject(pObj, "deviceSerial", it->strDeviceSerial.c_str()));
 | 
	
		
			
				|  |  | +					ASSERT(cJSON_AddStringToObject(pObj, "hardwareVersion", it->strHardwareVersion.c_str()));
 | 
	
		
			
				|  |  | +					ASSERT(cJSON_AddStringToObject(pObj, "manu", it->strManu.c_str()));
 | 
	
		
			
				|  |  | +					ASSERT(cJSON_AddStringToObject(pObj, "deviceMac", it->strDeviceMac.c_str()));
 | 
	
		
			
				|  |  | +					ASSERT(cJSON_AddStringToObject(pObj, "lastJobStartTime", it->strLastJobStartTime.c_str()));
 | 
	
		
			
				|  |  | +					ASSERT(cJSON_AddStringToObject(pObj, "lastTimeBreak", it->strLastTimeBreak.c_str()));
 | 
	
		
			
				|  |  | +					ASSERT(cJSON_AddStringToObject(pObj, "comments", it->strComments.c_str()));
 | 
	
		
			
				|  |  | +					ASSERT(cJSON_AddStringToObject(pObj, "cpu", it->strCPU.c_str()));
 | 
	
		
			
				|  |  | +					ASSERT(cJSON_AddStringToObject(pObj, "softwareVersion", it->strSoftwareVersion.c_str()));
 | 
	
		
			
				|  |  | +					ASSERT(cJSON_AddStringToObject(pObj, "phoneNumber", it->strPhoneNumber.c_str()));
 | 
	
		
			
				|  |  | +					ASSERT(cJSON_AddStringToObject(pObj, "lastJobFinishTime", it->strLastJobFinishTime.c_str()));
 | 
	
		
			
				|  |  | +					ASSERT(cJSON_AddStringToObject(pObj, "memory", it->strMemory.c_str()));
 | 
	
		
			
				|  |  | +					ASSERT(cJSON_AddStringToObject(pObj, "model", it->strModel.c_str()));
 | 
	
		
			
				|  |  | +					ASSERT(cJSON_AddStringToObject(pObj, "lastJob", it->strLastJob.c_str()));
 | 
	
		
			
				|  |  | +					ASSERT(cJSON_AddStringToObject(pObj, "lastTimeConnected", it->strLastTimeConnected.c_str()));
 | 
	
		
			
				|  |  | +					ASSERT(cJSON_AddStringToObject(pObj, "electric", it->strElectric.c_str()));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  					cJSON_AddItemToObject(pDeviceList, "", pObj);
 | 
	
		
			
				|  |  |  				}
 | 
	
	
		
			
				|  | @@ -286,7 +317,7 @@ SATHTTP_API int UpdateDeviceMessage(std::string url, const SATParameters::STUpda
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	char *pText = cJSON_Print(pRoot);
 | 
	
		
			
				|  |  |  	std::string post_data = "requestMsg=";
 | 
	
		
			
				|  |  | -	post_data.append(pText, strlen(pText));
 | 
	
		
			
				|  |  | +	post_data.append(CharEncoding::EnCode_UTF8URL(pText));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	// 释放堆内存;
 | 
	
		
			
				|  |  |  	if (pText)
 | 
	
	
		
			
				|  | @@ -302,14 +333,6 @@ SATHTTP_API int UpdateDeviceMessage(std::string url, const SATParameters::STUpda
 | 
	
		
			
				|  |  |  	CURLcode curlCode = CURLE_OK;
 | 
	
		
			
				|  |  |  	if ( CURLE_OK == curl.Initialize() )
 | 
	
		
			
				|  |  |  	{
 | 
	
		
			
				|  |  | -		//curl.SetHeaders("Content-Type: application/json");
 | 
	
		
			
				|  |  | -		curl.SetHeaders("Accept: */*");
 | 
	
		
			
				|  |  | -		curl.SetHeaders("Connection: Keep-Alive");
 | 
	
		
			
				|  |  | -		//curl.SetHeaders("Accept-Encoding: gzip, deflate");
 | 
	
		
			
				|  |  | -		curl.SetHeaders("user-agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
 | 
	
		
			
				|  |  | -		//post_data = CharEncoding::EnCode_UTF8URL(post_data.c_str());
 | 
	
		
			
				|  |  | -		//post_data = CharEncoding::EnCode_UNICODEURL(post_data.c_str());
 | 
	
		
			
				|  |  | -		//post_data = CharEncoding::EnCode_GB2312URL(post_data.c_str());
 | 
	
		
			
				|  |  |  		if (_tcsstr(url.c_str(), "https://") || _tcsstr(url.c_str(), "HTTPS://") )
 | 
	
		
			
				|  |  |  			curlCode = curl.Posts(url, post_data, reponse);
 | 
	
		
			
				|  |  |  		else
 | 
	
	
		
			
				|  | @@ -334,15 +357,13 @@ SATHTTP_API int UpdateDeviceMessage(std::string url, const SATParameters::STUpda
 | 
	
		
			
				|  |  |  						cJSON *pObj = cJSON_GetObjectItem(pMsg, "data");
 | 
	
		
			
				|  |  |  						if (pObj != NULL)
 | 
	
		
			
				|  |  |  						{
 | 
	
		
			
				|  |  | -							//stLoginResp.nPortCount = cJSON_GetObjectItem(pObj, "portCount") ? cJSON_GetObjectItem(pObj, "portCount")->valueint : -1;
 | 
	
		
			
				|  |  | -							//stLoginResp.nCompanyId = cJSON_GetObjectItem(pObj, "companyId") ? cJSON_GetObjectItem(pObj, "companyId")->valueint : -1;
 | 
	
		
			
				|  |  | -							//stLoginResp.strRunnerToken = cJSON_GetObjectItem(pObj, "runnerToken") ? cJSON_GetObjectItem(pObj, "runnerToken")->valuestring : "";
 | 
	
		
			
				|  |  | -							// 释放内存;
 | 
	
		
			
				|  |  | -							cJSON_Delete(pRoot);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -							// 返回结果;
 | 
	
		
			
				|  |  | -							return TRUE;
 | 
	
		
			
				|  |  | +							
 | 
	
		
			
				|  |  |  						}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +						// 释放内存;
 | 
	
		
			
				|  |  | +						cJSON_Delete(pRoot);
 | 
	
		
			
				|  |  | +						// 返回结果;
 | 
	
		
			
				|  |  | +						return TRUE;
 | 
	
		
			
				|  |  |  					}
 | 
	
		
			
				|  |  |  				}
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -394,7 +415,7 @@ SATHTTP_API int Heartbeat(std::string url, const SATParameters::STHeartbeatReq &
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	char *pText = cJSON_Print(pRoot);
 | 
	
		
			
				|  |  |  	std::string post_data = "requestMsg=";
 | 
	
		
			
				|  |  | -	post_data.append(pText);
 | 
	
		
			
				|  |  | +	post_data.append(CharEncoding::EnCode_UTF8URL(pText));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	// 释放堆内存;
 | 
	
		
			
				|  |  |  	if (pText)
 | 
	
	
		
			
				|  | @@ -562,5 +583,207 @@ SATHTTP_API int Heartbeat(std::string url, const SATParameters::STHeartbeatReq &
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +	return FALSE;
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +SATHTTP_API int SetResult(std::string url, const SATParameters::STNotifyJobStartReq &stNotifyJobStartReq, SATParameters::STNotifyJobStartResp &stNotifyJobStartResp)
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +	// 转化为Json;
 | 
	
		
			
				|  |  | +	cJSON *pRoot = cJSON_CreateObject();
 | 
	
		
			
				|  |  | +	if ( pRoot == NULL )
 | 
	
		
			
				|  |  | +	{
 | 
	
		
			
				|  |  | +		return -1;
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	ASSERT(cJSON_AddStringToObject(pRoot, "sysCode", ""));
 | 
	
		
			
				|  |  | +	ASSERT(cJSON_AddStringToObject(pRoot, "function", ""));
 | 
	
		
			
				|  |  | +	cJSON *pData = cJSON_CreateObject();
 | 
	
		
			
				|  |  | +	if ( pData )
 | 
	
		
			
				|  |  | +	{
 | 
	
		
			
				|  |  | +		ASSERT(cJSON_AddStringToObject(pData, "instanceId", stNotifyJobStartReq.strInstanceId.c_str()));
 | 
	
		
			
				|  |  | +		ASSERT(cJSON_AddStringToObject(pData, "signalImageUrl", stNotifyJobStartReq.strSignalImageUrl.c_str()));
 | 
	
		
			
				|  |  | +		ASSERT(cJSON_AddStringToObject(pData, "deviceId", stNotifyJobStartReq.strDeviceId.c_str()));
 | 
	
		
			
				|  |  | +		ASSERT(cJSON_AddStringToObject(pData, "taskId", stNotifyJobStartReq.strTaskId.c_str()));
 | 
	
		
			
				|  |  | +		ASSERT(cJSON_AddStringToObject(pData, "executeId", stNotifyJobStartReq.strExecuteId.c_str()));
 | 
	
		
			
				|  |  | +				
 | 
	
		
			
				|  |  | +		// 添加到根结点中;
 | 
	
		
			
				|  |  | +		cJSON_AddItemToObject(pRoot, "data", pData);
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	char *pText = cJSON_Print(pRoot);
 | 
	
		
			
				|  |  | +	std::string post_data = "requestMsg=";
 | 
	
		
			
				|  |  | +	post_data.append(CharEncoding::EnCode_UTF8URL(pText));
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	// 释放堆内存;
 | 
	
		
			
				|  |  | +	if (pText)
 | 
	
		
			
				|  |  | +		delete pText;
 | 
	
		
			
				|  |  | +	pText = NULL;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	if ( pRoot )
 | 
	
		
			
				|  |  | +		cJSON_Delete(pRoot);
 | 
	
		
			
				|  |  | +	pRoot = NULL;		
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	CCurlClient curl;
 | 
	
		
			
				|  |  | +	std::string reponse;	
 | 
	
		
			
				|  |  | +	CURLcode curlCode = CURLE_OK;
 | 
	
		
			
				|  |  | +	if ( CURLE_OK == curl.Initialize() )
 | 
	
		
			
				|  |  | +	{
 | 
	
		
			
				|  |  | +		if (_tcsstr(url.c_str(), "https://") || _tcsstr(url.c_str(), "HTTPS://") )
 | 
	
		
			
				|  |  | +			curlCode = curl.Posts(url, post_data, reponse);
 | 
	
		
			
				|  |  | +		else
 | 
	
		
			
				|  |  | +			curlCode = curl.Post(url, post_data, reponse);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +		if ( curlCode == CURLE_OK )
 | 
	
		
			
				|  |  | +		{
 | 
	
		
			
				|  |  | +			reponse = CharEncoding::DeCode_URLUTF8(reponse.c_str());
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +			// 解析返回值;
 | 
	
		
			
				|  |  | +			pRoot = cJSON_Parse(reponse.c_str());
 | 
	
		
			
				|  |  | +			if (pRoot != NULL)
 | 
	
		
			
				|  |  | +			{
 | 
	
		
			
				|  |  | +				cJSON *pMsg = cJSON_GetObjectItem(pRoot, "responseMsg");
 | 
	
		
			
				|  |  | +				if ( pMsg )
 | 
	
		
			
				|  |  | +				{
 | 
	
		
			
				|  |  | +					stNotifyJobStartResp.strCode = cJSON_GetObjectItem(pMsg, "code") ? cJSON_GetObjectItem(pMsg, "code")->valuestring : "";
 | 
	
		
			
				|  |  | +					stNotifyJobStartResp.strMessage = cJSON_GetObjectItem(pMsg, "message") ? cJSON_GetObjectItem(pMsg, "message")->valuestring : "";
 | 
	
		
			
				|  |  | +					stNotifyJobStartResp.strStr = cJSON_GetObjectItem(pMsg, "str") ? (cJSON_GetObjectItem(pMsg, "str")->valuestring ? cJSON_GetObjectItem(pMsg, "str")->valuestring : "") : "";
 | 
	
		
			
				|  |  | +					if ( stNotifyJobStartResp.strCode == "00" )
 | 
	
		
			
				|  |  | +					{				
 | 
	
		
			
				|  |  | +						cJSON *pObj = cJSON_GetObjectItem(pMsg, "data");
 | 
	
		
			
				|  |  | +						if (pObj != NULL)
 | 
	
		
			
				|  |  | +						{
 | 
	
		
			
				|  |  | +							
 | 
	
		
			
				|  |  | +						}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +						// 释放内存;
 | 
	
		
			
				|  |  | +						cJSON_Delete(pRoot);
 | 
	
		
			
				|  |  | +						// 返回结果;
 | 
	
		
			
				|  |  | +						return TRUE;
 | 
	
		
			
				|  |  | +					}
 | 
	
		
			
				|  |  | +				}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +				// 错误产生,可输出msg方便查询;
 | 
	
		
			
				|  |  | +				cJSON_Delete(pRoot);	
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	return FALSE;
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +SATHTTP_API int SetResultList(std::string url, const SATParameters::STJobProcessReq &stJobProcessReq, SATParameters::STJobProcessResp &stJobProcessResp)
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +	// 转化为Json;
 | 
	
		
			
				|  |  | +	cJSON *pRoot = cJSON_CreateObject();
 | 
	
		
			
				|  |  | +	if ( pRoot == NULL )
 | 
	
		
			
				|  |  | +	{
 | 
	
		
			
				|  |  | +		return -1;
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	ASSERT(cJSON_AddStringToObject(pRoot, "sysCode", "Execute"));
 | 
	
		
			
				|  |  | +	ASSERT(cJSON_AddStringToObject(pRoot, "function", "setResultList"));
 | 
	
		
			
				|  |  | +	cJSON *pData = cJSON_CreateObject();
 | 
	
		
			
				|  |  | +	if ( pData )
 | 
	
		
			
				|  |  | +	{
 | 
	
		
			
				|  |  | +		ASSERT(cJSON_AddStringToObject(pData, "result_state", stJobProcessReq.strResultState.c_str()));
 | 
	
		
			
				|  |  | +		ASSERT(cJSON_AddStringToObject(pData, "case_scene", stJobProcessReq.strCaseScene.c_str()));
 | 
	
		
			
				|  |  | +		ASSERT(cJSON_AddStringToObject(pData, "case_step", stJobProcessReq.strCaseStep.c_str()));
 | 
	
		
			
				|  |  | +		ASSERT(cJSON_AddStringToObject(pData, "apkMd5", stJobProcessReq.strApkMD5.c_str()));
 | 
	
		
			
				|  |  | +		ASSERT(cJSON_AddStringToObject(pData, "crash_time", stJobProcessReq.strCrashTime.c_str()));
 | 
	
		
			
				|  |  | +		ASSERT(cJSON_AddStringToObject(pData, "runner_id", stJobProcessReq.strRunnerId.c_str()));
 | 
	
		
			
				|  |  | +		ASSERT(cJSON_AddStringToObject(pData, "cpu_info", stJobProcessReq.strCPUInfo.c_str()));
 | 
	
		
			
				|  |  | +		ASSERT(cJSON_AddStringToObject(pData, "runnedActionNameList", stJobProcessReq.strRunnedActionNameList.c_str()));
 | 
	
		
			
				|  |  | +		ASSERT(cJSON_AddStringToObject(pData, "artificial_result", stJobProcessReq.strArtificialResult.c_str()));
 | 
	
		
			
				|  |  | +		ASSERT(cJSON_AddStringToObject(pData, "artificial_modify", stJobProcessReq.strArtificialModify.c_str()));
 | 
	
		
			
				|  |  | +		ASSERT(cJSON_AddStringToObject(pData, "runner_name", stJobProcessReq.strRunnerName.c_str()));
 | 
	
		
			
				|  |  | +		ASSERT(cJSON_AddStringToObject(pData, "task_type", stJobProcessReq.strTaskType.c_str()));
 | 
	
		
			
				|  |  | +		ASSERT(cJSON_AddStringToObject(pData, "case_repeat", stJobProcessReq.strCaseRepeat.c_str()));
 | 
	
		
			
				|  |  | +		ASSERT(cJSON_AddStringToObject(pData, "application_group", stJobProcessReq.strApplicationGroup.c_str()));
 | 
	
		
			
				|  |  | +		ASSERT(cJSON_AddStringToObject(pData, "instanceId", stJobProcessReq.strInstanceId.c_str()));
 | 
	
		
			
				|  |  | +		ASSERT(cJSON_AddStringToObject(pData, "case_id", stJobProcessReq.strCaseId.c_str()));
 | 
	
		
			
				|  |  | +		ASSERT(cJSON_AddStringToObject(pData, "progress", stJobProcessReq.strProgress.c_str()));
 | 
	
		
			
				|  |  | +		ASSERT(cJSON_AddStringToObject(pData, "result_message", stJobProcessReq.strReusltMessage.c_str()));
 | 
	
		
			
				|  |  | +		ASSERT(cJSON_AddStringToObject(pData, "job_repeat", stJobProcessReq.strJobRepeat.c_str()));
 | 
	
		
			
				|  |  | +		ASSERT(cJSON_AddStringToObject(pData, "screenshot", stJobProcessReq.strScreenShot.c_str()));
 | 
	
		
			
				|  |  | +		ASSERT(cJSON_AddStringToObject(pData, "start_time", stJobProcessReq.strStartTime.c_str()));
 | 
	
		
			
				|  |  | +		ASSERT(cJSON_AddStringToObject(pData, "crash_number", stJobProcessReq.strCrashNumber.c_str()));
 | 
	
		
			
				|  |  | +		ASSERT(cJSON_AddStringToObject(pData, "case_name", stJobProcessReq.strCaseName.c_str()));
 | 
	
		
			
				|  |  | +		ASSERT(cJSON_AddStringToObject(pData, "failed_reason", stJobProcessReq.strFailedReason.c_str()));
 | 
	
		
			
				|  |  | +		ASSERT(cJSON_AddStringToObject(pData, "img_name", stJobProcessReq.strImgName.c_str()));
 | 
	
		
			
				|  |  | +		ASSERT(cJSON_AddStringToObject(pData, "case_index", stJobProcessReq.strCaseIndex.c_str()));
 | 
	
		
			
				|  |  | +		ASSERT(cJSON_AddStringToObject(pData, "device_id", stJobProcessReq.strDeviceId.c_str()));
 | 
	
		
			
				|  |  | +		ASSERT(cJSON_AddStringToObject(pData, "scene_index", stJobProcessReq.strSceneIndex.c_str()));
 | 
	
		
			
				|  |  | +		ASSERT(cJSON_AddStringToObject(pData, "task_id", stJobProcessReq.strTaskId.c_str()));
 | 
	
		
			
				|  |  | +		ASSERT(cJSON_AddStringToObject(pData, "analysis", stJobProcessReq.strAnalysis.c_str()));
 | 
	
		
			
				|  |  | +		ASSERT(cJSON_AddStringToObject(pData, "device_name", stJobProcessReq.strDevnceName.c_str()));
 | 
	
		
			
				|  |  | +		ASSERT(cJSON_AddStringToObject(pData, "info_type", stJobProcessReq.strInfoType.c_str()));
 | 
	
		
			
				|  |  | +		ASSERT(cJSON_AddStringToObject(pData, "memory_info", stJobProcessReq.strMemoryInfo.c_str()));
 | 
	
		
			
				|  |  | +		ASSERT(cJSON_AddStringToObject(pData, "end_time", stJobProcessReq.strEndTime.c_str()));
 | 
	
		
			
				|  |  | +		ASSERT(cJSON_AddStringToObject(pData, "round_number", stJobProcessReq.strRoundNumber.c_str()));
 | 
	
		
			
				|  |  | +		ASSERT(cJSON_AddStringToObject(pData, "result_type", stJobProcessReq.strResultType.c_str()));
 | 
	
		
			
				|  |  | +		ASSERT(cJSON_AddStringToObject(pData, "operation_step", stJobProcessReq.strOperationStep.c_str()));
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +		// 添加到根结点中;
 | 
	
		
			
				|  |  | +		cJSON_AddItemToObject(pRoot, "data", pData);
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	char *pText = cJSON_Print(pRoot);
 | 
	
		
			
				|  |  | +	std::string post_data = "requestMsg=";
 | 
	
		
			
				|  |  | +	post_data.append(CharEncoding::EnCode_UTF8URL(pText));
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	// 释放堆内存;
 | 
	
		
			
				|  |  | +	if (pText)
 | 
	
		
			
				|  |  | +		delete pText;
 | 
	
		
			
				|  |  | +	pText = NULL;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	if ( pRoot )
 | 
	
		
			
				|  |  | +		cJSON_Delete(pRoot);
 | 
	
		
			
				|  |  | +	pRoot = NULL;		
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +	CCurlClient curl;
 | 
	
		
			
				|  |  | +	std::string reponse;	
 | 
	
		
			
				|  |  | +	CURLcode curlCode = CURLE_OK;
 | 
	
		
			
				|  |  | +	if ( CURLE_OK == curl.Initialize() )
 | 
	
		
			
				|  |  | +	{
 | 
	
		
			
				|  |  | +		if (_tcsstr(url.c_str(), "https://") || _tcsstr(url.c_str(), "HTTPS://") )
 | 
	
		
			
				|  |  | +			curlCode = curl.Posts(url, post_data, reponse);
 | 
	
		
			
				|  |  | +		else
 | 
	
		
			
				|  |  | +			curlCode = curl.Post(url, post_data, reponse);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +		if ( curlCode == CURLE_OK )
 | 
	
		
			
				|  |  | +		{
 | 
	
		
			
				|  |  | +			reponse = CharEncoding::DeCode_URLUTF8(reponse.c_str());
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +			// 解析返回值;
 | 
	
		
			
				|  |  | +			pRoot = cJSON_Parse(reponse.c_str());
 | 
	
		
			
				|  |  | +			if (pRoot != NULL)
 | 
	
		
			
				|  |  | +			{
 | 
	
		
			
				|  |  | +				cJSON *pMsg = cJSON_GetObjectItem(pRoot, "responseMsg");
 | 
	
		
			
				|  |  | +				if ( pMsg )
 | 
	
		
			
				|  |  | +				{
 | 
	
		
			
				|  |  | +					stJobProcessResp.strCode = cJSON_GetObjectItem(pMsg, "code") ? cJSON_GetObjectItem(pMsg, "code")->valuestring : "";
 | 
	
		
			
				|  |  | +					stJobProcessResp.strMessage = cJSON_GetObjectItem(pMsg, "message") ? cJSON_GetObjectItem(pMsg, "message")->valuestring : "";
 | 
	
		
			
				|  |  | +					stJobProcessResp.strStr = cJSON_GetObjectItem(pMsg, "str") ? (cJSON_GetObjectItem(pMsg, "str")->valuestring ? cJSON_GetObjectItem(pMsg, "str")->valuestring : "") : "";
 | 
	
		
			
				|  |  | +					if ( stJobProcessResp.strCode == "00" )
 | 
	
		
			
				|  |  | +					{				
 | 
	
		
			
				|  |  | +						cJSON *pObj = cJSON_GetObjectItem(pMsg, "data");
 | 
	
		
			
				|  |  | +						if (pObj != NULL)
 | 
	
		
			
				|  |  | +						{
 | 
	
		
			
				|  |  | +							
 | 
	
		
			
				|  |  | +						}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +						// 释放内存;
 | 
	
		
			
				|  |  | +						cJSON_Delete(pRoot);
 | 
	
		
			
				|  |  | +						// 返回结果;
 | 
	
		
			
				|  |  | +						return TRUE;
 | 
	
		
			
				|  |  | +					}
 | 
	
		
			
				|  |  | +				}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +				// 错误产生,可输出msg方便查询;
 | 
	
		
			
				|  |  | +				cJSON_Delete(pRoot);	
 | 
	
		
			
				|  |  | +			}
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +	}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  	return FALSE;
 | 
	
		
			
				|  |  |  }
 |