41 lines
1.2 KiB
C#
41 lines
1.2 KiB
C#
|
|
using LY.App.Common.Redis;
|
|||
|
|
using LY.App.Device;
|
|||
|
|
using LY.App.Model;
|
|||
|
|
using LY.App.Service;
|
|||
|
|
using Microsoft.AspNetCore.Http;
|
|||
|
|
using Microsoft.AspNetCore.Mvc;
|
|||
|
|
|
|||
|
|
namespace LY.App.Controllers
|
|||
|
|
{
|
|||
|
|
[Route("api/[controller]")]
|
|||
|
|
[ApiController]
|
|||
|
|
public class HomeController : ControllerBase
|
|||
|
|
{
|
|||
|
|
private readonly DeviceService _deviceService;
|
|||
|
|
private readonly DeviceManager deviceManager = DeviceManager.Instance;
|
|||
|
|
private readonly PositionService _positionService;
|
|||
|
|
private readonly RedisService _redisService;
|
|||
|
|
public HomeController(DeviceService deviceService, PositionService positionService, RedisService redisService)
|
|||
|
|
{
|
|||
|
|
_deviceService = deviceService;
|
|||
|
|
_positionService = positionService;
|
|||
|
|
_redisService = redisService;
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 首页
|
|||
|
|
/// </summary>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
[HttpGet("view")]
|
|||
|
|
public async Task<IActionResult> view()
|
|||
|
|
{
|
|||
|
|
ApiResult result = new ApiResult();
|
|||
|
|
var positions = await _positionService.Index();
|
|||
|
|
result.data = new
|
|||
|
|
{
|
|||
|
|
positions
|
|||
|
|
};
|
|||
|
|
return Ok(result);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|