| | |
| | | case 'ys.alarm': { |
| | | // 图片下载并上传到本地/对象存储 pictureList: Array<{ url: string; id: string }>; |
| | | const localUrls: Record<string, string>[] = []; |
| | | if (body.pictureList && Array.isArray(body.pictureList)) { |
| | | if (body.body.pictureList && Array.isArray(body.body.pictureList)) { |
| | | const filePlugin = await this.pluginService.getInstance('upload'); |
| | | for (const item of body.pictureList) { |
| | | for (const item of body.body.pictureList) { |
| | | try { |
| | | const result = await filePlugin.downAndUpload(item.url); |
| | | localUrls.push({url: result, id: item.id}); |
| | |
| | | } |
| | | } |
| | | 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, |
| | | devSerial: body.body.devSerial, |
| | | channelNo: body.body.channelNo || String(body.body.channel), |
| | | alarmId: body.body.alarmId, |
| | | alarmTime: body.body.alarmTime, |
| | | alarmType: body.body.alarmType, |
| | | channelName: body.body.channelName, |
| | | channelType: body.body.channelType ? Number(body.body.channelType) : 1, |
| | | checksum: body.body.checksum, |
| | | crypt: body.body.crypt ? Number(body.body.crypt) : 0, |
| | | customInfo: body.body.customInfo, |
| | | customType: body.body.customType, |
| | | describe: body.body.describe, |
| | | location: body.body.location, |
| | | relationId: body.body.relationId, |
| | | status: body.body.status ? Number(body.body.status) : 1, |
| | | pictureList: localUrls || [] |
| | | }); |
| | | break; |