Former-commit-id: 13d9d17fec7aeeb3249787551eaab3cfea0ff122
TangShanKaiPing
wanggang 6 years ago
parent 86d23573a9
commit 400ba613c1

@ -8,7 +8,8 @@
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>10.0.20506</ProductVersion> <ProductVersion>10.0.20506</ProductVersion>
<SchemaVersion>2.0</SchemaVersion> <SchemaVersion>2.0</SchemaVersion>
<RootNamespace></RootNamespace> <RootNamespace>
</RootNamespace>
<ProjectGuid>{EF6565BD-C12A-AF2F-9766-E75AAE388FD9}</ProjectGuid> <ProjectGuid>{EF6565BD-C12A-AF2F-9766-E75AAE388FD9}</ProjectGuid>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
@ -336,6 +337,91 @@
<Compile Include="Assets\UniWebView\Script\UniWebViewTransitionEdge.cs" /> <Compile Include="Assets\UniWebView\Script\UniWebViewTransitionEdge.cs" />
<None Include="Assets\StreamingAssets\haarcascade_frontalface_alt.xml" /> <None Include="Assets\StreamingAssets\haarcascade_frontalface_alt.xml" />
<None Include="Assets\StreamingAssets\lbpcascade_frontalface.xml" /> <None Include="Assets\StreamingAssets\lbpcascade_frontalface.xml" />
<None Include="Assets\StreamingAssets\wwwroot\css.meta" />
<None Include="Assets\StreamingAssets\wwwroot\css\app.css.meta" />
<None Include="Assets\StreamingAssets\wwwroot\css\framework7-icons.css.meta" />
<None Include="Assets\StreamingAssets\wwwroot\fonts.meta" />
<None Include="Assets\StreamingAssets\wwwroot\fonts\Framework7Icons-Regular.eot" />
<None Include="Assets\StreamingAssets\wwwroot\fonts\Framework7Icons-Regular.eot.meta" />
<None Include="Assets\StreamingAssets\wwwroot\fonts\Framework7Icons-Regular.ttf" />
<None Include="Assets\StreamingAssets\wwwroot\fonts\Framework7Icons-Regular.ttf.meta" />
<None Include="Assets\StreamingAssets\wwwroot\fonts\Framework7Icons-Regular.woff" />
<None Include="Assets\StreamingAssets\wwwroot\fonts\Framework7Icons-Regular.woff.meta" />
<None Include="Assets\StreamingAssets\wwwroot\fonts\Framework7Icons-Regular.woff2" />
<None Include="Assets\StreamingAssets\wwwroot\fonts\Framework7Icons-Regular.woff2.meta" />
<None Include="Assets\StreamingAssets\wwwroot\fonts\MaterialIcons-Regular.eot" />
<None Include="Assets\StreamingAssets\wwwroot\fonts\MaterialIcons-Regular.eot.meta" />
<None Include="Assets\StreamingAssets\wwwroot\fonts\MaterialIcons-Regular.ttf" />
<None Include="Assets\StreamingAssets\wwwroot\fonts\MaterialIcons-Regular.ttf.meta" />
<None Include="Assets\StreamingAssets\wwwroot\fonts\MaterialIcons-Regular.woff" />
<None Include="Assets\StreamingAssets\wwwroot\fonts\MaterialIcons-Regular.woff.meta" />
<None Include="Assets\StreamingAssets\wwwroot\fonts\MaterialIcons-Regular.woff2" />
<None Include="Assets\StreamingAssets\wwwroot\fonts\MaterialIcons-Regular.woff2.meta" />
<None Include="Assets\StreamingAssets\wwwroot\images.meta" />
<None Include="Assets\StreamingAssets\wwwroot\images\alarm.png.meta" />
<None Include="Assets\StreamingAssets\wwwroot\images\ap.png.meta" />
<None Include="Assets\StreamingAssets\wwwroot\images\back.png.meta" />
<None Include="Assets\StreamingAssets\wwwroot\images\camera.png.meta" />
<None Include="Assets\StreamingAssets\wwwroot\images\co2.png.meta" />
<None Include="Assets\StreamingAssets\wwwroot\images\control.png.meta" />
<None Include="Assets\StreamingAssets\wwwroot\images\curtain.png.meta" />
<None Include="Assets\StreamingAssets\wwwroot\images\door.png.meta" />
<None Include="Assets\StreamingAssets\wwwroot\images\down.png.meta" />
<None Include="Assets\StreamingAssets\wwwroot\images\humidity.png.meta" />
<None Include="Assets\StreamingAssets\wwwroot\images\left.png.meta" />
<None Include="Assets\StreamingAssets\wwwroot\images\light.png.meta" />
<None Include="Assets\StreamingAssets\wwwroot\images\mute.png.meta" />
<None Include="Assets\StreamingAssets\wwwroot\images\pc.png.meta" />
<None Include="Assets\StreamingAssets\wwwroot\images\pm25.png.meta" />
<None Include="Assets\StreamingAssets\wwwroot\images\right.png.meta" />
<None Include="Assets\StreamingAssets\wwwroot\images\socket.png.meta" />
<None Include="Assets\StreamingAssets\wwwroot\images\sp.png.meta" />
<None Include="Assets\StreamingAssets\wwwroot\images\stop.png.meta" />
<None Include="Assets\StreamingAssets\wwwroot\images\switch.png.meta" />
<None Include="Assets\StreamingAssets\wwwroot\images\up.png.meta" />
<None Include="Assets\StreamingAssets\wwwroot\images\volume.png.meta" />
<None Include="Assets\StreamingAssets\wwwroot\images\zoomin.png.meta" />
<None Include="Assets\StreamingAssets\wwwroot\images\zoomout.png.meta" />
<None Include="Assets\StreamingAssets\wwwroot\index.html.meta" />
<None Include="Assets\StreamingAssets\wwwroot\js.meta" />
<None Include="Assets\StreamingAssets\wwwroot\js\app.js.meta" />
<None Include="Assets\StreamingAssets\wwwroot\lib.meta" />
<None Include="Assets\StreamingAssets\wwwroot\lib\Chart.js.meta" />
<None Include="Assets\StreamingAssets\wwwroot\lib\Chart.js\Chart.bundle.min.js.meta" />
<None Include="Assets\StreamingAssets\wwwroot\lib\dayjs.meta" />
<None Include="Assets\StreamingAssets\wwwroot\lib\dayjs\dayjs.min.js.meta" />
<None Include="Assets\StreamingAssets\wwwroot\lib\flv.js.meta" />
<None Include="Assets\StreamingAssets\wwwroot\lib\flv.js\flv.min.js.meta" />
<None Include="Assets\StreamingAssets\wwwroot\lib\framework7.meta" />
<None Include="Assets\StreamingAssets\wwwroot\lib\framework7\css.meta" />
<None Include="Assets\StreamingAssets\wwwroot\lib\framework7\css\framework7.bundle.min.css.meta" />
<None Include="Assets\StreamingAssets\wwwroot\lib\framework7\js.meta" />
<None Include="Assets\StreamingAssets\wwwroot\lib\framework7\js\framework7-vue.bundle.min.js.meta" />
<None Include="Assets\StreamingAssets\wwwroot\lib\framework7\js\framework7.bundle.min.js.meta" />
<None Include="Assets\StreamingAssets\wwwroot\lib\jquery.ajax.unobtrusive.meta" />
<None Include="Assets\StreamingAssets\wwwroot\lib\jquery.ajax.unobtrusive\jquery.unobtrusive-ajax.min.js.meta" />
<None Include="Assets\StreamingAssets\wwwroot\lib\jquery.meta" />
<None Include="Assets\StreamingAssets\wwwroot\lib\jquery.validation.meta" />
<None Include="Assets\StreamingAssets\wwwroot\lib\jquery.validation.unobtrusive.meta" />
<None Include="Assets\StreamingAssets\wwwroot\lib\jquery.validation.unobtrusive\jquery.validate.unobtrusive.min.js.meta" />
<None Include="Assets\StreamingAssets\wwwroot\lib\jquery.validation\jquery.validate.min.js.meta" />
<None Include="Assets\StreamingAssets\wwwroot\lib\jquery.validation\localization.meta" />
<None Include="Assets\StreamingAssets\wwwroot\lib\jquery.validation\localization\messages_zh.min.js.meta" />
<None Include="Assets\StreamingAssets\wwwroot\lib\jquery\jquery.min.js.meta" />
<None Include="Assets\StreamingAssets\wwwroot\lib\lodash.meta" />
<None Include="Assets\StreamingAssets\wwwroot\lib\lodash\lodash.min.js.meta" />
<None Include="Assets\StreamingAssets\wwwroot\lib\mobile.detect.meta" />
<None Include="Assets\StreamingAssets\wwwroot\lib\mobile.detect\mobile-detect.min.js.meta" />
<None Include="Assets\StreamingAssets\wwwroot\lib\signalr.meta" />
<None Include="Assets\StreamingAssets\wwwroot\lib\signalr\signalr.min.js.meta" />
<None Include="Assets\StreamingAssets\wwwroot\lib\URI.js.meta" />
<None Include="Assets\StreamingAssets\wwwroot\lib\URI.js\URI.min.js.meta" />
<None Include="Assets\StreamingAssets\wwwroot\lib\vue.meta" />
<None Include="Assets\StreamingAssets\wwwroot\lib\vue\vue.min.js.meta" />
<None Include="Assets\StreamingAssets\wwwroot\lib\weui.meta" />
<None Include="Assets\StreamingAssets\wwwroot\lib\weui\example.css.meta" />
<None Include="Assets\StreamingAssets\wwwroot\lib\weui\weui.min.css.meta" />
<None Include="Assets\StreamingAssets\wwwroot\lib\weui\weui.min.js.meta" />
<None Include="Assets\UniversalMediaPlayer\Shaders\UMP-TransparentCanvas.shader" /> <None Include="Assets\UniversalMediaPlayer\Shaders\UMP-TransparentCanvas.shader" />
<None Include="Assets\OpenCVForUnity\Plugins\macOS\opencvforunity.bundle\Contents\Resources\gl3w\readme.txt" /> <None Include="Assets\OpenCVForUnity\Plugins\macOS\opencvforunity.bundle\Contents\Resources\gl3w\readme.txt" />
<None Include="Assets\UniversalMediaPlayer\Shaders\UMP-QuadrantCanvas(Linear).shader" /> <None Include="Assets\UniversalMediaPlayer\Shaders\UMP-QuadrantCanvas(Linear).shader" />
@ -921,6 +1007,56 @@
<HintPath>D:/ProgramFiles/Unity/2018.3.14f1/Editor/Data/NetStandard/compat/2.0.0/shims/netfx/System.Xml.Serialization.dll</HintPath> <HintPath>D:/ProgramFiles/Unity/2018.3.14f1/Editor/Data/NetStandard/compat/2.0.0/shims/netfx/System.Xml.Serialization.dll</HintPath>
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup>
<Content Include="Assets\StreamingAssets\wwwroot\css\app.css" />
<Content Include="Assets\StreamingAssets\wwwroot\css\framework7-icons.css" />
<Content Include="Assets\StreamingAssets\wwwroot\images\alarm.png" />
<Content Include="Assets\StreamingAssets\wwwroot\images\ap.png" />
<Content Include="Assets\StreamingAssets\wwwroot\images\back.png" />
<Content Include="Assets\StreamingAssets\wwwroot\images\camera.png" />
<Content Include="Assets\StreamingAssets\wwwroot\images\co2.png" />
<Content Include="Assets\StreamingAssets\wwwroot\images\control.png" />
<Content Include="Assets\StreamingAssets\wwwroot\images\curtain.png" />
<Content Include="Assets\StreamingAssets\wwwroot\images\door.png" />
<Content Include="Assets\StreamingAssets\wwwroot\images\down.png" />
<Content Include="Assets\StreamingAssets\wwwroot\images\humidity.png" />
<Content Include="Assets\StreamingAssets\wwwroot\images\left.png" />
<Content Include="Assets\StreamingAssets\wwwroot\images\light.png" />
<Content Include="Assets\StreamingAssets\wwwroot\images\mute.png" />
<Content Include="Assets\StreamingAssets\wwwroot\images\pc.png" />
<Content Include="Assets\StreamingAssets\wwwroot\images\pm25.png" />
<Content Include="Assets\StreamingAssets\wwwroot\images\right.png" />
<Content Include="Assets\StreamingAssets\wwwroot\images\socket.png" />
<Content Include="Assets\StreamingAssets\wwwroot\images\sp.png" />
<Content Include="Assets\StreamingAssets\wwwroot\images\stop.png" />
<Content Include="Assets\StreamingAssets\wwwroot\images\switch.png" />
<Content Include="Assets\StreamingAssets\wwwroot\images\up.png" />
<Content Include="Assets\StreamingAssets\wwwroot\images\volume.png" />
<Content Include="Assets\StreamingAssets\wwwroot\images\zoomin.png" />
<Content Include="Assets\StreamingAssets\wwwroot\images\zoomout.png" />
<Content Include="Assets\StreamingAssets\wwwroot\index.html" />
<Content Include="Assets\StreamingAssets\wwwroot\js\app.js" />
<Content Include="Assets\StreamingAssets\wwwroot\lib\Chart.js\Chart.bundle.min.js" />
<Content Include="Assets\StreamingAssets\wwwroot\lib\dayjs\dayjs.min.js" />
<Content Include="Assets\StreamingAssets\wwwroot\lib\flv.js\flv.min.js" />
<Content Include="Assets\StreamingAssets\wwwroot\lib\framework7\css\framework7.bundle.min.css" />
<Content Include="Assets\StreamingAssets\wwwroot\lib\framework7\js\framework7-vue.bundle.min.js" />
<Content Include="Assets\StreamingAssets\wwwroot\lib\framework7\js\framework7.bundle.min.js" />
<Content Include="Assets\StreamingAssets\wwwroot\lib\jquery.ajax.unobtrusive\jquery.unobtrusive-ajax.min.js" />
<Content Include="Assets\StreamingAssets\wwwroot\lib\jquery.validation.unobtrusive\jquery.validate.unobtrusive.min.js" />
<Content Include="Assets\StreamingAssets\wwwroot\lib\jquery.validation\jquery.validate.min.js" />
<Content Include="Assets\StreamingAssets\wwwroot\lib\jquery.validation\localization\messages_zh.min.js" />
<Content Include="Assets\StreamingAssets\wwwroot\lib\jquery\jquery.min.js" />
<Content Include="Assets\StreamingAssets\wwwroot\lib\lodash\lodash.min.js" />
<Content Include="Assets\StreamingAssets\wwwroot\lib\mobile.detect\mobile-detect.min.js" />
<Content Include="Assets\StreamingAssets\wwwroot\lib\signalr\signalr.min.js" />
<Content Include="Assets\StreamingAssets\wwwroot\lib\URI.js\URI.min.js" />
<Content Include="Assets\StreamingAssets\wwwroot\lib\vue\vue.min.js" />
<Content Include="Assets\StreamingAssets\wwwroot\lib\weui\example.css" />
<Content Include="Assets\StreamingAssets\wwwroot\lib\weui\weui.min.css" />
<Content Include="Assets\StreamingAssets\wwwroot\lib\weui\weui.min.js" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="GenerateTargetFrameworkMonikerAttribute" /> <Target Name="GenerateTargetFrameworkMonikerAttribute" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<ProjectView>ProjectFiles</ProjectView> <ProjectView>ShowAllFiles</ProjectView>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

