Browse Source

Z991239-4900 #comment 同步代码

Signed-Off-By: commit-hook
刘文涛80174520 2 years ago
parent
commit
bc35228318

+ 20 - 7
Module/mod_UpgradeMgr/UpgradeTaskFSM.cpp

@@ -11,9 +11,11 @@
 #ifdef RVC_OS_WIN
 #include <WinBase.h>
 #include <io.h>
-#include "..\EventCode.h"
+#include "EventCode.h"
+#include "UpgradeMgr_UserCode.h"
 #include "json.h"
 #include "XUnzip.h"
+#include <ShellAPI.h>
 #else
 #include "EventCode.h"
 #include "json/json.h"
@@ -801,7 +803,11 @@ namespace Task
 			rootReq["software_version"] = strInstallVersion.GetData();
 			rootReq["os_version"] = strOSVersion.GetData();
 			rootReq["machine_version"] = strMachineVersion.GetData();
+#ifdef RVC_OS_WIN
+#else
 			rootReq["system_type"] = "L";
+#endif			
+			
 
 			//是否发送hash码
 			if(m_fsm->isSendHash){
@@ -1218,7 +1224,7 @@ namespace Task
 			CSimpleStringA strInstallVersion = m_fsm->m_currentVersion.ToString();
 			// OS版本
 #ifdef RVC_OS_WIN
-			OSVERSIONINFO osvi;
+			OSVERSIONINFO osvi;    
 			ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
 			osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
 			GetVersionEx(&osvi);
@@ -1243,7 +1249,11 @@ namespace Task
 			rootReq["software_version"] = strInstallVersion.GetData();
 			rootReq["os_version"] = strOSVersion.GetData();
 			rootReq["machine_version"] = strMachineVersion.GetData();
-			rootReq["system_type"] = "L";//表示是windows类型的机器
+#ifdef RVC_OS_WIN
+			rootReq["system_type"] = "W";//表示是windows类型的机器
+#else
+			rootReq["system_type"] = "L";//表示是uos类型的机器
+#endif
 			if(m_fsm->m_bNeedHash&&m_fsm->isSendHash){
 				//是否发送hash码并且发送成功了
 				DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI("QueryNewContinueTaskImpl")("QueryNewContinueTask with hash");
@@ -2324,7 +2334,7 @@ int CUpgradeTaskFSM::ExecRunCmd(CSimpleStringA &strErrMsg,CInstallStep* ins)
 			return false;
 		}
 	}else{
-		DbgWithLink(LOG_LEVEL_ERROR,LOG_TYPE_SYSTEM).setAPI("ExecRunCmd")("ExecRunCmd destPathType is invalid %s",ins->dstPathType.GetData());
+		DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI("ExecRunCmd")("ExecRunCmd destPathType is invalid %s",ins->dstPathType.GetData());
 		strErrMsg = CSimpleStringA::Format("ExecRunCmd destPathType is invalid %s",ins->dstPathType.GetData());
 		return false;//不支持的路径类型
 	}
@@ -2342,7 +2352,7 @@ int CUpgradeTaskFSM::ExecRunCmd(CSimpleStringA &strErrMsg,CInstallStep* ins)
 		if (bIsWow64)
 		{
 			if (!Wow64DisableWow64FsRedirection(&pRedirectOldValue)){
-				DbgWithLink(LOG_LEVEL_ERROR,LOG_TYPE_SYSTEM).setAPI("ExecRunCmd")("Wow64DisableWow64FsRedirection fail: %d", GetLastError());
+				DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI("ExecRunCmd")("Wow64DisableWow64FsRedirection fail: %d", GetLastError());
 			}else{
 				DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI("ExecRunCmd")("Wow64DisableWow64FsRedirection succ");
 			}
@@ -2381,7 +2391,7 @@ int CUpgradeTaskFSM::ExecRunCmd(CSimpleStringA &strErrMsg,CInstallStep* ins)
 			//获取结果文件
 			if (!GetSysUpgradeResult(strResultLog, eErrorCode, strErrMsg))
 			{
-				DbgWithLink(LOG_LEVEL_ERROR,LOG_TYPE_SYSTEM).setAPI("ExecRunCmd")("ExecRunCmd is fail, get result from result.log fail, %s", strErrMsg.GetData());
+				DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI("ExecRunCmd")("ExecRunCmd is fail, get result from result.log fail, %s", strErrMsg.GetData());
 				strErrMsg = CSimpleStringA::Format("ExecRunCmd is fail ,get result from result.log fail, %s", strErrMsg.GetData());
 				return 0;//失败
 			}
@@ -4593,6 +4603,7 @@ bool CUpgradeTaskFSM::CheckIfCanSwitchNow()
 	GetLocalTime(&st);
 	//DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI("CheckIfCanSwitchNow")("hour is %d",(int)st.wHour);
 	bool bOffworkTime = st.wHour < 8 || st.wHour >= 21;
+	DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI("CheckIfCanSwitchNow")("hour is %d, strCustomerHandle=%s, strCallState=%s, bOffworkTime=%d",(int)st.wHour,strCustomerHandle.GetData(),strCallState.GetData(),(int)bOffworkTime);
 #else
 	time_t nowTime = time(NULL);
 	tm nowTimeTm = { 0 };
@@ -4841,7 +4852,8 @@ bool CUpgradeTaskFSM::isAuthSucc() {
 		return false;
 	}
 }
-
+#ifdef RVC_OS_WIN
+#else
 int CUpgradeTaskFSM::changeFileAtt(const char* path)
 {
 	struct stat attr_of_del;
@@ -4861,6 +4873,7 @@ int CUpgradeTaskFSM::changeFileAtt(const char* path)
 		return -1;
 	}
 }
+#endif
 
 void CUpgradeTaskFSM::OnStateTrans(int iSrcState, int iDstState)
 {

+ 3 - 1
Module/mod_UpgradeMgr/UpgradeTaskFSM.h

@@ -407,8 +407,10 @@ public:
 
 	bool isWork();
 	bool isAuthSucc();
+#ifdef RVC_OS_WIN
+#else
 	int changeFileAtt(const char* path);
-
+#endif
 
 private:
 	virtual void OnStateTrans(int iSrcState, int iDstState);

+ 9 - 2
Module/mod_UpgradeMgr/mod_UpgradeMgr.h

@@ -1,13 +1,17 @@
 #ifndef RVC_MOD_UPGRADEMGR_H_
 #define RVC_MOD_UPGRADEMGR_H_
-
+#include "stdafx.h"
 #include "SpBase.h"
 #include "SimpleString.h"
 #include "UpgradeManager_server_g.h"
 
+#ifdef RVC_OS_WIN
 
+#else
 #include "SpTest.h"
 #include "modVer.h"
+#endif
+
 #include "UpgradeTaskFSM.h"
 
 using namespace UpgradeManager;
@@ -30,13 +34,16 @@ public:
 	virtual ~CUpgradeMgrEntity() {}
 	virtual const char *GetEntityName() const { return "UpgradeManager"; }
 	virtual bool IsService()const{return true;}
-
+#ifdef RVC_OS_WIN
+#else
 	const char* GetEntityVersion() const override
 	{
 		return MODULE_VERSION_FULL;
 	}
 
 	ON_ENTITYT_TEST()
+#endif
+
 
 	virtual void OnStarted();
 	virtual void OnSelfTest(EntityTestEnum eTestType,CSmartPointer<ITransactionContext> pTransactionContext);