78 lines
2.2 KiB
C#
78 lines
2.2 KiB
C#
/*******************************************************************************
|
||
* Copyright © 2020 HT.Cloud.Framework 版权所有
|
||
* Author: HT.Cloud
|
||
* Description: WaterCloud快速开发平台
|
||
* Website:
|
||
*********************************************************************************/
|
||
|
||
using Microsoft.AspNetCore.Mvc;
|
||
using System.Linq;
|
||
using System.Threading.Tasks;
|
||
using HT.Cloud.Code;
|
||
using HT.Cloud.Service.DevicesManage;
|
||
using Quartz;
|
||
|
||
namespace HT.Cloud.Web.Areas.DevicesManage.Controllers
|
||
{
|
||
[Area("DevicesManage")]
|
||
[HandlerLogin(needLogin: false)]
|
||
[HandlerAuthorize(needAuth: false)]
|
||
public class DeviceMonitoringController : BaseController
|
||
{
|
||
|
||
|
||
public RealTimeDeviceStateService _realTimeDeviceState { get; set; }
|
||
|
||
/// <summary>
|
||
/// 绑定数据仓库的数据库ID
|
||
/// </summary>
|
||
private string systemDescription = GlobalContext.SystemConfig.SystemDescription;
|
||
[HttpGet]
|
||
public async Task<ActionResult> GetServerDataJson()
|
||
{
|
||
return await Task.Run(() =>
|
||
{
|
||
var computer = ComputerHelper.GetComputerInfo();
|
||
var arm = computer.RAMRate;
|
||
var cpu = computer.CPURate;
|
||
var iis = computer.RunTime;
|
||
var TotalRAM = computer.TotalRAM;
|
||
string ip = WebHelper.GetWanIp();
|
||
string ipLocation = WebHelper.GetIpLocation(ip);
|
||
var IP = string.Format("{0} ({1})", ip, ipLocation);
|
||
return Content(new { ARM = arm, CPU = cpu, IIS = iis, TotalRAM = TotalRAM, IP = IP }.ToJson());
|
||
});
|
||
}
|
||
|
||
|
||
//[HttpGet]
|
||
//public async Task<ActionResult> GetRealIOGroup()
|
||
//{
|
||
// var listgroup = _realTimeIOState.GetIOGroup(systemDescription);
|
||
|
||
// return Content(listgroup.ToJson());
|
||
//}
|
||
//[HttpGet]
|
||
//public async Task<ActionResult> GetRealIOInfo()
|
||
//{
|
||
|
||
// var listinfo = _realTimeIOState.GetIOInfo(systemDescription);
|
||
|
||
// return Content(listinfo.ToJson());
|
||
//}
|
||
[HttpGet]
|
||
public async Task<ActionResult> GetRealDeviceTag()
|
||
{
|
||
|
||
var data = _realTimeDeviceState.GetRealDeviceTag(systemDescription);
|
||
return Content(data.Result);
|
||
}
|
||
[HttpPost]
|
||
public async Task<ActionResult> GetRealTableData(string[] grouptype)
|
||
{
|
||
|
||
var data = _realTimeDeviceState.GetRealTableData(grouptype[0]);
|
||
return Content(data.Result);
|
||
}
|
||
}
|
||
} |