Commit 2cc79369 authored by yangjian's avatar yangjian

update AuthenticationStatus

parent 5ba269dd
File deleted
...@@ -36,14 +36,14 @@ void AuthenticationStatusDocumentApiImpl::create_authentication_status(const std ...@@ -36,14 +36,14 @@ void AuthenticationStatusDocumentApiImpl::create_authentication_status(const std
if (mysql_real_query(mysql_WitcommUDRDB,select_AuthenticationStatus.c_str(), (unsigned long)select_AuthenticationStatus.size())) if (mysql_real_query(mysql_WitcommUDRDB,select_AuthenticationStatus.c_str(), (unsigned long)select_AuthenticationStatus.size()))
{ {
Logger::udr_server().error("mysql_real_query failure!SQL(%s)",select_AuthenticationStatus); Logger::udr_server().error("mysql_real_query failure!SQL(%s)",select_AuthenticationStatus.c_str());
return; return;
} }
res = mysql_store_result(mysql_WitcommUDRDB); res = mysql_store_result(mysql_WitcommUDRDB);
if(res == NULL) if(res == NULL)
{ {
Logger::udr_server().error("mysql_store_result failure!SQL(%s)",select_AuthenticationStatus); Logger::udr_server().error("mysql_store_result failure!SQL(%s)",select_AuthenticationStatus.c_str());
return; return;
} }
if (mysql_num_rows(res)) if (mysql_num_rows(res))
...@@ -51,10 +51,11 @@ void AuthenticationStatusDocumentApiImpl::create_authentication_status(const std ...@@ -51,10 +51,11 @@ void AuthenticationStatusDocumentApiImpl::create_authentication_status(const std
query="update AuthenticationStatus set nfInstanceId='"+authEvent.getNfInstanceId()+"'"+ \ query="update AuthenticationStatus set nfInstanceId='"+authEvent.getNfInstanceId()+"'"+ \
",success="+(authEvent.isSuccess()?"1":"0")+ \ ",success="+(authEvent.isSuccess()?"1":"0")+ \
",timeStamp='"+authEvent.getTimeStamp()+"'"+ \ ",timeStamp='"+authEvent.getTimeStamp()+"'"+ \
",authType='"+authEvent.getAuthType()+"'"+ \
",servingNetworkName='"+authEvent.getServingNetworkName()+"'"+ \ ",servingNetworkName='"+authEvent.getServingNetworkName()+"'"+ \
(authEvent.authRemovalIndIsSet()?(authEvent.isAuthRemovalInd()?",authRemovalInd=1":",authRemovalInd=0"):""); (authEvent.authRemovalIndIsSet()?(authEvent.isAuthRemovalInd()?",authRemovalInd=1":",authRemovalInd=0"):"");
to_json(j,authEvent.getAuthType()); // to_json(j,authEvent.getAuthType());
query += ",authType='"+j.dump()+"'"; // query += ",authType='"+j.dump()+"'";
query += " where ueid='"+ueId+"'"; query += " where ueid='"+ueId+"'";
} }
else else
...@@ -63,24 +64,24 @@ void AuthenticationStatusDocumentApiImpl::create_authentication_status(const std ...@@ -63,24 +64,24 @@ void AuthenticationStatusDocumentApiImpl::create_authentication_status(const std
",nfInstanceId='"+authEvent.getNfInstanceId()+"'"+ \ ",nfInstanceId='"+authEvent.getNfInstanceId()+"'"+ \
",success="+(authEvent.isSuccess()?"1":"0")+ \ ",success="+(authEvent.isSuccess()?"1":"0")+ \
",timeStamp='"+authEvent.getTimeStamp()+"'"+ \ ",timeStamp='"+authEvent.getTimeStamp()+"'"+ \
",authType='"+authEvent.getAuthType()+"'"+ \
",servingNetworkName='"+authEvent.getServingNetworkName()+"'"+ \ ",servingNetworkName='"+authEvent.getServingNetworkName()+"'"+ \
(authEvent.authRemovalIndIsSet()?(authEvent.isAuthRemovalInd()?",authRemovalInd=1":",authRemovalInd=0"):""); (authEvent.authRemovalIndIsSet()?(authEvent.isAuthRemovalInd()?",authRemovalInd=1":",authRemovalInd=0"):"");
to_json(j,authEvent.getAuthType()); // to_json(j,authEvent.getAuthType());
query += ",authType='"+j.dump()+"'"; // query += ",authType='"+j.dump()+"'";
} }
mysql_free_result(res); mysql_free_result(res);
if (mysql_real_query(mysql_WitcommUDRDB,query.c_str(), (unsigned long)query.size())) if (mysql_real_query(mysql_WitcommUDRDB,query.c_str(), (unsigned long)query.size()))
{ {
Logger::udr_server().error("mysql create failure!"); Logger::udr_server().error("mysql create failure!SQL(%s)",query.c_str());
return; return;
} }
response.send(Pistache::Http::Code::No_Content, ""); response.send(Pistache::Http::Code::No_Content, "");
to_json(j,authEvent); to_json(j,authEvent);
std::string out = j.dump(); Logger::udr_server().debug("AuthenticationStatus PUT - json:\n\"%s\"",j.dump().c_str());
Logger::udr_server().debug("AuthenticationStatus PUT - json:\n\"%s\"",out);
} }
...@@ -90,7 +91,7 @@ void AuthenticationStatusDocumentApiImpl::delete_authentication_status(const std ...@@ -90,7 +91,7 @@ void AuthenticationStatusDocumentApiImpl::delete_authentication_status(const std
if (mysql_real_query(mysql_WitcommUDRDB,query.c_str(), (unsigned long)query.size())) if (mysql_real_query(mysql_WitcommUDRDB,query.c_str(), (unsigned long)query.size()))
{ {
Logger::udr_server().error("mysql_real_query failure!SQL(%s)",query); Logger::udr_server().error("mysql_real_query failure!SQL(%s)",query.c_str());
return; return;
} }
...@@ -110,7 +111,7 @@ void AuthenticationStatusDocumentApiImpl::query_authentication_status(const std: ...@@ -110,7 +111,7 @@ void AuthenticationStatusDocumentApiImpl::query_authentication_status(const std:
if (mysql_real_query(mysql_WitcommUDRDB,query.c_str(), (unsigned long)query.size())) if (mysql_real_query(mysql_WitcommUDRDB,query.c_str(), (unsigned long)query.size()))
{ {
Logger::udr_server().error("mysql_real_query failure!"); Logger::udr_server().error("mysql_real_query failure!SQL(%s)",query.c_str());
return; return;
} }
...@@ -143,9 +144,9 @@ void AuthenticationStatusDocumentApiImpl::query_authentication_status(const std: ...@@ -143,9 +144,9 @@ void AuthenticationStatusDocumentApiImpl::query_authentication_status(const std:
} }
else if(!strcmp("authType", field->name)) else if(!strcmp("authType", field->name))
{ {
AuthType authtype; // AuthType authtype;
nlohmann::json::parse(row[i]).get_to(authtype); // nlohmann::json::parse(row[i]).get_to(authtype);
authenticationstatus.setAuthType(authtype); authenticationstatus.setAuthType(row[i]);
} }
else if(!strcmp("servingNetworkName", field->name)) else if(!strcmp("servingNetworkName", field->name))
{ {
...@@ -163,12 +164,11 @@ void AuthenticationStatusDocumentApiImpl::query_authentication_status(const std: ...@@ -163,12 +164,11 @@ void AuthenticationStatusDocumentApiImpl::query_authentication_status(const std:
to_json(j,authenticationstatus); to_json(j,authenticationstatus);
response.send(Pistache::Http::Code::Ok, j.dump()); response.send(Pistache::Http::Code::Ok, j.dump());
std::string out = j.dump(); Logger::udr_server().debug("AuthenticationStatus GET - json:\n\"%s\"",j.dump().c_str());
Logger::udr_server().debug("AuthenticationStatus GET - json:\n\"%s\"",out.c_str());
} }
else else
{ {
Logger::udr_server().error("AuthenticationStatus no data!"); Logger::udr_server().error("AuthenticationStatus no data!SQL(%s)",query.c_str());
} }
mysql_free_result(res); mysql_free_result(res);
......
...@@ -23,6 +23,7 @@ AuthEvent::AuthEvent() ...@@ -23,6 +23,7 @@ AuthEvent::AuthEvent()
m_NfInstanceId = ""; m_NfInstanceId = "";
m_Success = false; m_Success = false;
m_TimeStamp = ""; m_TimeStamp = "";
m_AuthType = "";
m_ServingNetworkName = ""; m_ServingNetworkName = "";
m_AuthRemovalInd = false; m_AuthRemovalInd = false;
m_AuthRemovalIndIsSet = false; m_AuthRemovalIndIsSet = false;
...@@ -88,11 +89,11 @@ void AuthEvent::setTimeStamp(std::string const& value) ...@@ -88,11 +89,11 @@ void AuthEvent::setTimeStamp(std::string const& value)
{ {
m_TimeStamp = value; m_TimeStamp = value;
} }
AuthType AuthEvent::getAuthType() const std::string AuthEvent::getAuthType() const
{ {
return m_AuthType; return m_AuthType;
} }
void AuthEvent::setAuthType(AuthType const& value) void AuthEvent::setAuthType(std::string const& value)
{ {
m_AuthType = value; m_AuthType = value;
} }
......
...@@ -60,8 +60,8 @@ public: ...@@ -60,8 +60,8 @@ public:
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
AuthType getAuthType() const; std::string getAuthType() const;
void setAuthType(AuthType const& value); void setAuthType(std::string const& value);
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
...@@ -84,7 +84,7 @@ protected: ...@@ -84,7 +84,7 @@ protected:
std::string m_TimeStamp; std::string m_TimeStamp;
AuthType m_AuthType; std::string m_AuthType;
std::string m_ServingNetworkName; std::string m_ServingNetworkName;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment