|
|
@@ -492,197 +492,198 @@ struct UpdateWKTask : ITaskSp {
|
|
|
|
|
|
void Process()
|
|
|
{
|
|
|
-// LOG_FUNCTION();
|
|
|
-//
|
|
|
-//
|
|
|
-// if (m_fsm->GetmAccessAuthHost().IsNullOrEmpty())
|
|
|
-// {
|
|
|
-// LogWarn(Severity_Middle, Error_Unexpect, AccessAuthorization_UserErrorCode_AccessAuth_NULL, "UpdateWKTask:准入Url为空");
|
|
|
-// return;
|
|
|
-// }
|
|
|
-// CSystemStaticInfo si;
|
|
|
-// m_fsm->GetEntityBase()->GetFunction()->GetSystemStaticInfo(si);
|
|
|
-//
|
|
|
-//#ifdef WITH_CPPRESTSDK
|
|
|
-// struct UpdateWKReq
|
|
|
-// {
|
|
|
-// std::string terminalNo;
|
|
|
-// JSONCONVERT2OBJECT_MEMEBER_REGISTER(terminalNo)
|
|
|
-// } updateWKReq;
|
|
|
-//
|
|
|
-// struct UpdateWKAns
|
|
|
-// {
|
|
|
-// string tmk;
|
|
|
-// string tpk;
|
|
|
-// string edk;
|
|
|
-// string index;
|
|
|
-// JSONCONVERT2OBJECT_MEMEBER_REGISTER(tmk, tpk, edk, index)
|
|
|
-// } updateWKAns;
|
|
|
-//
|
|
|
-// updateWKReq.terminalNo = si.strTerminalID.GetData();
|
|
|
-//
|
|
|
-// HttpClientResponseResult result;
|
|
|
-// HttpClientRequestConfig config(HttpRequestMethod::POST, m_fsm->GetmAccessAuthHost().GetData());
|
|
|
-// config.SetChildUri("/api/wkupdate");
|
|
|
-//
|
|
|
-// SP::Module::Restful::FulfillRequestJsonBody(&config, updateWKReq);
|
|
|
-//
|
|
|
-// RestfulClient client = RestfulClient::getInstance();
|
|
|
-// config.PreDo();
|
|
|
-// DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("to Post with new restful....");
|
|
|
-// client.Do(&config, &result);
|
|
|
-// if (result.ResponseOK()) {
|
|
|
-// DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("UpdateWKTask Connect With Restful Success.");
|
|
|
-// SP::Module::Restful::CommResponseJson responseStatus;
|
|
|
-// SP::Module::Restful::GetStatusFromDebranchResponse(result.content, responseStatus);
|
|
|
-// if (!responseStatus.IsOperatedOK()) {
|
|
|
-// m_fsm->doWarnMsg(ERR_ACCESSAUTH_UPDATE_WK,
|
|
|
-// GetOutPutStr("%s%s%s%s", "UpdateWKTask", responseStatus.errorCode.c_str(), "message", responseStatus.errorMsg.c_str()).c_str());
|
|
|
-// return;
|
|
|
-// }
|
|
|
-// SP::Module::Restful::ExtractDataFromDebranchResponse(result.content, updateWKAns);
|
|
|
-// int len = 0;
|
|
|
-// char* tmp = Hex2Str(updateWKAns.tmk.c_str(), len);
|
|
|
-// int textLen = 2 * len;
|
|
|
-// BYTE* text = new BYTE[textLen];
|
|
|
-// memset(text, 0, textLen);
|
|
|
-// if (!m_fsm->DecryptWithSessionKey((BYTE*)tmp, len, text, textLen)) {
|
|
|
-// delete[] tmp;
|
|
|
-// delete[] text;
|
|
|
-// goto UpdateWKRetError;
|
|
|
-// }
|
|
|
-//
|
|
|
-// updateWKAns.tmk.assign((char*)text);
|
|
|
-// delete[] text;
|
|
|
-// delete tmp;
|
|
|
-//
|
|
|
-// DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("tmk=%s %d", updateWKAns.tmk.c_str(), updateWKAns.tmk.size());
|
|
|
-// DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("tpk=%s %d", updateWKAns.tpk.c_str(), updateWKAns.tpk.size());
|
|
|
-// DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("edk=%s %d", updateWKAns.edk.c_str(), updateWKAns.edk.size());
|
|
|
-// DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("index=%s %d", updateWKAns.index.c_str(), updateWKAns.index.size());
|
|
|
-//
|
|
|
-// DWORD rc = m_entity->LoadKeysToPinPadNew(updateWKAns.tmk, updateWKAns.tpk, updateWKAns.edk, updateWKAns.index);
|
|
|
-// if (rc == Error_Succeed) {
|
|
|
-// DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("UpdateWKTask LoadKeysToPinPadNew Success");
|
|
|
-// FSMEvent* pEvent = new FSMEvent(CAccessAuthFSM::Event_UpdateWKSucc);
|
|
|
-// m_fsm->PostEventFIFO(pEvent);
|
|
|
-// return;
|
|
|
-// } else {
|
|
|
-// DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("UpdateWKTask LoadKeysToPinPadNew error = %08X", rc);
|
|
|
-// }
|
|
|
-// } else {
|
|
|
-// std::string errDetail(result.WhatError());
|
|
|
-// if (errDetail.find("Error resolving address") != std::string::npos) {
|
|
|
-// std::string tmpDetail = SP::Module::Net::GetWWWInfoThroughDig(config.GetBaseUri());
|
|
|
-// if (!tmpDetail.empty()) {
|
|
|
-// SP::Utility::replaceInPlace(tmpDetail, "\n", "$$");
|
|
|
-// const int len = tmpDetail.length();
|
|
|
-// int pos = 0, times = 0;
|
|
|
-// const int each_size = 450;
|
|
|
-// std::vector<std::string> contents;
|
|
|
-// while (pos < len) {
|
|
|
-// const std::string elem = tmpDetail.substr(pos, (len - pos) > each_size ? each_size : std::string::npos);
|
|
|
-// pos = (++times) * each_size;
|
|
|
-// contents.push_back(elem);
|
|
|
-// LogWarn(Severity_Low, Error_Debug, ERROR_ACCESSAUTH_ACS_DIGINFO,
|
|
|
-// CSimpleStringA::Format("[%d]%s", times, elem.c_str()));
|
|
|
-// }
|
|
|
-// } else {
|
|
|
-// LogWarn(Severity_Low, Error_Debug, ERROR_ACCESSAUTH_ACS_DIGINFO, errDetail.c_str());
|
|
|
-// }
|
|
|
-// }
|
|
|
-// m_fsm->doWarnMsg(ERROR_ACCESSAUTH_CONNECT_ACS,
|
|
|
-// GetOutPutStr("%s%s", "连接总行ACS准入服务失败(UpdateWKTask).", result.WhatError().c_str()).c_str(), true);
|
|
|
-// DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("UpdateWKTask Connect Failed.");
|
|
|
-// }
|
|
|
-//
|
|
|
-// UpdateWKRetError:
|
|
|
-//
|
|
|
-// FSMEvent* pEvent = new FSMEvent(CAccessAuthFSM::Event_UpdateWKFail);
|
|
|
-// m_fsm->PostEventFIFO(pEvent);
|
|
|
-//#else
|
|
|
-//
|
|
|
-// IHttpFunc* client;
|
|
|
-// client = create_http(m_fsm->HttpsLogCallBack);
|
|
|
-// CAccessAuthUpdateWKReq updateWKReq(si.strTerminalID.GetData());
|
|
|
-// CAccessAuthUpdateWKRet updateWKRet;
|
|
|
-// updateWKReq.m_url = m_fsm->GetmAccessAuthHost();
|
|
|
-// updateWKReq.m_url += "/api/wkupdate";
|
|
|
-// bool ret = client->Post(updateWKReq, updateWKRet);
|
|
|
-//
|
|
|
-// DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("code=%d", updateWKRet.m_sysCode);
|
|
|
-// if (ret) {
|
|
|
-// DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("UpdateWKTask Connect Success.");
|
|
|
-// if (updateWKRet.m_userCode.compare(ACS_SUCCESS)) {
|
|
|
-// std::string errStr = SP::Utility::GBK2UTF8(updateWKRet.m_errMsg);
|
|
|
-// m_fsm->doWarnMsg(ERR_ACCESSAUTH_UPDATE_WK,
|
|
|
-// GetOutPutStr("%s%s%s%s", "UpdateWKTask", updateWKRet.m_userCode.c_str(), "message", errStr.c_str()).c_str());
|
|
|
-// SAFE_DELETE_HTTPCLIENT(client);
|
|
|
-// return;
|
|
|
-// }
|
|
|
-// int len = 0;
|
|
|
-// char* tmp = Hex2Str(updateWKRet.data.TMK.c_str(), len);
|
|
|
-// int textLen = 2 * len;
|
|
|
-// BYTE* text = new BYTE[textLen];
|
|
|
-// memset(text, 0, textLen);
|
|
|
-// if (!m_fsm->DecryptWithSessionKey((BYTE*)tmp, len, text, textLen)) {
|
|
|
-// delete[] tmp;
|
|
|
-// delete[] text;
|
|
|
-// goto UpdateWKRetError;
|
|
|
-// }
|
|
|
-// updateWKRet.data.TMK.assign((char*)text);
|
|
|
-// delete[] text;
|
|
|
-// delete tmp;
|
|
|
-//
|
|
|
-// DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("tmk=%s %d", updateWKRet.data.TMK.c_str(), updateWKRet.data.TMK.size());
|
|
|
-// DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("tpk=%s %d", updateWKRet.data.TPK.c_str(), updateWKRet.data.TPK.size());
|
|
|
-// DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("edk=%s %d", updateWKRet.data.EDK.c_str(), updateWKRet.data.EDK.size());
|
|
|
-// DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("index=%s %d", updateWKRet.data.index.c_str(), updateWKRet.data.index.size());
|
|
|
-//
|
|
|
-// DWORD rc = m_entity->LoadKeysToPinPadNew(updateWKRet.data.TMK, updateWKRet.data.TPK,
|
|
|
-// updateWKRet.data.EDK, updateWKRet.data.index);
|
|
|
-// if (rc == Error_Succeed) {
|
|
|
-// DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("UpdateWKTask LoadKeysToPinPadNew Success");
|
|
|
-// FSMEvent* pEvent = new FSMEvent(CAccessAuthFSM::Event_UpdateWKSucc);
|
|
|
-// m_fsm->PostEventFIFO(pEvent);
|
|
|
-// SAFE_DELETE_HTTPCLIENT(client);
|
|
|
-// return;
|
|
|
-// } else {
|
|
|
-// DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("UpdateWKTask LoadKeysToPinPadNew error = %08X", rc);
|
|
|
-// }
|
|
|
-// } else {
|
|
|
-// std::string errDetail(result.WhatError());
|
|
|
-// if (errDetail.find("Error resolving address") != std::string::npos) {
|
|
|
-// std::string tmpDetail = SP::Module::Net::GetWWWInfoThroughDig(config.GetBaseUri());
|
|
|
-// if (!tmpDetail.empty()) {
|
|
|
-// SP::Utility::replaceInPlace(tmpDetail, "\n", "$$");
|
|
|
-// const int len = tmpDetail.length();
|
|
|
-// int pos = 0, times = 0;
|
|
|
-// const int each_size = 450;
|
|
|
-// std::vector<std::string> contents;
|
|
|
-// while (pos < len) {
|
|
|
-// const std::string elem = tmpDetail.substr(pos, (len - pos) > each_size ? each_size : std::string::npos);
|
|
|
-// pos = (++times) * each_size;
|
|
|
-// contents.push_back(elem);
|
|
|
-// LogWarn(Severity_Low, Error_Debug, ERROR_ACCESSAUTH_ACS_DIGINFO,
|
|
|
-// CSimpleStringA::Format("[%d]%s", times, elem.c_str()));
|
|
|
-// }
|
|
|
-// } else {
|
|
|
-// LogWarn(Severity_Low, Error_Debug, ERROR_ACCESSAUTH_ACS_DIGINFO, errDetail.c_str());
|
|
|
-// }
|
|
|
-// }
|
|
|
-// m_fsm->doWarnMsg(ERROR_ACCESSAUTH_CONNECT_ACS,
|
|
|
-// GetOutPutStr("%s%d", "连接总行ACS准入服务失败(StageReport).", updateWKRet.m_sysCode).c_str());
|
|
|
-// DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("UpdateWKTask Connect Failed.");
|
|
|
-// }
|
|
|
-//
|
|
|
-// UpdateWKRetError:
|
|
|
-//
|
|
|
-// FSMEvent* pEvent = new FSMEvent(CAccessAuthFSM::Event_UpdateWKFail);
|
|
|
-// m_fsm->PostEventFIFO(pEvent);
|
|
|
-// SAFE_DELETE_HTTPCLIENT(client);
|
|
|
-//
|
|
|
-//#endif //WITH_CPPRESTSDK
|
|
|
+ LOG_FUNCTION();
|
|
|
+
|
|
|
+
|
|
|
+ if (m_fsm->GetmAccessAuthHost().IsNullOrEmpty())
|
|
|
+ {
|
|
|
+ LogWarn(Severity_Middle, Error_Unexpect, AccessAuthorization_UserErrorCode_AccessAuth_NULL, "UpdateWKTask:准入Url为空");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ CSystemStaticInfo si;
|
|
|
+ m_fsm->GetEntityBase()->GetFunction()->GetSystemStaticInfo(si);
|
|
|
+
|
|
|
+#ifdef WITH_CPPRESTSDK
|
|
|
+ struct UpdateWKReq
|
|
|
+ {
|
|
|
+ std::string terminalNo;
|
|
|
+ JSONCONVERT2OBJECT_MEMEBER_REGISTER(terminalNo)
|
|
|
+ } updateWKReq;
|
|
|
+
|
|
|
+ struct UpdateWKAns
|
|
|
+ {
|
|
|
+ string tmk;
|
|
|
+ string tpk;
|
|
|
+ string edk;
|
|
|
+ string index;
|
|
|
+ JSONCONVERT2OBJECT_MEMEBER_REGISTER(tmk, tpk, edk, index)
|
|
|
+ } updateWKAns;
|
|
|
+
|
|
|
+ updateWKReq.terminalNo = si.strTerminalID.GetData();
|
|
|
+
|
|
|
+ HttpClientResponseResult result;
|
|
|
+ HttpClientRequestConfig config(HttpRequestMethod::POST, m_fsm->GetmAccessAuthHost().GetData());
|
|
|
+ config.SetChildUri("/api/wkupdate");
|
|
|
+
|
|
|
+ SP::Module::Restful::FulfillRequestJsonBody(&config, updateWKReq);
|
|
|
+
|
|
|
+ RestfulClient client = RestfulClient::getInstance();
|
|
|
+ config.PreDo();
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("to Post with new restful....");
|
|
|
+ client.Do(&config, &result);
|
|
|
+ if (result.ResponseOK()) {
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("UpdateWKTask Connect With Restful Success.");
|
|
|
+ SP::Module::Restful::CommResponseJson responseStatus;
|
|
|
+ SP::Module::Restful::GetStatusFromDebranchResponse(result.content, responseStatus);
|
|
|
+ if (!responseStatus.IsOperatedOK()) {
|
|
|
+ m_fsm->doWarnMsg(ERR_ACCESSAUTH_UPDATE_WK,
|
|
|
+ GetOutPutStr("%s%s%s%s", "UpdateWKTask", responseStatus.errorCode.c_str(), "message", responseStatus.errorMsg.c_str()).c_str());
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ SP::Module::Restful::ExtractDataFromDebranchResponse(result.content, updateWKAns);
|
|
|
+ int len = 0;
|
|
|
+ char* tmp = Hex2Str(updateWKAns.tmk.c_str(), len);
|
|
|
+ int textLen = 2 * len;
|
|
|
+ BYTE* text = new BYTE[textLen];
|
|
|
+ memset(text, 0, textLen);
|
|
|
+ if (!m_fsm->DecryptWithSessionKey((BYTE*)tmp, len, text, textLen)) {
|
|
|
+ delete[] tmp;
|
|
|
+ delete[] text;
|
|
|
+ goto UpdateWKRetError;
|
|
|
+ }
|
|
|
+
|
|
|
+ updateWKAns.tmk.assign((char*)text);
|
|
|
+ delete[] text;
|
|
|
+ delete tmp;
|
|
|
+
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("tmk=%s %d", updateWKAns.tmk.c_str(), updateWKAns.tmk.size());
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("tpk=%s %d", updateWKAns.tpk.c_str(), updateWKAns.tpk.size());
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("edk=%s %d", updateWKAns.edk.c_str(), updateWKAns.edk.size());
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("index=%s %d", updateWKAns.index.c_str(), updateWKAns.index.size());
|
|
|
+
|
|
|
+ DWORD rc = m_entity->LoadKeysToPinPadNew(updateWKAns.tmk, updateWKAns.tpk, updateWKAns.edk, updateWKAns.index);
|
|
|
+ if (rc == Error_Succeed) {
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("UpdateWKTask LoadKeysToPinPadNew Success");
|
|
|
+ /*FSMEvent* pEvent = new FSMEvent(CAccessAuthFSM::Event_UpdateWKSucc);
|
|
|
+ m_fsm->PostEventFIFO(pEvent);*/
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("UpdateWKTask LoadKeysToPinPadNew error = %08X", rc);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ std::string errDetail(result.WhatError());
|
|
|
+ if (errDetail.find("Error resolving address") != std::string::npos) {
|
|
|
+ std::string tmpDetail = SP::Module::Net::GetWWWInfoThroughDig(config.GetBaseUri());
|
|
|
+ if (!tmpDetail.empty()) {
|
|
|
+ SP::Utility::replaceInPlace(tmpDetail, "\n", "$$");
|
|
|
+ const int len = tmpDetail.length();
|
|
|
+ int pos = 0, times = 0;
|
|
|
+ const int each_size = 450;
|
|
|
+ std::vector<std::string> contents;
|
|
|
+ while (pos < len) {
|
|
|
+ const std::string elem = tmpDetail.substr(pos, (len - pos) > each_size ? each_size : std::string::npos);
|
|
|
+ pos = (++times) * each_size;
|
|
|
+ contents.push_back(elem);
|
|
|
+ LogWarn(Severity_Low, Error_Debug, ERROR_ACCESSAUTH_ACS_DIGINFO,
|
|
|
+ CSimpleStringA::Format("[%d]%s", times, elem.c_str()));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ LogWarn(Severity_Low, Error_Debug, ERROR_ACCESSAUTH_ACS_DIGINFO, errDetail.c_str());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ m_fsm->doWarnMsg(ERROR_ACCESSAUTH_CONNECT_ACS,
|
|
|
+ GetOutPutStr("%s%s", "连接总行ACS准入服务失败(UpdateWKTask).", result.WhatError().c_str()).c_str(), true);
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("UpdateWKTask Connect Failed.");
|
|
|
+ }
|
|
|
+
|
|
|
+ UpdateWKRetError:
|
|
|
+
|
|
|
+ //FSMEvent* pEvent = new FSMEvent(CAccessAuthFSM::Event_UpdateWKFail);
|
|
|
+ FSMEvent* pEvent = new FSMEvent(CAccessAuthFSM::Event_ReqTokenCancel);
|
|
|
+ m_fsm->PostEventFIFO(pEvent);
|
|
|
+#else
|
|
|
+
|
|
|
+ IHttpFunc* client;
|
|
|
+ client = create_http(m_fsm->HttpsLogCallBack);
|
|
|
+ CAccessAuthUpdateWKReq updateWKReq(si.strTerminalID.GetData());
|
|
|
+ CAccessAuthUpdateWKRet updateWKRet;
|
|
|
+ updateWKReq.m_url = m_fsm->GetmAccessAuthHost();
|
|
|
+ updateWKReq.m_url += "/api/wkupdate";
|
|
|
+ bool ret = client->Post(updateWKReq, updateWKRet);
|
|
|
+
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("code=%d", updateWKRet.m_sysCode);
|
|
|
+ if (ret) {
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("UpdateWKTask Connect Success.");
|
|
|
+ if (updateWKRet.m_userCode.compare(ACS_SUCCESS)) {
|
|
|
+ std::string errStr = SP::Utility::GBK2UTF8(updateWKRet.m_errMsg);
|
|
|
+ m_fsm->doWarnMsg(ERR_ACCESSAUTH_UPDATE_WK,
|
|
|
+ GetOutPutStr("%s%s%s%s", "UpdateWKTask", updateWKRet.m_userCode.c_str(), "message", errStr.c_str()).c_str());
|
|
|
+ SAFE_DELETE_HTTPCLIENT(client);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ int len = 0;
|
|
|
+ char* tmp = Hex2Str(updateWKRet.data.TMK.c_str(), len);
|
|
|
+ int textLen = 2 * len;
|
|
|
+ BYTE* text = new BYTE[textLen];
|
|
|
+ memset(text, 0, textLen);
|
|
|
+ if (!m_fsm->DecryptWithSessionKey((BYTE*)tmp, len, text, textLen)) {
|
|
|
+ delete[] tmp;
|
|
|
+ delete[] text;
|
|
|
+ goto UpdateWKRetError;
|
|
|
+ }
|
|
|
+ updateWKRet.data.TMK.assign((char*)text);
|
|
|
+ delete[] text;
|
|
|
+ delete tmp;
|
|
|
+
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("tmk=%s %d", updateWKRet.data.TMK.c_str(), updateWKRet.data.TMK.size());
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("tpk=%s %d", updateWKRet.data.TPK.c_str(), updateWKRet.data.TPK.size());
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("edk=%s %d", updateWKRet.data.EDK.c_str(), updateWKRet.data.EDK.size());
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("index=%s %d", updateWKRet.data.index.c_str(), updateWKRet.data.index.size());
|
|
|
+
|
|
|
+ DWORD rc = m_entity->LoadKeysToPinPadNew(updateWKRet.data.TMK, updateWKRet.data.TPK,
|
|
|
+ updateWKRet.data.EDK, updateWKRet.data.index);
|
|
|
+ if (rc == Error_Succeed) {
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("UpdateWKTask LoadKeysToPinPadNew Success");
|
|
|
+ FSMEvent* pEvent = new FSMEvent(CAccessAuthFSM::Event_UpdateWKSucc);
|
|
|
+ m_fsm->PostEventFIFO(pEvent);
|
|
|
+ SAFE_DELETE_HTTPCLIENT(client);
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("UpdateWKTask LoadKeysToPinPadNew error = %08X", rc);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ std::string errDetail(result.WhatError());
|
|
|
+ if (errDetail.find("Error resolving address") != std::string::npos) {
|
|
|
+ std::string tmpDetail = SP::Module::Net::GetWWWInfoThroughDig(config.GetBaseUri());
|
|
|
+ if (!tmpDetail.empty()) {
|
|
|
+ SP::Utility::replaceInPlace(tmpDetail, "\n", "$$");
|
|
|
+ const int len = tmpDetail.length();
|
|
|
+ int pos = 0, times = 0;
|
|
|
+ const int each_size = 450;
|
|
|
+ std::vector<std::string> contents;
|
|
|
+ while (pos < len) {
|
|
|
+ const std::string elem = tmpDetail.substr(pos, (len - pos) > each_size ? each_size : std::string::npos);
|
|
|
+ pos = (++times) * each_size;
|
|
|
+ contents.push_back(elem);
|
|
|
+ LogWarn(Severity_Low, Error_Debug, ERROR_ACCESSAUTH_ACS_DIGINFO,
|
|
|
+ CSimpleStringA::Format("[%d]%s", times, elem.c_str()));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ LogWarn(Severity_Low, Error_Debug, ERROR_ACCESSAUTH_ACS_DIGINFO, errDetail.c_str());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ m_fsm->doWarnMsg(ERROR_ACCESSAUTH_CONNECT_ACS,
|
|
|
+ GetOutPutStr("%s%d", "连接总行ACS准入服务失败(StageReport).", updateWKRet.m_sysCode).c_str());
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("UpdateWKTask Connect Failed.");
|
|
|
+ }
|
|
|
+
|
|
|
+ UpdateWKRetError:
|
|
|
+
|
|
|
+ FSMEvent* pEvent = new FSMEvent(CAccessAuthFSM::Event_UpdateWKFail);
|
|
|
+ m_fsm->PostEventFIFO(pEvent);
|
|
|
+ SAFE_DELETE_HTTPCLIENT(client);
|
|
|
+
|
|
|
+#endif //WITH_CPPRESTSDK
|
|
|
|
|
|
}
|
|
|
};
|
|
|
@@ -1215,9 +1216,6 @@ void CAccessAuthFSM::s1_on_entry()
|
|
|
// return;
|
|
|
//}*/
|
|
|
|
|
|
- //LogWarn(Severity_Low, Error_Unexpect, AccessAuthorization_UserErrorCode_ACS_TURE, "Force gray say:come,come,come to ACS.");
|
|
|
- //m_bAccessACS = true;
|
|
|
-
|
|
|
CSimpleStringA strEntryStatus = GetEntryPermitSysVar();
|
|
|
if (strEntryStatus.Compare("L") == 0) {
|
|
|
PostEventFIFO(new FSMEvent(Event_AccessAuthSucc));
|
|
|
@@ -1626,13 +1624,20 @@ if (pEvent->iEvt == Event_ConnectionOK) {
|
|
|
CSmartPointer<TimeSynTask> timeSynTask = new TimeSynTask(this);
|
|
|
GetEntityBase()->GetFunction()->PostThreadPoolTask(timeSynTask.GetRawPointer());
|
|
|
|
|
|
+ /*CSmartPointer<LockStateTask> lockStateTask = new LockStateTask(this);
|
|
|
+ GetEntityBase()->GetFunction()->PostThreadPoolTask(lockStateTask.GetRawPointer());*/
|
|
|
+
|
|
|
}
|
|
|
else if (pEvent->iEvt == Event_EndSyncTime) {
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("s2_on_event")("get token now");
|
|
|
pEvent->SetHandled();
|
|
|
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Event_EndSyncTime");
|
|
|
CSmartPointer<GetTokenTask> getTokenTask = new GetTokenTask(this, (CAccessAuthEntity*)m_pEntity);
|
|
|
GetEntityBase()->GetFunction()->PostThreadPoolTask(getTokenTask.GetRawPointer());
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("UpdateWKTask DDDDD");
|
|
|
+
|
|
|
+
|
|
|
return 0;
|
|
|
|
|
|
}
|