识别信息返回

This commit is contained in:
2026-01-04 15:03:51 +08:00
parent 07aa1370e2
commit c634ac486e
3 changed files with 11 additions and 5 deletions
+6 -2
View File
@@ -80,17 +80,21 @@ namespace BLL.Common
/// <param name="validateCode"></param>
/// <param name="access_token"></param>
/// <returns></returns>
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<dynamic>(result);
if (j2.code == "200")
{
res = j2.message;
return j2.data.groupId;
}
else
{
res = j2.message;
return "";
}
}
@@ -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);
}
}
@@ -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))
{