Răsfoiți Sursa

修改转辙机端口需要管理员权限。

git-svn-id: https://202.107.226.68:8443/svn/Services/ResistanceMonitor@13 a05970a1-87b9-9d4f-9ee5-fa77e2ec115b
shenchunzhong 1 an în urmă
părinte
comite
36baf36b11
3 a modificat fișierele cu 34 adăugiri și 4 ștergeri
  1. 1 0
      4.Data/HttpPrcess.cpp
  2. 32 4
      4.Data/ResistAlarm.cpp
  3. 1 0
      4.Data/ResistAlarm.h

+ 1 - 0
4.Data/HttpPrcess.cpp

@@ -2382,6 +2382,7 @@ int DealGetResistData(const httplib::Request& req, const string token, char** js
 
 int DealPutChangeZzjno(const char* body_ptr, const size_t body_len, const string token, char** json, size_t* json_len)
 {
+	if (token.find("AAAAAAAA") == -1) return 403;
 	int code = 400;
 	string msg;
 	auto req_doc = yyjson_read(body_ptr, body_len, 0);

+ 32 - 4
4.Data/ResistAlarm.cpp

@@ -2505,6 +2505,8 @@ void CResistAlarmMng::ThreadProcDevice(DWORD_PTR param)
 				bool bAlarm = false;
 				if (!pInfo->pDeivce) continue;
 				const auto pDevice = pInfo->pDeivce;
+				if (pDevice->m_ctUpdateTime.GetTime() == 0)
+					continue;
 				if (ctNow - pDevice->m_ctUpdateTime > offline_time)
 					bAlarm = true;
 				else
@@ -2897,15 +2899,17 @@ void CResistAlarmMng::ThreadProcMove(DWORD_PTR param)
 					auto pFixConstRetensionForceWaveInfo = (RETENSION_FORCE_DROP*)pService->Find(mo, mp, (uint8_t)eSuoBiPosi::SB_FIX, eZL_ALARMTYPE::RETENSION_FORCE);
 					if (pFixConstRetensionForceWaveInfo == nullptr)//默认开启
 					{
-						pFixConstRetensionForceWaveInfo = new RETENSION_FORCE_DROP;
-						pService->Insert(mo, mp, (uint8_t)eSuoBiPosi::SB_FIX, (uint8_t)eZL_ALARMTYPE::RETENSION_FORCE, pFixConstRetensionForceWaveInfo);
+						ASSERT(FALSE);
+						//pFixConstRetensionForceWaveInfo = new RETENSION_FORCE_DROP;
+						///pService->Insert(mo, mp, (uint8_t)eSuoBiPosi::SB_FIX, (uint8_t)eZL_ALARMTYPE::RETENSION_FORCE, pFixConstRetensionForceWaveInfo);
 					}
 					//反位
 					auto pInvertConstRetensionForceWaveInfo = (RETENSION_FORCE_DROP*)pService->Find(mo, mp, (uint8_t)eSuoBiPosi::SB_INVERT, eZL_ALARMTYPE::RETENSION_FORCE);
 					if (pInvertConstRetensionForceWaveInfo == nullptr)//默认开启
 					{
-						pInvertConstRetensionForceWaveInfo = new RETENSION_FORCE_DROP;
-						pService->Insert(mo, mp, (uint8_t)eSuoBiPosi::SB_INVERT, (uint8_t)eZL_ALARMTYPE::RETENSION_FORCE, pInvertConstRetensionForceWaveInfo);
+						ASSERT(FALSE);
+						//pInvertConstRetensionForceWaveInfo = new RETENSION_FORCE_DROP;
+						//pService->Insert(mo, mp, (uint8_t)eSuoBiPosi::SB_INVERT, (uint8_t)eZL_ALARMTYPE::RETENSION_FORCE, pInvertConstRetensionForceWaveInfo);
 					}
 
 					//获取报警设置 end
@@ -3345,6 +3349,30 @@ BOOL CResistAlarmMng::LoadAlarmSet()
 		}
 	} while (true);
 
+	const auto& mapInfo = CMonitorObjectMng::Instance()->m_mapMoMpInfo;
+	for (auto& it : mapInfo)
+	{
+		if (Find(it.second->mo, it.second->mp, (uint8_t)eSuoBiPosi::SB_FIX, eZL_ALARMTYPE::RETENSION_FORCE))
+		{
+
+		}
+		else
+		{
+			auto pInfo = new RETENSION_FORCE_DROP;
+			Insert(it.second->mo, it.second->mp, (uint8_t)eSuoBiPosi::SB_FIX, (uint8_t)eZL_ALARMTYPE::RETENSION_FORCE, pInfo);
+		}
+
+		if (Find(it.second->mo, it.second->mp, (uint8_t)eSuoBiPosi::SB_INVERT, eZL_ALARMTYPE::RETENSION_FORCE))
+		{
+
+		}
+		else
+		{
+			auto pInfo = new RETENSION_FORCE_DROP;
+			Insert(it.second->mo, it.second->mp, (uint8_t)eSuoBiPosi::SB_INVERT, (uint8_t)eZL_ALARMTYPE::RETENSION_FORCE, pInfo);
+		}
+	}
+
 	CSimpleLog::Info(fmt::format("一共加载到{}条报警规则:{}", m_alarm_set.size(), sql).c_str());
 	return TRUE;
 }

+ 1 - 0
4.Data/ResistAlarm.h

@@ -77,6 +77,7 @@ typedef struct tagRetension_Force_Drop : public  tagBaseInfo
 
 	tagRetension_Force_Drop()
 	{
+		type = eZL_ALARMTYPE::RETENSION_FORCE;
 		enable = true;
 	}