Преглед на файлове

Z991239-6443 #comment GetLocalTime

80374374 преди 1 месец
родител
ревизия
99f2fd960e

+ 4 - 7
Framework/spbase/sp_cfg.cpp

@@ -43,8 +43,10 @@
 #include <iomanip>
 #include <windows.h>
 #define UPDATE_ROOT_BY_HTTP
+#define READ_SHELL_NODE SHELL_ENTITY_HEAD
 #else
 #include "JsonConvertHelper.hpp"
+#define READ_SHELL_NODE "UOSEntity"
 #endif //_MSC_VER
 #include "sp_checkEntity.h"
 #include <log_producer_config.h>
@@ -1590,7 +1592,7 @@ static int shell_ini__load_entities_list(sp_dir_t* dir, sp_cfg_shell_ini_t* shel
 			entity->debug_level = debugLevelArr.find(entity->name) == debugLevelArr.end() ? 0 : debugLevelArr[cur_it->first];
 			entity->log_record_level = getEntityLogLevel(entity->name);
 
-			entity->runType = 1;//1,Debug;2,Release
+			entity->runType = 1;
 			//judge if run in release or debug
 			std::string tmpEntityName = entity->name, entityInfo = "";
 			std::transform(tmpEntityName.begin(), tmpEntityName.end(), tmpEntityName.begin(), ::tolower);
@@ -2048,12 +2050,7 @@ ErrorCodeEnum init_shell_byHttp(sp_dir_t* dir, sp_cfg_shell_ini_t* shell, sp_cfg
 
 	//init entity arr,去除以;开头的实体
 	std::map<std::string, std::string> entityArr = clearUnExistConfig(shellConfig[SHELL_ENTITY_HEAD]);
-	//TODO: CrossPlaform  [Gifur@2025730]
-#ifdef _WIN32
-	CSimpleStringA sectionNameWithType = CSimpleStringA::Format("%s_%s", SHELL_ENTITY_HEAD, root->machine_type);
-#else
-	CSimpleStringA sectionNameWithType = CSimpleStringA::Format("%s_%s", "UOSEntity", root->machine_type);
-#endif
+	CSimpleStringA sectionNameWithType = CSimpleStringA::Format("%s_%s", READ_SHELL_NODE, root->machine_type);
 	if (shellConfig.find(sectionNameWithType.GetData()) != shellConfig.end())	//有带机型的实体
 	{
 		std::map<std::string, std::string> entityTypeArr = clearUnExistConfig(shellConfig[sectionNameWithType.GetData()]);

+ 0 - 6
Framework/spbase/sp_dir.c

@@ -360,13 +360,7 @@ int sp_dir_inner_get_content(const char* file, char* ver)
 		n = fread(szTemp, 1, 256, pFile);
 		fclose(pFile);
 		memset(ver, 0, SP_MAX_VER_LEN);
-		//TODO: CrossPlaform  [Gifur@2025730]
-#if defined(RVC_OS_WIN)
-		strncpy_s(ver, SP_MAX_VER_LEN, szTemp, _TRUNCATE);
-#else
 		strncpy(ver, szTemp, SP_MAX_VER_LEN);
-#endif //RVC_OS_WIN
-		//TODO:   [Gifur@20241014]
 		if (strlen(ver) == 0) {
 			return Error_Null;
 		}

+ 1 - 8
Framework/spbase/sp_logwithlink.cpp

@@ -597,8 +597,6 @@ CSimpleString generateDefaultStoragePath()
 static CSimpleStringA g_entityName = "SpShell";
 
 void logCallback(const char* message) {
-    // 在这里执行您的日志记录逻辑
-    // 在这个示例中,我们简单地将日志消息输出到控制台
     WLog_DBG(TAG, "from rvcLogSDK:%s", message);
 }
 
@@ -613,12 +611,7 @@ SPBASE_API void* create_log_producer_storage(CSimpleStringA entityName, CSimpleS
 {
     WLog_DBG(TAG, "create log producer storage for %s, %s, %s", entityName.GetData(), item.GetData(), filePath.GetData());
     log_producer_config* config = create_log_producer_config();
-    //TODO: CrossPlaform  [Gifur@2025730]
-#ifdef _WIN32
-    std::string t_entityName = toLowerCase(entityName.GetData());
-#else
-	const std::string t_entityName = SP::Utility::ToLower(entityName.GetData());
-#endif  
+    const std::string t_entityName = SP::Utility::ToLower(entityName.GetData());
     if (config == NULL) {
         WLog_DBG(TAG, "create_log_producer_config return null!");
         return NULL;

+ 1 - 1
Framework/spbase/sp_mod.c

@@ -872,7 +872,7 @@ static int create_module_process(const char *mod_name, int epid, int range, int
 		return -1;
 	}
 
-	//TODO: CrossPlaform  [Gifur@2025729]
+	//TODO: CrossPlaform 这个等良瑜来处理,目前WIN都是Release版本,不需要再区分  [Gifur@2025729]
 	if (runType == 1)
 		sprintf(app, ".\\bin\\sphost.exe {%s} %d", mutexName, shellId);
 	else

+ 1 - 7
Framework/spbase/sp_sps.c

@@ -2,13 +2,12 @@
 #include "sp_sps.h"
 #include "sp_def.h"
 #include "sp_logwithlinkforc.h"
-
 #include "memutil.h"
+#include <winpr/winsock.h>
 
 #define SILVERLIGHT_POLICY_PORT	943
 #define MAX_TIMEOUT 30000
 
-
 static const char *req_policy = "<policy-file-request/>";
 static const int req_policy_len = 22;
 
@@ -57,12 +56,7 @@ static void __on_accept(SOCKET policy_fd)
 	DbgWithLinkForC(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM, "accept from %s:%d", inet_ntoa(from_addr.sin_addr), ntohs(from_addr.sin_port));
 
 	WSAEventSelect(conn_fd, NULL, 0);
-	//TODO: CrossPlaform  [Gifur@2025729]
-#ifdef _WIN32
-	ioctlsocket(conn_fd, FIONBIO, &iMode);
-#else
 	_ioctlsocket(conn_fd, FIONBIO, &iMode);
-#endif //_WIN32
 	opt = TRUE;
 	setsockopt(conn_fd, IPPROTO_TCP, TCP_NODELAY, (char*)&opt, sizeof(opt));
 	opt = TRUE;

+ 1 - 0
Framework/spbase/sp_sps.h

@@ -11,6 +11,7 @@
 
 #pragma once
 
+//TODO: CrossPlaform 评审是否需要移除,目前不走Slierlight这一套,直接用Websocket通讯  [Gifur@2025820]
 #ifdef __cplusplus
 extern "C"
 {

+ 1 - 43
Framework/spshell/spshell.cpp

@@ -359,49 +359,6 @@ static bool  IsProcessRunAsAdmin()
 	return  bAdmin == TRUE;
 }
 
-const char *GetMachineType()
-{
-	auto env = sp_get_env();
-	if (env == NULL)
-	{
-		DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("sp_get_env return null");
-		return NULL;
-	}
-	return env->cfg->root_ini->machine_type;
-}
-
-
-
-#ifdef RVC_OS_WIN
-
-//TODO: CrossPlaform 11111  [Gifur@2025730]
-const char *GetCenterSettingNameBySite(const char *pszSite)
-{
-	///*TODO(80374374@3/23/2023): CenterSettings */
-#if defined(_MSC_VER)
-	return  "CenterSetting.ini";
-#else
-	if (pszSite == NULL || strlen(pszSite) == 0)
-		return "CenterSetting.ini";
-
-	if ((stricmp(pszSite, "CMB.LIB") == 0)
-		|| (stricmp(pszSite, "CMB.SSB") == 0)) {
-		return  "CenterSetting.LAN.ini";
-	} else if ((stricmp(pszSite, "CMB.LSS") == 0)
-		|| (stricmp(pszSite, "CMB.FLB") == 0)
-		|| (stricmp(pszSite, "CMB.OSB") == 0)
-		|| (stricmp(pszSite, "CMB.SMM") == 0)) {
-		return   "CenterSetting.DMZ.ini";
-	} else {
-		return  "CenterSetting.DMZ.ini";
-	}
-#endif //_MSC_VER
-}
-
-
-
-#endif //RVC_OS_WIN
-
 static bool SpTerminateProcess(HANDLE hProc, DWORD dwProcID)
 {
 	if (!TerminateProcess(hProc, -1))
@@ -789,6 +746,7 @@ int main(int argc, char** argv)
 
 
 #if defined(_MSC_VER)
+	//TODO: CrossPlaform 等良瑜确认,应该不再涉及本地集中配置了  [Gifur@2025820]
 	auto centersettingPath = generateCenterSettingPath();
 	load_debugLevelInCentersetting(centersettingPath.c_str());
 	load_specialRunInfoInCentersetting(centersettingPath.c_str());

+ 2 - 2
Module/mod_healthmanager/HealthManagerFSM.cpp

@@ -17,7 +17,7 @@
 #include <fcntl.h>
 #include <errno.h>
 #endif //RVC_OS_WIN
-
+#include <winpr/sysinfo.h>
 
 #include "mod_healthmanager.h"
 #include "publicFunExport.h"
@@ -915,7 +915,7 @@ void CHealthManagerFSM::WKUpdatePeriod()
 			stSyncTime.wHour, stSyncTime.wMinute, stSyncTime.wSecond);
 
 	SYSTEMTIME stNow = {};
-	GetLocalTimeRVC(stNow);
+	GetLocalTime(&stNow);
 	int lastUpdateDays = sumday(stSyncTime.wYear, stSyncTime.wMonth, stSyncTime.wDay);
 	int todayDays = sumday(stNow.wYear, stNow.wMonth, stNow.wDay);
 	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("lastUpdateDays:%d,todayDays:%d,x:%d", lastUpdateDays,todayDays, todayDays-lastUpdateDays);

+ 5 - 6
Module/mod_healthmanager/mod_healthmanager.cpp

@@ -30,15 +30,15 @@
 #include "fileutil.h"
 #include "iniutil.h"
 #include "osutil.h"
-
-using namespace std;
+#include <winpr/sysinfo.h>
 
 #include "mod_healthmanager.h"
 #include "CommEntityUtil.hpp"
 #include "TerminalInfoQueryConn.h"
 #include "Chromium_client_g.h" //启动浏览器接口
-using namespace Chromium;
 
+using namespace std;
+using namespace Chromium;
 
 const DWORD HEALTHMANAGER_TIMER_ID = 1;
 const DWORD HEALTHMANAGER_WAIT_MAINPAGE_OPEN_TIMER_ID = 2;
@@ -327,7 +327,7 @@ void CHealthManagerEntity::OnCheckTimeTimeout()
 		}
 	}
 	SYSTEMTIME localTime;
-	GetLocalTimeRVC(localTime);
+	GetLocalTime(&localTime);
 	//for example:[1----6]
 	//               ^ here we go
 	//in reboot period
@@ -866,8 +866,7 @@ bool CHealthManagerEntity::DoRestart()
 	}
 	DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM)("[NonExclusive],NonGuardian=%s", csimpleStrMachineTypeCfg.GetData());
 	SYSTEMTIME localTime;
-	GetLocalTimeRVC(localTime);
-
+	GetLocalTime(&localTime);
 
 	ITimerListener *pListener = new TimerOutHelper<CHealthManagerEntity>(this, &CHealthManagerEntity::OnCheckTimeTimeout);
 	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("set check timer %d(ms)", HEALTHMANAGER_TIMER_INTERVAL);

+ 0 - 17
Module/mod_healthmanager/mod_healthmanager.h

@@ -17,10 +17,8 @@ using namespace HealthManager;
 using namespace std;
 using namespace UpgradeManager;
 
-
 #include "GuardianBase.h"
 typedef int (*pfShakeHands)(WorkStateEnum &eState);
-
 typedef int (*pfPushUpdateTask)(const char *pszPackName);
 typedef bool (*pfIsInstalling)();
 typedef int (*pfUpgradeRestart)(const DWORD dwParam1,const DWORD dwParam2);
@@ -45,21 +43,6 @@ struct ModuleRunInfo
 	int abnormalCount;
 	bool bAbnormalBusy;
 };
-struct RestartModeInfo
-{
-	DWORD dwTimes;
-	DWORD dwInternal;
-};
-
-#define MACSESION 6
-
-
-#include <winpr/sysinfo.h>
-static void GetLocalTimeRVC(SYSTEMTIME& stTime)
-{
-	GetLocalTime(&stTime);
-}
-
 
 class HealthManagerSession : public HealthManagerService_ServerSessionBase
 {