Browse Source

#IQRV #comment [AccessAuth] CFG依赖文件去除

gifur 2 years ago
parent
commit
fff086ac63
2 changed files with 23 additions and 18 deletions
  1. 23 5
      Module/mod_accessauth/AccessAuthFSM.cpp
  2. 0 13
      addin/cfg/AccessAuthorization.ini

+ 23 - 5
Module/mod_accessauth/AccessAuthFSM.cpp

@@ -4,6 +4,7 @@
 #include "Event.h"
 #include "access_basefun.h"
 #include "SpUtility.h"
+#include <map>
 #ifdef RVC_OS_WIN
 #include  <io.h>
 #endif
@@ -1351,6 +1352,7 @@ unsigned int CAccessAuthFSM::s2_on_event(FSMEvent* pEvent)
 		CSimpleStringA strWKSyncSuccTime = "";
 		CSimpleStringA strWKSyncFailCount = "";
 		// 检查上次密钥同步时间(一天只同步一次)
+
 		CSmartPointer<IConfigInfo> pConfigRun;
 		m_pEntity->GetFunction()->OpenConfig(Config_Run, pConfigRun);
 		pConfigRun->ReadConfigValueInt("Main", "WKSyncSuccTime", nWKLastSyncTime);
@@ -1882,11 +1884,27 @@ int CAccessAuthFSM::RtsMapToUserCode(const char* pRtsCode, DWORD dwDefaultUserCo
 	LOG_FUNCTION();
 	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("RtsCode:%s",pRtsCode);
 	CSmartPointer<IConfigInfo> pConfig;
-	m_pEntity->GetFunction()->OpenConfig(Config_Software, pConfig);
+	m_pEntity->GetFunction()->OpenConfig(Config_CenterSetting, pConfig);
 	int tmpUserCode = 0;
 	pConfig->ReadConfigValueInt("RtsToUserCode", pRtsCode, tmpUserCode);
-	if (tmpUserCode > 0)
-		return tmpUserCode;
-	else
-		return dwDefaultUserCode;
+	if (tmpUserCode > 0) {
+        return tmpUserCode;
+
+	}
+	else {
+		std::map<std::string, DWORD> RtsToUserCode;
+		RtsToUserCode["RTS1705"] = 0x5029000e;
+        RtsToUserCode["RTS1707"] = 0x50290019;
+        RtsToUserCode["RTS1711"] = 0x5029000b;
+        RtsToUserCode["RTS1712"] = 0x50290018;
+        RtsToUserCode["RTS1713"] = 0x50290019;
+        RtsToUserCode["RTS1714"] = 0x5029000a;
+        RtsToUserCode["RTS1715"] = 0x5029000f;
+
+		if (RtsToUserCode.find(pRtsCode) != RtsToUserCode.end()) {
+			return RtsToUserCode[pRtsCode];
+		} else {
+            return dwDefaultUserCode;
+		}
+	}
 }

+ 0 - 13
addin/cfg/AccessAuthorization.ini

@@ -1,13 +0,0 @@
-[Main]
-Server=99.1.100.215 1031
-Server_Backup=99.1.100.215 1031
-WKSyncFailCount=0
-WKSyncSuccTime=0x195D6EA4
-[RtsToUserCode]
-RTS1705=0x5029000e
-RTS1707=0x50290019
-RTS1711=0x5029000b
-RTS1712=0x50290018
-RTS1713=0x50290019
-RTS1714=0x5029000a
-RTS1715=0x5029000f