diff --git a/projects/IoT.Shared/Application/Domain/Entities/Node.cs b/projects/IoT.Shared/Application/Domain/Entities/Node.cs index 0bbf3054..0c8cab7b 100644 --- a/projects/IoT.Shared/Application/Domain/Entities/Node.cs +++ b/projects/IoT.Shared/Application/Domain/Entities/Node.cs @@ -43,8 +43,6 @@ namespace Application.Domain.Entities public List Devices { get; set; } = new List(); public List Scenes { get; set; } = new List(); - public List Timers { get; set; } = new List(); - public List Tiggers { get; set; } = new List(); public List CategoryNodes { get; set; } = new List(); } } \ No newline at end of file diff --git a/projects/IoT.Shared/Application/Models/EditSceneTiggerModel.cs b/projects/IoT.Shared/Application/Models/EditSceneTiggerModel.cs index 118652d8..921da151 100644 --- a/projects/IoT.Shared/Application/Models/EditSceneTiggerModel.cs +++ b/projects/IoT.Shared/Application/Models/EditSceneTiggerModel.cs @@ -18,17 +18,6 @@ namespace Application.Models [Required(ErrorMessage = nameof(RequiredAttribute))] public Guid SceneId { get; set; } - [Display(Name = "触发器名称")] - public string Name { get; set; } - - [Display(Name = "触发规则")] - [Remote("ConditionValid", "Ajax", "Admin", AdditionalFields = "DataId")] - [Required(ErrorMessage = nameof(RequiredAttribute))] - public string Condition { get; set; } - - [Display(Name = "禁用")] - public bool Disabled { get; set; } - [DataType("SelectList")] [Display(Name = "设备")] [Required(ErrorMessage = nameof(RequiredAttribute))] @@ -38,5 +27,16 @@ namespace Application.Models [Display(Name = "数据")] [Required(ErrorMessage = nameof(RequiredAttribute))] public Guid? DataId { get; set; } + + [Display(Name = "触发规则")] + [Remote("ConditionValid", "Ajax", "Admin", AdditionalFields = "DataId")] + [Required(ErrorMessage = nameof(RequiredAttribute))] + public string Condition { get; set; } + + [Display(Name = "触发器名称")] + public string Name { get; set; } + + [Display(Name = "禁用")] + public bool Disabled { get; set; } } } \ No newline at end of file diff --git a/projects/IoT.Shared/Areas/Admin/Controlls/SceneTiggerController.cs b/projects/IoT.Shared/Areas/Admin/Controlls/SceneTiggerController.cs index 627cac91..187422a2 100644 --- a/projects/IoT.Shared/Areas/Admin/Controlls/SceneTiggerController.cs +++ b/projects/IoT.Shared/Areas/Admin/Controlls/SceneTiggerController.cs @@ -44,6 +44,7 @@ namespace IoT.Shared.Areas.Admin.Controlls { this.ToDisplayModel(entity, model); ViewData.SelectList(o => model.NodeId, () => this._ajax.GetNodeSelectList(model.NodeId)); + ViewData.SelectList(o => model.SceneId, () => this._ajax.GetSceneSelectList(model.NodeId.Value), model.NodeId.HasValue); ViewData.SelectList(o => model.DeviceId, () => this._ajax.GetDeviceSelectList(model.NodeId.Value), model.NodeId.HasValue); ViewData.SelectList(o => model.DataId, () => this._ajax.GetDataSelectList(model.DeviceId.Value), model.DeviceId.HasValue); } @@ -52,7 +53,9 @@ namespace IoT.Shared.Areas.Admin.Controlls { if (entity != null) { + model.NodeId = entity.Data.Device.NodeId; model.DeviceId = entity.Data.DeviceId; + ViewData.Add(model.SceneId, entity.Scene.Name); ViewData.Add(model.NodeId, entity.Scene.Node.Name); ViewData.Add(model.DataId, entity.Data.Name); ViewData.Add(model.DeviceId, entity.Data.Device.DisplayName); diff --git a/projects/IoT.Shared/Areas/Admin/Views/IoTTigger/_Script.cshtml b/projects/IoT.Shared/Areas/Admin/Views/SceneTigger/_Script.cshtml similarity index 84% rename from projects/IoT.Shared/Areas/Admin/Views/IoTTigger/_Script.cshtml rename to projects/IoT.Shared/Areas/Admin/Views/SceneTigger/_Script.cshtml index 97d67a0d..ac3944ed 100644 --- a/projects/IoT.Shared/Areas/Admin/Views/IoTTigger/_Script.cshtml +++ b/projects/IoT.Shared/Areas/Admin/Views/SceneTigger/_Script.cshtml @@ -2,6 +2,7 @@ $(function () { $('#NodeId').change(function () { var id = $(this).find(':selected').val(); + update('@Url.Action("GetSceneJson", "Ajax")', id, "#SceneId"); update('@Url.Action("GetDeviceJson", "Ajax")', id, "#DeviceId"); update(null, null, "#DataId"); diff --git a/projects/IoTCenter/Application/Models/EditGlobalIoTTiggerCommandModel.cs b/projects/IoTCenter/Application/Models/EditGlobalIoTTiggerCommandModel.cs deleted file mode 100644 index d650644c..00000000 --- a/projects/IoTCenter/Application/Models/EditGlobalIoTTiggerCommandModel.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Infrastructure.Application; -using System; -using System.ComponentModel.DataAnnotations; - -namespace IoTCenter.Application.Models -{ - [Display(Name = "平台触发器命令")] - public class EditGlobalIoTTiggerCommandModel : EditModel - { - [Display(Name = "平台触发")] - [DataType("SelectList")] - [Required(ErrorMessage = nameof(RequiredAttribute))] - public Guid? IoTTiggerId { get; set; } - - [Display(Name = "命令节点")] - [DataType("SelectList")] - [Required(ErrorMessage = nameof(RequiredAttribute))] - public Guid? NodeId { get; set; } - - [Display(Name = "命令")] - [DataType("SelectList")] - [Required(ErrorMessage = nameof(RequiredAttribute))] - public Guid? CommandId { get; set; } - } -} \ No newline at end of file diff --git a/projects/IoTCenter/Application/Models/EditGlobalIoTTimerCommandModel.cs b/projects/IoTCenter/Application/Models/EditGlobalIoTTimerCommandModel.cs deleted file mode 100644 index 4bf71175..00000000 --- a/projects/IoTCenter/Application/Models/EditGlobalIoTTimerCommandModel.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Infrastructure.Application; -using System; -using System.ComponentModel.DataAnnotations; - -namespace IoTCenter.Application.Models -{ - [Display(Name = "平台定时器命令")] - public class EditGlobalIoTTimerCommandModel : EditModel - { - [Display(Name = "平台定时器")] - [DataType("SelectList")] - [Required(ErrorMessage = nameof(RequiredAttribute))] - public Guid? IoTTimerId { get; set; } - - [Display(Name = "命令节点")] - [DataType("SelectList")] - [Required(ErrorMessage = nameof(RequiredAttribute))] - public Guid? NodeId { get; set; } - - [Display(Name = "命令")] - [DataType("SelectList")] - [Required(ErrorMessage = nameof(RequiredAttribute))] - public Guid? CommandId { get; set; } - } -} \ No newline at end of file diff --git a/projects/IoTCenter/Application/Models/EditGlobalIoTTiggerModel.cs b/projects/IoTCenter/Application/Models/EditGlobalSceneTiggerModel.cs similarity index 95% rename from projects/IoTCenter/Application/Models/EditGlobalIoTTiggerModel.cs rename to projects/IoTCenter/Application/Models/EditGlobalSceneTiggerModel.cs index ab3f9986..8b1ab07e 100644 --- a/projects/IoTCenter/Application/Models/EditGlobalIoTTiggerModel.cs +++ b/projects/IoTCenter/Application/Models/EditGlobalSceneTiggerModel.cs @@ -6,7 +6,7 @@ using System.ComponentModel.DataAnnotations; namespace IoTCenter.Application.Models { [Display(Name = "平台触发器")] - public class EditGlobalIoTTiggerModel : EditModel + public class EditGlobalSceneTiggerModel : EditModel { [DataType("SelectList")] [Display(Name = "平台场景")] diff --git a/projects/IoTCenter/Application/Models/EditGlobalIoTTimerModel.cs b/projects/IoTCenter/Application/Models/EditGlobalSceneTimerModel.cs similarity index 93% rename from projects/IoTCenter/Application/Models/EditGlobalIoTTimerModel.cs rename to projects/IoTCenter/Application/Models/EditGlobalSceneTimerModel.cs index bcea455c..089db1cf 100644 --- a/projects/IoTCenter/Application/Models/EditGlobalIoTTimerModel.cs +++ b/projects/IoTCenter/Application/Models/EditGlobalSceneTimerModel.cs @@ -6,7 +6,7 @@ using System.ComponentModel.DataAnnotations; namespace IoTCenter.Application.Models { [Display(Name = "平台定时器")] - public class EditGlobalIoTTimerModel : EditModel + public class EditGlobalSceneTimerModel : EditModel { [DataType("SelectList")] [Display(Name = "平台场景")] diff --git a/projects/IoTCenter/Areas/Admin/Controllers/GlobalSceneTiggerController.cs b/projects/IoTCenter/Areas/Admin/Controllers/GlobalSceneTiggerController.cs index bfb8b85d..928ad0fa 100644 --- a/projects/IoTCenter/Areas/Admin/Controllers/GlobalSceneTiggerController.cs +++ b/projects/IoTCenter/Areas/Admin/Controllers/GlobalSceneTiggerController.cs @@ -17,7 +17,7 @@ namespace IoTCenter.Areas.Admin.Controllers { [Authorize] [Area(nameof(Admin))] - public class GlobalSceneTiggerController : CrudController, EditGlobalIoTTiggerModel, EditGlobalIoTTiggerModel> + public class GlobalSceneTiggerController : CrudController, EditGlobalSceneTiggerModel, EditGlobalSceneTiggerModel> { private readonly AjaxController _ajax; private readonly IServiceProvider _sp; @@ -30,29 +30,33 @@ namespace IoTCenter.Areas.Admin.Controllers public override IQueryable Include(IQueryable query) { - return query.Include(o => o.Data).ThenInclude(o => o.Device); + return query + .Include(o => o.Scene).ThenInclude(o => o.Node) + .Include(o => o.Data).ThenInclude(o => o.Device); } - public override IQueryable Query(PagedListModel model, IQueryable query) + public override IQueryable Query(PagedListModel model, IQueryable query) { return query.Where(o => o.Scene.NodeId == null); } - public override void ToEditModel(SceneTigger entity, EditGlobalIoTTiggerModel model) + public override void ToEditModel(SceneTigger entity, EditGlobalSceneTiggerModel model) { this.ToDisplayModel(entity, model); ViewData.SelectList(o => model.DeviceNodeId, () => this._ajax.GetNodeSelectList(model.DeviceNodeId)); + ViewData.SelectList(o => model.SceneId, () => this._ajax.GetGlobalSceneSelectList(model.SceneId)); ViewData.SelectList(o => model.DeviceId, () => this._ajax.GetDeviceSelectList(model.DeviceNodeId.Value), model.DeviceNodeId.HasValue); ViewData.SelectList(o => model.DataId, () => this._ajax.GetDataSelectList(model.DeviceId.Value), model.DeviceId.HasValue); } - public override void ToDisplayModel(SceneTigger entity, EditGlobalIoTTiggerModel model) + public override void ToDisplayModel(SceneTigger entity, EditGlobalSceneTiggerModel model) { if (entity != null) { model.DeviceId = entity.Data.DeviceId; model.DeviceNodeId = entity.Data.Device.NodeId; ViewData.Add(model.DeviceNodeId, entity.Data.Device.DisplayName); + ViewData.Add(model.SceneId, entity.Scene.Name); ViewData.Add(model.DataId, entity.Data.Name); ViewData.Add(model.DeviceId, entity.Data.Device.DisplayName); } diff --git a/projects/IoTCenter/Areas/Admin/Controllers/GlobalSceneTimerController.cs b/projects/IoTCenter/Areas/Admin/Controllers/GlobalSceneTimerController.cs index 8b8468e9..f7b6bdb3 100644 --- a/projects/IoTCenter/Areas/Admin/Controllers/GlobalSceneTimerController.cs +++ b/projects/IoTCenter/Areas/Admin/Controllers/GlobalSceneTimerController.cs @@ -2,10 +2,13 @@ using Application.Domain.Entities; using Infrastructure.Application; using Infrastructure.Data; using Infrastructure.Events; +using Infrastructure.Extensions; using Infrastructure.Web.Mvc; +using IoT.Shared.Areas.Admin.Controlls; using IoTCenter.Application.Models; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.DependencyInjection; using System; using System.Linq; @@ -14,20 +17,40 @@ namespace IoTCenter.Areas.Admin.Controllers { [Authorize] [Area(nameof(Admin))] - public class GlobalSceneTimerController : CrudController, EditGlobalIoTTimerModel, EditGlobalIoTTimerModel> + public class GlobalSceneTimerController : CrudController, EditGlobalSceneTimerModel, EditGlobalSceneTimerModel> { + private readonly AjaxController _ajax; private readonly IServiceProvider _sp; - public GlobalSceneTimerController(IRepository repo, IServiceProvider sp) : base(repo) + public GlobalSceneTimerController(IRepository repo, IServiceProvider sp, AjaxController ajax) : base(repo) { this._sp = sp; + this._ajax = ajax; } - public override IQueryable Query(PagedListModel model, IQueryable query) + public override IQueryable Query(PagedListModel model, IQueryable query) { return query.Where(o => o.Scene.NodeId == null); } + public override IQueryable Include(IQueryable query) + { + return query.Include(o => o.Scene).ThenInclude(o => o.Node); + } + + public override void ToEditModel(SceneTimer entity, EditGlobalSceneTimerModel model) + { + ViewData.SelectList(o => model.SceneId, () => this._ajax.GetGlobalSceneSelectList(model.SceneId)); + } + + public override void ToDisplayModel(SceneTimer entity, EditGlobalSceneTimerModel model) + { + if (entity != null) + { + ViewData.Add(model.SceneId, entity.Scene.Name); + } + } + public override void OnInserted(SceneTimer entity) { using var scope = this._sp.CreateScope(); diff --git a/projects/IoTCenter/Areas/Admin/Views/GlobalIoTTiggerCommand/_Script.cshtml b/projects/IoTCenter/Areas/Admin/Views/GlobalIoTTiggerCommand/_Script.cshtml deleted file mode 100644 index 22df529c..00000000 --- a/projects/IoTCenter/Areas/Admin/Views/GlobalIoTTiggerCommand/_Script.cshtml +++ /dev/null @@ -1,9 +0,0 @@ - \ No newline at end of file diff --git a/projects/IoTCenter/Areas/Admin/Views/GlobalIoTTimerCommand/_Script.cshtml b/projects/IoTCenter/Areas/Admin/Views/GlobalIoTTimerCommand/_Script.cshtml deleted file mode 100644 index 22df529c..00000000 --- a/projects/IoTCenter/Areas/Admin/Views/GlobalIoTTimerCommand/_Script.cshtml +++ /dev/null @@ -1,9 +0,0 @@ - \ No newline at end of file diff --git a/projects/IoTCenter/Areas/Admin/Views/GlobalIoTTigger/_Script.cshtml b/projects/IoTCenter/Areas/Admin/Views/GlobalSceneTigger/_Script.cshtml similarity index 100% rename from projects/IoTCenter/Areas/Admin/Views/GlobalIoTTigger/_Script.cshtml rename to projects/IoTCenter/Areas/Admin/Views/GlobalSceneTigger/_Script.cshtml diff --git a/projects/IoTCenter/Services/IoTCenterEventHandler.cs b/projects/IoTCenter/Services/IoTCenterEventHandler.cs index 39a35428..175e82f9 100644 --- a/projects/IoTCenter/Services/IoTCenterEventHandler.cs +++ b/projects/IoTCenter/Services/IoTCenterEventHandler.cs @@ -56,7 +56,7 @@ namespace IoTCenter.Services public void Handle(EntityInsertedEvent message) { var timer = message.Data; - if (timer.Scene.NodeId == null) + //if (timer.Scene.NodeId == null) { RecurringJob.AddOrUpdate(timer.Id.ToString(), o => o.TimerHanle(timer.Id), timer.Cron, TimeZoneInfo.Local); } @@ -65,7 +65,7 @@ namespace IoTCenter.Services public void Handle(EntityUpdatedEvent message) { var timer = message.Data; - if (timer.Scene.NodeId == null) + //if (timer.Scene.NodeId == null) { RecurringJob.AddOrUpdate(timer.Id.ToString(), o => o.TimerHanle(timer.Id), timer.Cron, TimeZoneInfo.Local); } @@ -74,7 +74,7 @@ namespace IoTCenter.Services public void Handle(EntityDeletedEvent message) { var timer = message.Data; - if (timer.Scene.NodeId == null) + //if (timer.Scene.NodeId == null) { RecurringJob.RemoveIfExists(timer.Id.ToString()); } @@ -87,7 +87,7 @@ namespace IoTCenter.Services public void Handle(EntityInsertedEvent message) { var tigger = message.Data; - if (tigger.Scene.NodeId == null) + //if (tigger.Scene.NodeId == null) { Tiggers.TryRemove(message.Data.Id, out SceneTigger iotTigger); Tiggers.TryAdd(tigger.Id, tigger); @@ -97,7 +97,7 @@ namespace IoTCenter.Services public void Handle(EntityUpdatedEvent message) { var tigger = message.Data; - if (tigger.Scene.NodeId == null) + //if (tigger.Scene.NodeId == null) { Tiggers.TryRemove(message.Data.Id, out SceneTigger iotTigger); Tiggers.TryAdd(tigger.Id, tigger); @@ -107,7 +107,7 @@ namespace IoTCenter.Services public void Handle(EntityDeletedEvent message) { var tigger = message.Data; - if (tigger.Scene.NodeId == null) + //if (tigger.Scene.NodeId == null) { Tiggers.TryRemove(tigger.Id, out SceneTigger iotTigger); } diff --git a/projects/IoTCenter/Services/IoTCenterJob.cs b/projects/IoTCenter/Services/IoTCenterJob.cs index ea4494c5..96c720c9 100644 --- a/projects/IoTCenter/Services/IoTCenterJob.cs +++ b/projects/IoTCenter/Services/IoTCenterJob.cs @@ -24,17 +24,16 @@ namespace IoTCenter.Services public void TimerHanle(Guid timerId) { + Console.WriteLine($"global timer exec:{timerId}"); var timer = this._sceneTimerRepo.ReadOnlyTable() - .Include(o => o.Scene) - .ThenInclude(o => o.Node) - .Include(o => o.Scene) - .ThenInclude(o => o.SceneCommands) + .Include(o => o.Scene).ThenInclude(o => o.SceneCommands).ThenInclude(o => o.Command).ThenInclude(o => o.Device).ThenInclude(o => o.Node) .FirstOrDefault(o => o.Id == timerId); + foreach (var sceneCommand in timer.Scene.SceneCommands) { try { - this._hub.ServerToClient(Methods.ExecCommand, sceneCommand.CommandId, timer.Scene.Node.Number, null); + this._hub.ServerToClient(Methods.ExecCommand, sceneCommand.CommandId, sceneCommand.Command.Device.Node.Number, null); } catch (Exception ex) { @@ -45,17 +44,15 @@ namespace IoTCenter.Services public void TiggerHandle(Guid tiggerId) { + Console.WriteLine($"global tigger exec:{tiggerId}"); var tigger = this._sceneTiggerRepo.ReadOnlyTable() - .Include(o => o.Scene) - .ThenInclude(o => o.Node) - .Include(o => o.Scene) - .ThenInclude(o => o.SceneCommands) + .Include(o => o.Scene).ThenInclude(o => o.SceneCommands).ThenInclude(o => o.Command).ThenInclude(o => o.Device).ThenInclude(o => o.Node) .FirstOrDefault(o => o.Id == tiggerId); foreach (var sceneCommand in tigger.Scene.SceneCommands) { try { - this._hub.ServerToClient(Methods.ExecCommand, sceneCommand.CommandId, tigger.Scene.Node.Number, null); + this._hub.ServerToClient(Methods.ExecCommand, sceneCommand.CommandId, sceneCommand.Command.Device.Node.Number, null); } catch (Exception ex) { diff --git a/projects/IoTCenter/appsettings.json b/projects/IoTCenter/appsettings.json index 5ca3d251..1a8f7f5b 100644 --- a/projects/IoTCenter/appsettings.json +++ b/projects/IoTCenter/appsettings.json @@ -1,5 +1,5 @@ { - "version": "1.0.0-alpha.213", + "version": "1.0.0-alpha.214", "Logging": { "LogLevel": { "Default": "Warning", diff --git a/projects/IoTClient/Assembly-CSharp.csproj b/projects/IoTClient/Assembly-CSharp.csproj index 16c2d17c..074fb341 100644 --- a/projects/IoTClient/Assembly-CSharp.csproj +++ b/projects/IoTClient/Assembly-CSharp.csproj @@ -65,18 +65,6 @@ - - D:/1.0/ZHXY/projects/IoTClient/Library/ScriptAssemblies/Unity.TextMeshPro.Editor.dll - - - D:/1.0/ZHXY/projects/IoTClient/Library/ScriptAssemblies/Unity.CollabProxy.Editor.dll - - - D:/1.0/ZHXY/projects/IoTClient/Library/ScriptAssemblies/Unity.TextMeshPro.dll - - - D:/1.0/ZHXY/projects/IoTClient/Library/ScriptAssemblies/Unity.Analytics.DataPrivacy.dll - D:/1.0/ZHXY/projects/IoTClient/Library/ScriptAssemblies/Unity.Timeline.Editor.dll @@ -86,12 +74,18 @@ D:/1.0/ZHXY/projects/IoTClient/Library/ScriptAssemblies/Unity.VSCode.Editor.dll + + D:/1.0/ZHXY/projects/IoTClient/Library/ScriptAssemblies/Unity.TextMeshPro.Editor.dll + D:/1.0/ZHXY/projects/IoTClient/Library/ScriptAssemblies/UnityEngine.UI.dll D:/1.0/ZHXY/projects/IoTClient/Library/ScriptAssemblies/Unity.Timeline.dll + + D:/1.0/ZHXY/projects/IoTClient/Library/ScriptAssemblies/Unity.CollabProxy.Editor.dll + D:/1.0/ZHXY/projects/IoTClient/Library/ScriptAssemblies/com.unity.multiplayer-weaver.Editor.dll @@ -113,6 +107,12 @@ D:/1.0/ZHXY/projects/IoTClient/Library/ScriptAssemblies/UnityEngine.SpatialTracking.dll + + D:/1.0/ZHXY/projects/IoTClient/Library/ScriptAssemblies/Unity.TextMeshPro.dll + + + D:/1.0/ZHXY/projects/IoTClient/Library/ScriptAssemblies/Unity.Analytics.DataPrivacy.dll + D:/1.0/ZHXY/projects/IoTClient/Library/ScriptAssemblies/UnityEditor.XR.LegacyInputHelpers.dll @@ -314,6 +314,12 @@ D:/1.0/ZHXY/projects/IoTClient/Library/PackageCache/com.unity.analytics@3.3.2/Unity.Analytics.Tracker.dll + + D:/ProgramFiles/Unity/2019.2.21f1/Editor/Data/PlaybackEngines/iOSSupport/UnityEditor.iOS.Extensions.Xcode.dll + + + D:/ProgramFiles/Unity/2019.2.21f1/Editor/Data/PlaybackEngines/iOSSupport/UnityEditor.iOS.Extensions.Common.dll + D:/ProgramFiles/Unity/2019.2.21f1/Editor/Data/NetStandard/ref/2.0.0/netstandard.dll diff --git a/projects/IoTClient/Assets/Scripts/WebViewController.cs b/projects/IoTClient/Assets/Scripts/WebViewController.cs index 1940a0a0..310cb47a 100644 --- a/projects/IoTClient/Assets/Scripts/WebViewController.cs +++ b/projects/IoTClient/Assets/Scripts/WebViewController.cs @@ -13,6 +13,7 @@ public class WebViewController : MonoBehaviour private void Start() { + UniWebView.SetWebContentsDebuggingEnabled(true); UniWebView.SetAllowAutoPlay(true); UniWebView.SetAllowInlinePlay(true); var webViewGameObject = new GameObject("UniWebView"); diff --git a/projects/IoTClient/ProjectSettings/ProjectSettings.asset b/projects/IoTClient/ProjectSettings/ProjectSettings.asset index 4bbb0a2e..e6d3de6f 100644 --- a/projects/IoTClient/ProjectSettings/ProjectSettings.asset +++ b/projects/IoTClient/ProjectSettings/ProjectSettings.asset @@ -170,7 +170,7 @@ PlayerSettings: buildNumber: {} AndroidBundleVersionCode: 1 AndroidMinSdkVersion: 22 - AndroidTargetSdkVersion: 0 + AndroidTargetSdkVersion: 26 AndroidPreferredInstallLocation: 1 aotOptions: stripEngineCode: 1 diff --git a/projects/IoTClient/iot.apk b/projects/IoTClient/iot.apk index 1c52846f..d054cba2 100644 Binary files a/projects/IoTClient/iot.apk and b/projects/IoTClient/iot.apk differ diff --git a/projects/IoTNode/Services/IoTNodeJob.cs b/projects/IoTNode/Services/IoTNodeJob.cs index 71a2cf32..c52bd40b 100644 --- a/projects/IoTNode/Services/IoTNodeJob.cs +++ b/projects/IoTNode/Services/IoTNodeJob.cs @@ -22,8 +22,10 @@ namespace IoTNode.Services public void TimerHanle(Guid timerId) { + Console.WriteLine($"node timer exec:{timerId}"); var commands = this._sceneTimerRepo.ReadOnlyTable() - .Include(o => o.Scene).ThenInclude(o => o.SceneCommands).ThenInclude(o => o.Command) + .Include(o => o.Scene).ThenInclude(o => o.SceneCommands).ThenInclude(o => o.Command).ThenInclude(o => o.Api) + .Include(o => o.Scene).ThenInclude(o => o.SceneCommands).ThenInclude(o => o.Command).ThenInclude(o => o.Device) .Where(o => o.Id == timerId) .SelectMany(o => o.Scene.SceneCommands) .Select(o => o.Command) @@ -33,8 +35,10 @@ namespace IoTNode.Services public void TiggerHandle(Guid tiggerId) { + Console.WriteLine($"global tigger exec:{tiggerId}"); var commands = this._sceneTiggerRepo.ReadOnlyTable() - .Include(o => o.Scene).ThenInclude(o => o.SceneCommands).ThenInclude(o => o.Command) + .Include(o => o.Scene).ThenInclude(o => o.SceneCommands).ThenInclude(o => o.Command).ThenInclude(o => o.Api) + .Include(o => o.Scene).ThenInclude(o => o.SceneCommands).ThenInclude(o => o.Command).ThenInclude(o => o.Device) .Where(o => o.Id == tiggerId) .SelectMany(o => o.Scene.SceneCommands) .Select(o => o.Command) diff --git a/projects/WebApp/wwwroot/pages/iot/device/socket.html b/projects/WebApp/wwwroot/pages/iot/device/socket.html index f8a2c22f..175f040b 100644 --- a/projects/WebApp/wwwroot/pages/iot/device/socket.html +++ b/projects/WebApp/wwwroot/pages/iot/device/socket.html @@ -12,7 +12,7 @@
- {{electricity}} kW‧h + {{electricity}} kW‧h
@@ -25,8 +25,11 @@ ({ props: ['device'], computed: { + isSmart: function () { + return Enumerable.from(this.device.data).any(function (o) { return o.name === "电量"; }); + }, electricity: function () { - return parseFloat(getDeviceDataValue(this.device, '电量')||0).toFixed(2); + return parseFloat(getDeviceDataValue(this.device, '电量') || 0).toFixed(2); } } }); diff --git a/projects/WebApp/wwwroot/pages/iot/node.html b/projects/WebApp/wwwroot/pages/iot/node.html index e3742f08..43071f34 100644 --- a/projects/WebApp/wwwroot/pages/iot/node.html +++ b/projects/WebApp/wwwroot/pages/iot/node.html @@ -11,11 +11,13 @@
场景
-
-
- +
+
+
+ +
+

{{scene.name}}

-

{{scene.name}}

@@ -60,6 +62,11 @@
+ +
+ +
+
diff --git a/projects/WebApp/wwwroot/pages/iot/scenes.html b/projects/WebApp/wwwroot/pages/iot/scenes.html index c4b64176..eeb86790 100644 --- a/projects/WebApp/wwwroot/pages/iot/scenes.html +++ b/projects/WebApp/wwwroot/pages/iot/scenes.html @@ -6,11 +6,11 @@

{{title}}

- +

{{scene.name}}

- +
\ No newline at end of file