Ver Fonte

Merge branch 'uos_WKcheck_cjl_1017' into vtmloader0928

陈纪林80310970 há 1 ano atrás
pai
commit
54aec23ea4

+ 150 - 91
Module/mod_accessauth/AccessAuthFSM.cpp

@@ -18,14 +18,16 @@
 #include <Winsock2.h>
 #include <algorithm>
 #pragma comment(lib, "IPHLPAPI.lib")
-
-
+#include "..\mod_pinpad\PinPad_client_g.h"
+using namespace PinPad;
 #define ALLOW_MULTI_NETWORKD_CARDS
 
 #else
 #include "CommEntityRestful.hpp"
 #include "SpUtility.h"
 #include "comm.h"
+#include "PinPad_client_g.h"
+using namespace PinPad;
 #endif // RVC_OS_WIN
 
 int HexBuf2StrBuf(PBYTE hexBuf, char** strBuf, DWORD len)
@@ -308,11 +310,41 @@ struct UpdateWKTask : ITaskSp
 		CAccessAuthUpdateWKReq updateWKReq;
 		updateWKReq.terminalNo = si.strTerminalID.GetData();
 		auto tmkpair = m_entity->GenerateTmkToKMC();//first是加密的,seconde是没加密的
-
 		updateWKReq.encRandom = tmkpair.first;
+
+		PinPadService_ClientBase* pPinPad = new PinPadService_ClientBase(this->m_entity);
+		auto errRc = pPinPad->Connect();
+		if (errRc == Error_Succeed)
+		{
+			PinPadService_GetCheckCode_Req req = {};
+			PinPadService_GetCheckCode_Ans ans = {};
+
+			req.mSN.Init(1);
+			req.wSN.Init(1);
+			req.mSN[0] = 1;
+			req.wSN[0] = 0;
+			errRc = (*pPinPad)(EntityResource::getLink().upgradeLink())->GetCheckCode(req, ans, 10000);
+			if (errRc == Error_Succeed)
+			{
+				updateWKReq.tpkKeyCheck = ans.checkcode[0].GetData();
+				updateWKReq.keyIndex = ans.index[0].GetData();
+				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("UpdateWKTask")("Get keyChek && keyIndex suc.");
+			}
+			else
+			{
+				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("UpdateWKTask")("Get keyChek && keyIndex failed.");
+			}
+
+			pPinPad->GetFunction()->CloseSession();
+		}
+		else
+		{
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("UpdateWKTask")("connect to pinpad failed.error code:%d", errRc);
+		}
+
 		CAccessAuthUpdateWKRet updateWKRet;
 		updateWKReq.m_url = m_fsm->GetmAccessAuthHost();
-		updateWKReq.m_url += "/api/v3/wkupdate";
+		updateWKReq.m_url += "/api/v5/wkupdate";
 		long beg = GetTickCount();
 		bool ret = client->Post(updateWKReq, updateWKRet);
 		long end = GetTickCount();
