From c634ac486ea73c0a9cf16f99d55a4989bc9a66ba Mon Sep 17 00:00:00 2001 From: 10191 <506754232@qq.com> Date: Sun, 4 Jan 2026 15:03:51 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=86=E5=88=AB=E4=BF=A1=E6=81=AF=E8=BF=94?= =?UTF-8?q?=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SGGL/BLL/Common/YunMouHelper.cs | 8 ++++++-- SGGL/FineUIPro.Web/ProjectData/ProjectDevices.aspx.cs | 5 +++-- SGGL/FineUIPro.Web/ProjectData/ProjectDevicesEdit.aspx.cs | 3 ++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/SGGL/BLL/Common/YunMouHelper.cs b/SGGL/BLL/Common/YunMouHelper.cs index 10691aad..5dd3896f 100644 --- a/SGGL/BLL/Common/YunMouHelper.cs +++ b/SGGL/BLL/Common/YunMouHelper.cs @@ -80,17 +80,21 @@ namespace BLL.Common /// /// /// - public static string addDevices(string deviceSerial, string groupNo, string validateCode, string access_token) + public static string addDevices(string deviceSerial, string groupNo, string validateCode, string access_token,out string res) { string data = "{\"deviceSerial\":\"" + deviceSerial + "\",\"groupNo\":\"" + groupNo + "\",\"validateCode\":\"" + validateCode + "\"}"; string result = Post(YunMouUrl + "api/v1/open/basic/devices/create", data, "application/json;charset=UTF-8", access_token); ErrLogInfo.WriteLog(result); - + var j2 = JsonConvert.DeserializeObject(result); if (j2.code == "200") + { + res = j2.message; return j2.data.groupId; + } else { + res = j2.message; return ""; } } diff --git a/SGGL/FineUIPro.Web/ProjectData/ProjectDevices.aspx.cs b/SGGL/FineUIPro.Web/ProjectData/ProjectDevices.aspx.cs index f85822d3..dd1de109 100644 --- a/SGGL/FineUIPro.Web/ProjectData/ProjectDevices.aspx.cs +++ b/SGGL/FineUIPro.Web/ProjectData/ProjectDevices.aspx.cs @@ -170,9 +170,10 @@ namespace FineUIPro.Web.ProjectData { var project = Funs.DB.Base_Project.FirstOrDefault(x => x.ProjectId == CurrUser.LoginProjectId); var token = YunMouHelper.getToken(); + string addMessage = ""; string data; data = Regex.Replace(project.ProjectCode, "[^0-9A-Fa-f]", "", RegexOptions.IgnoreCase); - var YunMouDeviceId = YunMouHelper.addDevices(device.DeviceSerial, data, device.ValidateCode, token);//添加设备 + var YunMouDeviceId = YunMouHelper.addDevices(device.DeviceSerial, data, device.ValidateCode, token,out addMessage);//添加设备 if (!string.IsNullOrEmpty(YunMouDeviceId)) { device.YunMouDeviceId = YunMouDeviceId; @@ -182,7 +183,7 @@ namespace FineUIPro.Web.ProjectData } else { - Alert.ShowInTop("同步设备出错!", MessageBoxIcon.Warning); + Alert.ShowInTop("同步设备出错:"+ addMessage, MessageBoxIcon.Warning); } } diff --git a/SGGL/FineUIPro.Web/ProjectData/ProjectDevicesEdit.aspx.cs b/SGGL/FineUIPro.Web/ProjectData/ProjectDevicesEdit.aspx.cs index d2471ca8..0473f6ee 100644 --- a/SGGL/FineUIPro.Web/ProjectData/ProjectDevicesEdit.aspx.cs +++ b/SGGL/FineUIPro.Web/ProjectData/ProjectDevicesEdit.aspx.cs @@ -106,7 +106,8 @@ namespace FineUIPro.Web.ProjectData var token = YunMouHelper.getToken(); string data; data = Regex.Replace(project.ProjectCode, "[^0-9A-Fa-f]", "", RegexOptions.IgnoreCase); - device.YunMouDeviceId = YunMouHelper.addDevices(device.DeviceSerial, data, device.ValidateCode, token);//添加设备之后,将权限添加到权限组 + string addMessage = ""; + device.YunMouDeviceId = YunMouHelper.addDevices(device.DeviceSerial, data, device.ValidateCode, token,out addMessage);//添加设备之后,将权限添加到权限组 var res = YunMouHelper.addDevicesToGroups(project.YunMouGroupId, new string[] { device.DeviceSerial }, token);//添加到权限组 if (!string.IsNullOrEmpty(res)) {