From ad1ea820efbc3ffc157006ae6cd35ca3d9d4fa9c Mon Sep 17 00:00:00 2001
From: wangrong <wangrong@shsening.com>
Date: 星期六, 18 七月 2026 22:30:10 +0800
Subject: [PATCH] 增加设备告警消息

---
 src/modules/push/service/open.ts |   26 ++++++++++++++++++++------
 1 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/src/modules/push/service/open.ts b/src/modules/push/service/open.ts
index d126d26..ee49cbb 100644
--- a/src/modules/push/service/open.ts
+++ b/src/modules/push/service/open.ts
@@ -8,6 +8,7 @@
 import { PushCameraGpsEntity } from '../entity/cameragps';
 import { PushVehicleGpsEntity } from '../entity/vehiclegps';
 import { PushDeviceOnoffEntity } from '../entity/deviceonoff';
+import { PushDevicealarmEntity } from '../entity/devicealarm';
 import { CachingFactory, MidwayCache } from '@midwayjs/cache-manager';
 
 /**
@@ -30,6 +31,8 @@
   @InjectEntityModel(PushDeviceOnoffEntity)
   pushDeviceOnoffEntity: Repository<PushDeviceOnoffEntity>;
 
+  @InjectEntityModel(PushDevicealarmEntity)
+  pushDevicealarmEntity: Repository<PushDevicealarmEntity>;
 
   @InjectEntityModel(PushAuditlogEntity)
   pushAuditlogEntity: Repository<PushAuditlogEntity>;
@@ -135,16 +138,27 @@
         }
 
         // 钀ょ煶鍛婅
-        /*
         case 'ys.alarm': {
-          await this.pushAlarmRepo.save({
-            messageId,
-            raw: JSON.stringify(body),
-            createTime: new Date(),
+          await this.pushDevicealarmEntity.save({
+            devSerial: body.devSerial,
+            channelNo: body.channelNo || String(body.channel),
+            alarmId: body.alarmId,
+            alarmTime: body.alarmTime,
+            alarmType: body.alarmType,
+            channelName: body.channelName,
+            channelType: body.channelType ? Number(body.channelType) : 1,
+            checksum: body.checksum,
+            crypt: body.crypt ? Number(body.crypt) : 0,
+            customInfo: body.customInfo,
+            customType: body.customType,
+            describe: body.describe,
+            location: body.location,
+            relationId: body.relationId,
+            status: body.status ? Number(body.status) : 1,
+            pictureList: body.pictureList || []
           });
           break;
         }
-          */
 
         // 娴峰悍 ISAPI
         //case 'ys.open.isapi': {

--
Gitblit v1.9.1