@@ -333,7 +365,7 @@ struct UpdateWKTask : ITaskSp
 
 
 			ErrorCodeEnum eLoadErr = m_entity->LoadKeysToPinPadACS(tmkpair.second, updateWKRet.tpk,
-				updateWKRet.edk, updateWKRet.index);
+				updateWKRet.edk, updateWKRet.keyIndex);
 			if (eLoadErr == Error_Succeed) {
 				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("LoadKeysToPinPadNew")
 					("UpdateWKTask LoadKeysToPinPadNew Success");
@@ -362,9 +394,12 @@ struct UpdateWKTask : ITaskSp
 #else
 		struct UpdateWKReq
 		{
-			std::string terminalNo;
-			std::string encRandom;
-			JSONCONVERT2OBJECT_MEMEBER_REGISTER(terminalNo, encRandom)
+			string terminalNo;
+			string encRandom;
+			string tpkKeyCheck; //tpk密钥校验值
+			string edkKeyCheck; //edk密钥校验值
+			string keyIndex; //密钥序号
+			JSONCONVERT2OBJECT_MEMEBER_REGISTER(terminalNo, encRandom, tpkKeyCheck, edkKeyCheck, keyIndex)
 		} updateWKReq;
 
 		struct UpdateWKAns
@@ -372,17 +407,49 @@ struct UpdateWKTask : ITaskSp
 			string tmk;
 			string tpk;
 			string edk;
-			string index;
-			JSONCONVERT2OBJECT_MEMEBER_REGISTER(tmk, tpk, edk, index)
+			string tpkKeyCheck; //密钥校验值
+			string edkKeyCheck; //edk密钥校验值
+			string keyIndex; //密钥序号
+			JSONCONVERT2OBJECT_MEMEBER_REGISTER(tmk, tpk, edk, tpkKeyCheck, edkKeyCheck, keyIndex)
 		} updateWKAns;
 
 		updateWKReq.terminalNo = si.strTerminalID.GetData();
 		auto tmkpair = m_entity->GenerateTmkToKMC();//first是加密的,seconde是没加密的
 		updateWKReq.encRandom = tmkpair.first;
 
+		PinPadService_ClientBase* pPinPad = new PinPadService_ClientBase(this->m_entity);
+		auto errRc = pPinPad->Connect();
+		if (errRc == Error_Succeed)
+		{
+			PinPadService_GetCheckCode_Req req = {};
+			PinPadService_GetCheckCode_Ans ans = {};
+
+			req.mSN.Init(1);
+			req.wSN.Init(1);
+			req.mSN[0] = 1;
+			req.wSN[0] = 0;
+			errRc = (*pPinPad)(EntityResource::getLink().upgradeLink())->GetCheckCode(req, ans, 10000);
+			if (errRc == Error_Succeed)
+			{
+				updateWKReq.tpkKeyCheck = ans.checkcode[0].GetData();
+				updateWKReq.keyIndex = ans.index[0].GetData();
+				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("UpdateWKTask")("Get keyChek && keyIndex suc.");
+			}
+			else
+			{
+				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("UpdateWKTask")("Get keyChek && keyIndex failed.");
+			}
+
+			pPinPad->GetFunction()->CloseSession();
+		}
+		else
+		{
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("UpdateWKTask")("connect to pinpad failed.error code:%d", errRc);
+		}
+
 		HttpClientResponseResult result;
 		HttpClientRequestConfig config(HttpRequestMethod::POST, m_fsm->GetmAccessAuthHost().GetData());
-		config.SetChildUri("/api/v3/wkupdate");
+		config.SetChildUri("/api/v5/wkupdate");
 
 		SP::Module::Restful::FulfillRequestJsonBody(&config, updateWKReq);
 
@@ -407,9 +474,11 @@ struct UpdateWKTask : ITaskSp
 			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());
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("tpkKeyCheck=%s %d", updateWKAns.tpkKeyCheck.c_str(), updateWKAns.tpkKeyCheck.size());
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("edkKeyCheck=%s %d", updateWKAns.edkKeyCheck.c_str(), updateWKAns.edkKeyCheck.size());
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("index=%s %d", updateWKAns.keyIndex.c_str(), updateWKAns.keyIndex.size());
 
