From 61117161b3d5665eaeab972673b4a1a2fda52681 Mon Sep 17 00:00:00 2001 From: zhanghan Date: Wed, 4 Dec 2024 20:54:27 +0800 Subject: [PATCH] fix data value processing error --- event/sdk/common.go | 10 +++++----- event/server/db/db.go | 6 +----- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/event/sdk/common.go b/event/sdk/common.go index e7edf2a3..d6a16d7b 100644 --- a/event/sdk/common.go +++ b/event/sdk/common.go @@ -1,6 +1,6 @@ /* * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. - * PilotGo-plugins licensed under the Mulan Permissive Software License, Version 2. + * PilotGo-plugins licensed under the Mulan Permissive Software License, Version 2. * See LICENSE file for more details. * Author: zhanghan2021 * Date: Wed Jul 24 10:02:04 2024 +0800 @@ -92,7 +92,6 @@ type MDUserSystemSession struct { //平台登录、退出 } type MDHostChange struct { // 主机新增、移除、上线、离线 - HostUUID string `json:"host_uuid"` IP string `json:"ip"` OS string `json:"os"` OSVersion string `json:"os_version"` @@ -102,14 +101,15 @@ type MDHostChange struct { // 主机新增、移除、上线、离线 } type MDHostPackageOpt struct { //软件包安装、升级、卸载 - HostUUID string `json:"host_uuid"` - Name string `json:"name"` - Version string `json:"version"` + HostIP string `json:"hostIp"` + Name string `json:"name"` + Version string `json:"version"` } type MDHostIPChange struct { //主机ip变更 HostUUID string `json:"host_uuid"` NewIP string `json:"new_ip"` + OldIP string `json:"old_ip"` } type MDPluginChange struct { // 插件新增、移除、上线、离线 diff --git a/event/server/db/db.go b/event/server/db/db.go index e6d647fb..2b3efa28 100644 --- a/event/server/db/db.go +++ b/event/server/db/db.go @@ -121,13 +121,9 @@ func WriteToDB(MessageData string) error { func processValue(v interface{}) interface{} { value := v.(string) - re := regexp.MustCompile(`(\w+):([^\s\]]+)`) + re := regexp.MustCompile(`(\w+):([^\]]+)`) matches := re.FindAllStringSubmatch(value, -1) - result := make(map[string]string) - for _, match := range matches { - result[match[1]] = match[2] - } if len(matches) > 0 { result := make(map[string]string) for _, match := range matches { -- Gitee