浏览代码

1、所有web请求改成https;
2、新增初始化接口;

Jeff 5 年之前
父节点
当前提交
5d927131e9

+ 6 - 7
scbc.tools/scbc.tools/SDK.cpp

@@ -198,7 +198,7 @@ int CSDK::ReportKeyCopyResults(std::string sn)
 		form.insert(std::pair<std::string,std::string>("date", keys.copy_date));
 		CCurlClient curl;
 		curl.Initialize();
-		if ( curl.FormPost("http://test.admin.ota.qhmoka.com/IDManage/reportlist.do?", form, result,3) == CURLE_OK)
+		if ( curl.FormPosts(_host + "/reportlist.do?", form, result,3) == CURLE_OK)
 		{
 			cJSON *pJson = cJSON_Parse(result.c_str());
 			if ( pJson == NULL )
@@ -254,7 +254,7 @@ int CSDK::BatchReportKeyCopyResults()
 
 	CCurlClient curl;
 	curl.Initialize();
-	if ( curl.FormPost("http://test.admin.ota.qhmoka.com/IDManage/reportlist.do?", form, result,3) == CURLE_OK)
+	if ( curl.FormPosts(_host + "/reportlist.do?", form, result,3) == CURLE_OK)
 	{
 		cJSON *pJson = cJSON_Parse(result.c_str());
 		if ( pJson == NULL )
@@ -351,14 +351,14 @@ int CSDK::GetMidInfo(std::string order, STMid &mid)
 {
 	// http»ñÈ¡mid;
 	std::string result;
-	std::string url = "http://test.admin.ota.qhmoka.com/IDManage/getofflinelist.do?";
+	std::string url = _host + "/getofflinelist.do?";
 	std::string content = "orderNumber=";
 	content.append(order);
 	//content.append("&mac=");
 	//content.append(Global::g_strMacs);
 	CCurlClient curl;
 	curl.Initialize();
-	if ( curl.Post(url, content, result) == CURLE_OK)
+	if ( curl.Posts(url, content, result) == CURLE_OK)
 	{
 		// ½âÎöjson×Ö·û´®;
 		cJSON *pJson = cJSON_Parse(result.c_str());
@@ -470,7 +470,6 @@ BOOL CSDK::GetBidInfo(std::string order, std::string macs)
 	code = cJSON_GetObjectItem(pJson, "code") ? cJSON_GetObjectItem(pJson, "code")->valuestring : "";
 	_host = cJSON_GetObjectItem(pJson, "host") ? (cJSON_GetObjectItem(pJson, "host")->valuestring != NULL ? cJSON_GetObjectItem(pJson, "host")->valuestring : "") : "";
 	
-
 	if (_tcsicmp(code.c_str(), "1000") != 0)
 	{
 		bRet = FALSE;
@@ -497,13 +496,13 @@ int CSDK::ReportDownloadStatus(std::string order)
 {
 	// http»ñÈ¡mid;
 	std::string result;
-	std::string url = "http://test.admin.ota.qhmoka.com/IDManage/getreportofflinesn.do?";
+	std::string url = _host + "/getreportofflinesn.do?";
 	std::string content = "orderNumber=";
 	content.append(order);
 
 	CCurlClient curl;
 	curl.Initialize();
-	if ( curl.Post(url, content, result) == CURLE_OK)
+	if ( curl.Posts(url, content, result) == CURLE_OK)
 	{
 		// ½âÎöjson×Ö·û´®;
 		cJSON *pJson = cJSON_Parse(result.c_str());

+ 7 - 0
scbc.tools/scbc.tools/scbc.tools.cpp

@@ -262,6 +262,13 @@ int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
 // È«¾ÖÊý¾Ý¿â¶ÔÏó;
 CDataImpl g_db;
 CSDK g_sdk;
+
+bool ScbcInit(const char* lpOrder)
+{
+	Global::GetMacAddress();
+	return g_sdk.GetBidInfo(lpOrder, Global::g_strMacs);
+}
+
 int QueryMidInfo(const char* lpOrder)
 {
 	if ( lpOrder == NULL || lpOrder[0] == '\0' )

+ 9 - 0
scbc.tools/scbc.tools/scbc.tools.h

@@ -12,6 +12,15 @@
 
 #include "TableInfo.h"
 
+/* 0
+描述:使用批次号初始化https接口环境。
+	DownloadMidData、ReportKeyCopyResults、BatchReportKeyCopyResults前调用;
+参数:lpOrder 批次号;
+返回:
+	true成功;false失败;
+*/
+extern SCBCTOOLS_API bool ScbcInit(const char* lpOrder);
+
 /* 1
 描述:查询指定批次MID信息。
 	一般用于DownloadMidData调用后,查询是否下载成功;或者下载前,查询该批次是否已经在下载中;

+ 8 - 0
scbc.tools/test/test.cpp

@@ -29,6 +29,14 @@ int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
 	else
 	{
 		std::string bid = "DXM1900259";
+
+		// 0、初始化环境;
+		if ( !ScbcInit(bid.c_str()) )
+		{
+			printf("初始化失败\n");
+			return -1;
+		}
+
 		// 1、查询订单是否已下载成功;
 		int nRet = QueryMidInfo(bid.c_str());
 		printf("QueryMidInfo:%d\n", nRet);