-			DWORD rc = m_entity->LoadKeysToPinPadACS(tmkpair.second, updateWKAns.tpk, updateWKAns.edk, updateWKAns.index);
+			DWORD rc = m_entity->LoadKeysToPinPadACS(tmkpair.second, updateWKAns.tpk, updateWKAns.edk, updateWKAns.keyIndex);
 			if (rc == Error_Succeed) {
 				DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("UpdateWKTask LoadKeysToPinPadNew Success");
 				/*FSMEvent* pEvent = new FSMEvent(CAccessAuthFSM::Event_UpdateWKSucc);
@@ -1524,83 +1593,73 @@ void CAccessAuthFSM::AuthLogWarn(const T& ret, const string& url, const string&
 
 void CAccessAuthFSM::GetNetMsg(SpReqAnsContext<AccessAuthService_GetNetMsg_Req, AccessAuthService_GetNetMsg_Ans>::Pointer& ctx)
 {
-//	CSimpleStringA tmp;
-//#ifdef RVC_OS_WIN
-//	ErrorCodeEnum errCode = GetDNS(tmp);
-//	Dbg("网卡状态:%d, 网卡信息为:%s.", errCode, tmp.GetData());
-//	ctx->Ans.netMsg = tmp;
-//	if (errCode == Error_Succeed)
-//	{
-//		ctx->Ans.netStatus = 1; //成功
-//	}
-//	else
-//	{
-//		ctx->Ans.netStatus = 0; //失败
-//	}
-//#else
-//	ErrorCodeEnum ec = Error_Succeed;
-//	int netType = 0; //默认未知
-//
-//	CSimpleStringA tmpVendor(""), tmpDevSN(""), tmpDLLVersion("");
-//	GetEntityBase()->GetFunction()->GetSysVar("FWBVendor", tmpVendor);
-//	GetEntityBase()->GetFunction()->GetSysVar("FWBDevSN", tmpDevSN);
-//	GetEntityBase()->GetFunction()->GetSysVar("FWBVersion", tmpDLLVersion);
-//
-//
-//	if (tmpDLLVersion.GetLength() < 2)
-//		tmpDLLVersion = "8.1";
-//	if (tmpDevSN.GetLength() > 12 && tmpDevSN.IndexOf("FWB") > 2)
-//	{
-//		Dbg("This is fwb device.");
-//	}
-//	else
-//	{
-//		int i = 0;
-//		int sockfd;
-//		struct ifconf ifconf;
-//		struct ifreq* ifreq;
-//		char buf[1024];
-//
-//		//初始化ifconf
-//		ifconf.ifc_len = 1024;
-//		ifconf.ifc_buf = buf;
-//
-//		if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
-//		{
-//			perror("socket error");
-//			exit(1);
-//		}
-//
-//		//获取所有接口信息
-//		ioctl(sockfd, SIOCGIFCONF, &ifconf);
-//
-//		//逐个获取Ip地址
-//		int size = ifconf.ifc_len / sizeof(struct ifreq);
-//		ifreq = (struct ifreq*)buf;
-//		string netName(ifreq->ifr_name);
-//
-//		if (size == 1 && netName == "lo") //只有逻辑地址 -- 网线被拔出
-//		{
-//			netType = 0;
-//			tmp = "无网络";
-//		}
-//		else
-//		{
-//			for (i = size; i > 0; i--)
-//			{
-//				string netName(ifreq->ifr_name); //有其他网卡 -- 有线
-//				if (netName != "lo")
-//				{
-//					netType = 1;
-//					tmp = "网络已连接";
-//				}
-//				ifreq++;
-//			}
-//		}
-//
-//		ctx->Ans.netStatus = netType;
-//	}
-//	ctx->Ans.netMsg = tmp;
-//#endif // RVC_OS_WIN
+	CSimpleStringA tmp;
+#ifdef RVC_OS_WIN
+	ctx->Ans.netStatus = 1; //成功
+#else
+	ErrorCodeEnum ec = Error_Succeed;
+	int netType = 0; //默认未知
+
+	CSimpleStringA tmpVendor(""), tmpDevSN(""), tmpDLLVersion("");
+	GetEntityBase()->GetFunction()->GetSysVar("FWBVendor", tmpVendor);
+	GetEntityBase()->GetFunction()->GetSysVar("FWBDevSN", tmpDevSN);
+	GetEntityBase()->GetFunction()->GetSysVar("FWBVersion", tmpDLLVersion);
+
+
+	if (tmpDLLVersion.GetLength() < 2)
+		tmpDLLVersion = "8.1";
+	if (tmpDevSN.GetLength() > 12 && tmpDevSN.IndexOf("FWB") > 2)
+	{
+		Dbg("This is fwb device.");
+	}
+	else
+	{
+		int i = 0;
+		int sockfd;
+		struct ifconf ifconf;
+		struct ifreq* ifreq;
+		char buf[1024];
+
+		//初始化ifconf
+		ifconf.ifc_len = 1024;
+		ifconf.ifc_buf = buf;
+
+		if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
+		{
+			perror("socket error");
+			exit(1);
+		}
+
+		//获取所有接口信息
+		ioctl(sockfd, SIOCGIFCONF, &ifconf);
+
+		//逐个获取Ip地址
+		int size = ifconf.ifc_len / sizeof(struct ifreq);
+		ifreq = (struct ifreq*)buf;
+		string netName(ifreq->ifr_name);
+
+		if (size == 1 && netName == "lo") //只有逻辑地址 -- 网线被拔出
+		{
+			netType = 0;
+			tmp = "无网络";
+		}
+		else
+		{
+			for (i = size; i > 0; i--)
+			{
+				string netName(ifreq->ifr_name); //有其他网卡 -- 有线
+				if (netName != "lo")
+				{
+					netType = 1;
+					tmp = "网络已连接";
+				}
+				ifreq++;
+			}
+		}
+
+		ctx->Ans.netStatus = netType;
+	}
+	ctx->Ans.netMsg = tmp;
+#endif // RVC_OS_WIN
 	ctx->Answer(Error_Succeed);
 }

+ 33 - 6
Module/mod_accessauth/AccessAuthFSM.h

@@ -67,10 +67,16 @@ typedef struct CSessionkeySynRet : CHTTPRet {
 typedef struct CAccessAuthUpdateWKReq : CHTTPReq {
 	string terminalNo;
 	string encRandom;
+	string tpkKeyCheck; //tpk密钥校验值
+	string edkKeyCheck; //edk密钥校验值
+	string keyIndex; //密钥序号
 	string ToJson() {
 		Json::Value value;
 		value[REFLECTION(terminalNo)] = terminalNo;
 		value[REFLECTION(encRandom)] = encRandom;
+		value[REFLECTION(tpkKeyCheck)] = tpkKeyCheck;
+		value[REFLECTION(edkKeyCheck)] = edkKeyCheck;
+		value[REFLECTION(keyIndex)] = keyIndex;
 		Json::FastWriter writer;
 		string strData = writer.write(value);
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("CAccessAuthUpdateWKReq")
@@ -83,7 +89,9 @@ typedef struct CAccessAuthUpdateWKReq : CHTTPReq {
 typedef struct CAccessAuthUpdateWKRet : CHTTPRet {
 	string tpk;
 	string edk;
-	string index;
+	string tpkKeyCheck; //密钥校验值
+	string edkKeyCheck; //edk密钥校验值
+	string keyIndex; //密钥序号
 
 	bool Parse(string strData) {
 		Json::Value root;
@@ -92,7 +100,9 @@ typedef struct CAccessAuthUpdateWKRet : CHTTPRet {
 
 		tpk = root["data"][REFLECTION(tpk)].asString();
 		edk = root["data"][REFLECTION(edk)].asString();
-		index = root["data"][REFLECTION(index)].asString();
+		tpkKeyCheck = root["data"][REFLECTION(tpkKeyCheck)].asString();
+		edkKeyCheck = root["data"][REFLECTION(edkKeyCheck)].asString();
+		keyIndex = root["data"][REFLECTION(keyIndex)].asString();
 
 		return true;
 	}
@@ -237,6 +247,9 @@ typedef struct CInitlizerMKReq : CHTTPReq {
 	string auth;//预留鉴权
 	int loginWay;//1表示错误页发起,需要传入登录密码;0表示用户桌面发起,不需要传入登录密码
 	string encRandom; //tmk pk加密的随机密钥
+	string tpkKeyCheck; //密钥校验值
+	string edkKeyCheck; //密钥校验值
+	string keyIndex; //密钥序号
 
 	string ToJson() {
 #ifdef RVC_OS_WIN
@@ -262,6 +275,9 @@ typedef struct CInitlizerMKReq : CHTTPReq {
 		value[REFLECTION(auth)] = auth;
 		value[REFLECTION(loginWay)] = loginWay;
 		value[REFLECTION(encRandom)] = encRandom;
+		value[REFLECTION(tpkKeyCheck)] = tpkKeyCheck;
+		value[REFLECTION(edkKeyCheck)] = edkKeyCheck;
+		value[REFLECTION(keyIndex)] = keyIndex;
 		Json::FastWriter writer;
 		string strData = writer.write(value);
 
@@ -291,6 +307,9 @@ typedef struct CInitlizerMKReq : CHTTPReq {
 		rvcJson.AddStringToObject(REFLECTION(auth), (char*)auth.c_str());
 		rvcJson.AddNumberToObject(REFLECTION(loginWay), loginWay);
 		rvcJson.AddStringToObject(REFLECTION(encRandom), (char*)encRandom.c_str());
+		rvcJson.AddStringToObject(REFLECTION(tpkKeyCheck), (char*)tpkKeyCheck.c_str());
+		rvcJson.AddStringToObject(REFLECTION(edkKeyCheck), (char*)edkKeyCheck.c_str());;
+		rvcJson.AddStringToObject(REFLECTION(keyIndex), (char*)keyIndex.c_str());
 		string ret;
 		char* tmp = rvcJson.GetJsonStr();
 		ret.assign(tmp);
@@ -306,7 +325,9 @@ typedef struct CInitlizerMKRet : CHTTPRet {
 #ifdef RVC_OS_WIN
 	string tpk;
 	string edk;
-	string index;
+	string tpkKeyCheck;
+	string edkKeyCheck;
+	string keyIndex;
 
 	bool Parse(string strData) {
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("CInitlizerMKRet")("ret=%s at CInitlizerMKRet", strData.c_str());
@@ -316,7 +337,9 @@ typedef struct CInitlizerMKRet : CHTTPRet {
 		reader.parse(strData, root, false);
 		tpk = root["data"][REFLECTION(tpk)].asString();
 		edk = root["data"][REFLECTION(edk)].asString();
-		index = root["data"][REFLECTION(index)].asString();
+		tpkKeyCheck = root["data"][REFLECTION(tpkKeyCheck)].asString();
+		edkKeyCheck = root["data"][REFLECTION(edkKeyCheck)].asString();
+		keyIndex = root["data"][REFLECTION(keyIndex)].asString();
 		return true;
 	}
 #else
@@ -324,7 +347,9 @@ typedef struct CInitlizerMKRet : CHTTPRet {
 		string TMK;
 		string TPK;
 		string EDK;
-		string index;
+		string tpkKeyCheck;
+		string edkKeyCheck;
+		string keyIndex;
 		string reserved;
 	} data;
 	bool Parse(string strData) {
@@ -336,7 +361,9 @@ typedef struct CInitlizerMKRet : CHTTPRet {
 		data.TMK = retJson->GetStringValue(REFLECTION(tmk));
 		data.TPK = retJson->GetStringValue(REFLECTION(tpk));
 		data.EDK = retJson->GetStringValue(REFLECTION(edk));
-		data.index = retJson->GetStringValue(REFLECTION(index));
+		data.tpkKeyCheck = retJson->GetStringValue(REFLECTION(tpkKeyCheck));
+		data.edkKeyCheck = retJson->GetStringValue(REFLECTION(edkKeyCheck));
+		data.keyIndex = retJson->GetStringValue(REFLECTION(keyIndex));
 		rvcJson.Destory();
 		retJson->Destory();
 		delete retJson;

+ 46 - 9
Module/mod_accessauth/mod_AccessAuth.cpp

@@ -53,7 +53,7 @@ struct InitializerInitMKTask : ITaskSp
 		auto tmkpair = m_entity->GenerateTmkToKMC();
 		initMKReq.encRandom = tmkpair.first;
 		initMKReq.m_url = m_entity->GetInitUrl();
-		initMKReq.m_url += "/api/v3/initmk";
+		initMKReq.m_url += "/api/v5/initmk";
 		long beg = GetTickCount();
 		bool ret = client->Post(initMKReq, initMKRet);
 		long end = GetTickCount();
@@ -67,7 +67,7 @@ struct InitializerInitMKTask : ITaskSp
 				return;
 			}
 			if (m_entity->HasPinPad()) {
-				if (m_entity->LoadKeysToPinPadACS(tmkpair.second, initMKRet.tpk, initMKRet.edk, initMKRet.index) == Error_Succeed)
+				if (m_entity->LoadKeysToPinPadACS(tmkpair.second, initMKRet.tpk, initMKRet.edk, initMKRet.keyIndex) == Error_Succeed)
 					m_entity->EndInitMK(Error_Succeed, "");
 				else
 					m_entity->EndInitMK(ERR_INITIALIZER_INIT_EXCEPTION, "加载秘钥到密码键盘失败");//,待完善细化错误码oiltest
@@ -108,10 +108,13 @@ struct InitializerInitMKTask : ITaskSp
 			string auth;//预留鉴权
 			int loginWay;//1表示错误页发起,需要传入登录密码;0表示用户桌面发起,不需要传入登录密码
 			string encRandom; //tmk pk加密的随机密钥
+			string tpkKeyCheck; //密钥校验值
+			string edkKeyCheck; //密钥校验值
+			string keyIndex; //密钥序号
 
 			JSONCONVERT2OBJECT_MEMEBER_REGISTER(enrolAddr, enrolGPS, installVersion, ip, machineModel, machineType,
 				padDeviceID, site, terminalNo, factory, modal, type, version, terminalCharacter, pinPadID, publicKey,
-				user, password, auth, loginWay, encRandom)
+				user, password, auth, loginWay, encRandom, tpkKeyCheck, edkKeyCheck, keyIndex)
 
 		} instanceReq;
 
@@ -135,23 +138,27 @@ struct InitializerInitMKTask : ITaskSp
 		instanceReq.password = initMKReq.password;
 		instanceReq.auth = initMKReq.auth;
 		instanceReq.loginWay = initMKReq.loginWay;
-
 		instanceReq.encRandom = tmkpair.first;
+		instanceReq.tpkKeyCheck = initMKReq.tpkKeyCheck;
+		instanceReq.edkKeyCheck = initMKReq.edkKeyCheck;
+		instanceReq.keyIndex = initMKReq.keyIndex;
 
 		struct InstanceAnsJson
 		{
 			string TMK;
 			string TPK;
 			string EDK;
-			string index;
+			string tpkKeyCheck;
+			string edkKeyCheck;
+			string keyIndex;
 			string reserved;
-			JSONCONVERT2OBJECT_MEMEBER_REGISTER(TMK, TPK, EDK, index)
-				JSONCONVERT2OBJECT_MEMEBER_RENAME_REGISTER("tmk", "tpk", "edk", "index")
+			JSONCONVERT2OBJECT_MEMEBER_REGISTER(TMK, TPK, EDK, tpkKeyCheck, edkKeyCheck, keyIndex)
+				JSONCONVERT2OBJECT_MEMEBER_RENAME_REGISTER("tmk", "tpk", "edk", "tpkKeyCheck", "edkKeyCheck", "keyIndex")
 		} instanceAns;
 
 		HttpClientResponseResult result;
 		HttpClientRequestConfig config(HttpRequestMethod::POST, m_entity->GetInitUrl().GetData());
-		config.SetChildUri("/api/v3/initmk");
+		config.SetChildUri("/api/v5/initmk");
 		SP::Module::Restful::FulfillRequestJsonBody(&config, instanceReq);
 
 		std::string test;
@@ -174,7 +181,7 @@ struct InitializerInitMKTask : ITaskSp
 				if (m_entity->HasPinPad()) {
 					const bool testResult = SP::Module::Restful::ExtractDataFromDebranchResponse(result.content, instanceAns);
 					Dbg("ExtractDataFromDebranchResponse returned: %d", testResult);
-					if (m_entity->LoadKeysToPinPadACS(tmkpair.second, instanceAns.TPK, instanceAns.EDK, instanceAns.index) == Error_Succeed) {
+					if (m_entity->LoadKeysToPinPadACS(tmkpair.second, instanceAns.TPK, instanceAns.EDK, instanceAns.keyIndex) == Error_Succeed) {
 						m_entity->EndInitMK(Error_Succeed, "");
 					}
 					else {
@@ -1597,6 +1604,36 @@ bool CAccessAuthEntity::SendInitMKReqACS(CInitlizerMKReq& initMKReq)
 		initMKReq.loginWay = 0;
 	}
 
+	PinPadService_ClientBase* pPinPad = new PinPadService_ClientBase(this);
+	auto errRc = pPinPad->Connect();
+	if (errRc == Error_Succeed)
+	{
+		PinPadService_GetCheckCode_Req req = {};
+		PinPadService_GetCheckCode_Ans ans = {};
+
+		req.mSN.Init(1);
+		req.wSN.Init(1);
+		req.mSN[0] = 1;
+		req.wSN[0] = 0;
+		errRc = (*pPinPad)(EntityResource::getLink().upgradeLink())->GetCheckCode(req, ans, 10000);
+		if (errRc == Error_Succeed)
+		{
+			initMKReq.tpkKeyCheck = ans.checkcode[0].GetData();
+			initMKReq.keyIndex = ans.index[0].GetData();
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("SendInitMKReqACS")("Get keyChek && keyIndex suc.");
+		}
+		else
+		{
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("SendInitMKReqACS")("Get keyChek && keyIndex failed.");
+		}
+
+		pPinPad->GetFunction()->CloseSession();
+	}
+	else
+	{
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("QueryCheckCode")("connect to pinpad failed.error code:%d", errRc);
+	}
+
 	return true;
 }
 

+ 12 - 0
addin/res/ManagerDesktop/css/errType.css

@@ -238,6 +238,18 @@ input[type="number"]{
     justify-content: center;
 }
 .btn_confirm{
+	width: 300px;
+	height: 80px;
+	border-radius: 40px;
+	background-image: linear-gradient(to bottom right, #4D7BFE, #749FFF);
+	font-size: 32px;
+	color: #FFFFFF;
+	display: inline-flex;
+	align-items: center;
+	justify-content: center;
+}
+
+.rows_restart .btn_confirm{
 	width: 200px;
 	height: 50px;
 	border-radius: 40px;

+ 2 - 2
addin/res/ManagerDesktop/entityCheck.html

@@ -71,10 +71,10 @@
 			<!-- 硬件检测Start -->
 			<div class="entity-box">
 				<div class="entity-check" id="entityList">
-					<div class="entity-item netCardLink">
+					<!-- <div class="entity-item netCardLink">
 						<h5 class="fz_28"><i class="icon-type"></i>网卡连接</h5>
 						<p class="fz_24"></p>
-					</div>
+					</div> -->
 					<div class="entity-item checkNet">
 						<h5 class="fz_28"><i class="icon-type"></i>网络连接</h5>
 						<p class="fz_24"></p>

+ 2 - 2
addin/res/ManagerDesktop/js/entityCheck.js

@@ -69,7 +69,7 @@ function getBizLinks(){
 
     // 配置接口返回后,调接口
     getCheckNetType();
-		getNetCardLink();
+		// getNetCardLink();
 
 	},60000)
 
@@ -116,7 +116,7 @@ function getBizLinks(){
 
       // 配置接口返回后,调接口
       getCheckNetType();
-      getNetCardLink();
+      // getNetCardLink();
     }
 	})
 }

+ 1 - 1
addin/res/ManagerDesktop/js/entityService.js

@@ -471,7 +471,7 @@ var AccessAuthService = {
     },
     _methodID : {
         InitializeNew: 4,
-        GetNetMsg: 6
+        GetNetMsg: 6,
     },
             
     _methodSignature :{