@ -679,7 +679,6 @@
</div> </div>
</div> </div>
</template> </template>
<template v-if="getDevices('串口控制器').length"> <template v-if="getDevices('串口控制器').length">
<div class="block-title">串口控制器</div> <div class="block-title">串口控制器</div>
<div class="block block-strong"> <div class="block block-strong">

@ -1,162 +1,164 @@
//using Application.Domain.Entities; using Application.Domain.Entities;
//using Application.Models; using Application.Models;
//using Application.Services; using Application.Services;
//using Infrastructure.Data; using Infrastructure.Data;
//using Infrastructure.Extensions; using Infrastructure.Extensions;
//using Infrastructure.Jwt; using Infrastructure.Jwt;
//using IoTShared; using IoTShared;
//using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
//using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
//using Microsoft.AspNetCore.SignalR; using Microsoft.AspNetCore.SignalR;
//using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
//using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
//using Newtonsoft.Json; using Newtonsoft.Json;
//using System; using System;
//using System.Collections.Generic; using System.Collections.Generic;
//using System.Linq; using System.Linq;
//using Vibrant.InfluxDB.Client; using Vibrant.InfluxDB.Client;
//using Vibrant.InfluxDB.Client.Rows; using Vibrant.InfluxDB.Client.Rows;
//namespace IoTCenter.Controllers namespace IoTCenter.Controllers
//{ {
// public class AppController : Controller public class AppController : Controller
// { {
// private readonly IConfiguration _configuration; private readonly IConfiguration _configuration;
// private readonly IJwtHelper _jwtHelper; private readonly IJwtHelper _jwtHelper;
// private readonly IRepository<Node> _nodeRepo; private readonly IRepository<Node> _nodeRepo;
// private readonly IRepository<Device> _deviceRepo; private readonly IRepository<Device> _deviceRepo;
// private readonly IHubContext<PageHub> _pageHubContext; private readonly IHubContext<PageHub> _pageHubContext;
// public AppController(IConfiguration configuration, public AppController(IConfiguration configuration,
// IJwtHelper jwtHelper, IJwtHelper jwtHelper,
// IRepository<Node> nodeRepo, IRepository<Node> nodeRepo,
// IRepository<Device> deviceRepo, IRepository<Device> deviceRepo,
// IHubContext<PageHub> pageHubContext) IHubContext<PageHub> pageHubContext)
// { {
// this._configuration = configuration; this._configuration = configuration;
// this._jwtHelper = jwtHelper; this._jwtHelper = jwtHelper;
// this._nodeRepo = nodeRepo; this._nodeRepo = nodeRepo;
// this._deviceRepo = deviceRepo; this._deviceRepo = deviceRepo;
// this._pageHubContext = pageHubContext; this._pageHubContext = pageHubContext;
// } }
// [Authorize] [Authorize]
// public IActionResult Index() public IActionResult Index()
// { {
// return View(); return View();
// } }
// public IActionResult GetNodes(string token) public IActionResult GetNodes(string token)
// { {
// var userName = this._jwtHelper.GetPayload(token)["UserName"].ToString(); var userName = this._jwtHelper.GetPayload(token)["UserName"].ToString();
// var model = this._nodeRepo.ReadOnlyTable() var model = this._nodeRepo.ReadOnlyTable()
// .Select(o => new { o.Id, o.Number, o.Name, o.DisplayOrder, Count = o.Devices.Count }) .Select(o => new { o.Id, o.Number, o.Name, o.DisplayOrder, Count = o.Devices.Count })
// .ToList(); .ToList();
// return Json(model); return Json(model);
// } }
// public IActionResult GetNode(string token, string number) public IActionResult GetNode(string token, string number)
// { {
// var userName = this._jwtHelper.GetPayload(token)["UserName"].ToString(); var userName = this._jwtHelper.GetPayload(token)["UserName"].ToString();
// var model = this._nodeRepo.ReadOnlyTable() var model = this._nodeRepo.ReadOnlyTable()
// .Include(o => o.Sences) .Include(o => o.Scenes)
// .Include(o => o.Devices).ThenInclude(o => o.Data) .Include(o => o.Devices).ThenInclude(o => o.Data)
// .FirstOrDefault(o => o.Number == number); .FirstOrDefault(o => o.Number == number);
// return Json(model, new JsonSerializerSettings { ReferenceLoopHandling = ReferenceLoopHandling.Ignore }); return Json(model, new JsonSerializerSettings { ReferenceLoopHandling = ReferenceLoopHandling.Ignore });
// } }
// public IActionResult GetDevice(string token, string number) public IActionResult GetDevice(string token, string number)
// { {
// var userName = this._jwtHelper.GetPayload(token)["UserName"].ToString(); var userName = this._jwtHelper.GetPayload(token)["UserName"].ToString();
// var model = this._deviceRepo.ReadOnlyTable() var model = this._deviceRepo.ReadOnlyTable()
// .Include(o => o.Data) .Include(o => o.Data)
// .Include(o => o.Apis).ThenInclude(o => o.Parameters) //.Include(o => o.Apis).ThenInclude(o => o.Parameters)
// .FirstOrDefault(o => o.Number == number); .FirstOrDefault(o => o.Number == number);
// return Json(model, new JsonSerializerSettings { ReferenceLoopHandling = ReferenceLoopHandling.Ignore }); return Json(model, new JsonSerializerSettings { ReferenceLoopHandling = ReferenceLoopHandling.Ignore });
// } }
// public IActionResult Exec(string connectionId, string node, string cmd, Guid id) public IActionResult Exec(string connectionId, string node, string cmd, Guid id)
// { {
// try try
// { {
// var query = string.Empty; var query = string.Empty;
// foreach (var item in Request.Query.Where(o => o.Key != "node" && o.Key != "cmd" && !o.Key.StartsWith("id"))) foreach (var item in Request.Query.Where(o => o.Key != "node" && o.Key != "cmd" && !o.Key.StartsWith("id")))
// { {
// query = query.SetParam(item.Key, item.Value); query = query.SetParam(item.Key, item.Value);
// } }
// this._pageHubContext.Clients.Group(node).SendAsync(nameof(INodeService.Exec), connectionId, id, cmd, query); this._pageHubContext.Clients.Group(node).SendAsync(nameof(INodeService.Exec), connectionId, id, cmd, query);
// return Json(ApiResponse.AsyncSuccess()); return Json(ApiResponse.AsyncSuccess());
// } }
// catch (Exception ex) catch (Exception ex)
// { {
// ex.PrintStack(); ex.PrintStack();
// return Json(ApiResponse.Error(ex)); return Json(ApiResponse.Error(ex));
// } }
// } }
// public IActionResult ExecAll(string connectionId, string node, string cmd, List<Guid> id) public IActionResult ExecAll(string connectionId, string node, string cmd, List<Guid> id)
// { {
// try try
// { {
// var query = string.Empty; var query = string.Empty;
// foreach (var item in Request.Query.Where(o => o.Key != "node" && o.Key != "cmd" && !o.Key.StartsWith("id["))) foreach (var item in Request.Query.Where(o => o.Key != "node" && o.Key != "cmd" && !o.Key.StartsWith("id[")))
// { {
// query = query.SetParam(item.Key, item.Value); query = query.SetParam(item.Key, item.Value);
// } }
// this._pageHubContext.Clients.Group(node).SendAsync(nameof(INodeService.ExecAll), connectionId, id, cmd, query); this._pageHubContext.Clients.Group(node).SendAsync(nameof(INodeService.ExecAll), connectionId, id, cmd, query);
// return Json(ApiResponse.AsyncSuccess()); return Json(ApiResponse.AsyncSuccess());
// } }
// catch (Exception ex) catch (Exception ex)
// { {
// ex.PrintStack(); ex.PrintStack();
// return Json(ApiResponse.Error(ex)); return Json(ApiResponse.Error(ex));
// } }
// } }
// public IActionResult Sence(string connectionId, string node, Guid id) public IActionResult Sence(string connectionId, string node, Guid id)
// { {
// try try
// { {
// this._pageHubContext.Clients.Group(node).SendAsync(nameof(INodeService.Sence), connectionId, id); this._pageHubContext.Clients.Group(node).SendAsync(nameof(INodeService.Sence), connectionId, id);
// return Json(ApiResponse.AsyncSuccess()); return Json(ApiResponse.AsyncSuccess());
// } }
// catch (Exception ex) catch (Exception ex)
// { {
// ex.PrintStack(); ex.PrintStack();
// return Json(ApiResponse.Error(ex)); return Json(ApiResponse.Error(ex));
// } }
// } }
// public IActionResult Data(Guid id, string time = "10m") public IActionResult Data(Guid id, string time = "10m")
// { {
// var device = this._deviceRepo.ReadOnlyTable().Include(o => o.Node).Include(o => o.Data).FirstOrDefault(o => o.Id == id); var device = this._deviceRepo.ReadOnlyTable().Include(o => o.Node).Include(o => o.Data).FirstOrDefault(o => o.Id == id);
// var url = this._configuration["influxdb:url"]; var url = this._configuration["influxdb:url"];
// var usr = this._configuration["influxdb:usr"]; var usr = this._configuration["influxdb:usr"];
// var pwd = this._configuration["influxdb:pwd"]; var pwd = this._configuration["influxdb:pwd"];
// var dbName = "iot"; var dbName = "iot";
// var measurementName = "data"; var measurementName = "data";
// var list = new List<object>(); var list = new List<object>();
// using (var client = new InfluxClient(new Uri(url), usr, pwd)) using (var client = new InfluxClient(new Uri(url), usr, pwd))
// { {
// var fileds = String.Join(',', device.Data.Where(o => o.Type == "Int" || o.Type == "Float").Select(o => o.Key)); var fileds = String.Join(',', device.Data
// var query = $"select {fileds} from {measurementName} where time>now()-{time} and DeviceNumber = '{device.Number}' limit 10000"; .Where(o => o.Type == DeviceDataType.Int || o.Type == DeviceDataType.Long || o.Type == DeviceDataType.Float)
// var result = client.ReadAsync<DynamicInfluxRow>(dbName, query).Result; .Select(o => o.Key));
// var rows = result.Results.FirstOrDefault()? var query = $"select {fileds} from {measurementName} where time>now()-{time} and DeviceNumber = '{device.Number}' limit 10000";
// .Series.FirstOrDefault()? var result = client.ReadAsync<DynamicInfluxRow>(dbName, query).Result;
// .Rows; var rows = result.Results.FirstOrDefault()?
// var labels = rows?.Select(o => o.Timestamp.Value).Select(o => o.ToString("MM-dd HH:mm:ss")).ToList() ?? new List<string>(); .Series.FirstOrDefault()?
// foreach (var data in device.Data.Where(o => o.Type == "Int" || o.Type == "Float")) .Rows;
// { var labels = rows?.Select(o => o.Timestamp.Value).Select(o => o.ToString("MM-dd HH:mm:ss")).ToList() ?? new List<string>();
// list.Add(new foreach (var data in device.Data.Where(o => o.Type == DeviceDataType.Int || o.Type == DeviceDataType.Long || o.Type == DeviceDataType.Float))
// { {
// id = data.Key, list.Add(new
// label = data.Name, {
// labels, id = data.Key,
// data = rows?.Select(o => o.GetField(data.Key)).ToList() ?? new List<object>() label = data.Name,
// }); labels,
// } data = rows?.Select(o => o.GetField(data.Key)).ToList() ?? new List<object>()
// } });
// return Json(list); }
// } }
// } return Json(list);
//} }
}
}
Loading…
Cancel
Save