Add check recon connection and restart create recon record.

This commit is contained in:
sunwen
2023-09-06 18:01:48 +08:00
parent f9a99925a6
commit 663b8d8f35
9 changed files with 80 additions and 5 deletions

View File

@@ -6,6 +6,7 @@
#include <string>
namespace {
const char* CREATE_URL = "/Scan/Create/";
const char* CHECK_URL = "/v/";
const char* QUERY_SCAN_URL = "/Scan/Query/";
const char* QUERY_VERSION_URL = "/Version/";
const char* QUERY_RECON_URL = "/Task/Query/";
@@ -30,7 +31,22 @@ namespace Recon {
{
mHost = aHost;
}
RequestResult ReconClient::CheckActive(){
std::string content;
content.append("1");
auto resp = mRequest.post(mHost+CHECK_URL,content,mHeaders);
if (resp->httpCode() == 200){
delete resp;
return RequestResult::Success();
}
else{
mErrorMessage = resp->getContent();
delete resp;
return RequestResult::Fail(mErrorMessage);
}
}
RequestResult ReconClient::Create( const Scan& aScan)
{
cJSON * obj = cJSON_CreateObject();