You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.8 KiB
54 lines
1.8 KiB
// 大名科技(天津)有限公司版权所有 电话:18020030720 QQ:515096995
|
|
//
|
|
// 此源代码遵循位于源代码树根目录中的 LICENSE 文件的许可证
|
|
|
|
using System.ComponentModel;
|
|
using Admin.NET.Bodk.Device.Controllers.Dto;
|
|
using Admin.NET.Core;
|
|
using Furion.DependencyInjection;
|
|
using Furion.DynamicApiController;
|
|
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using NewLife.Caching;
|
|
|
|
namespace Admin.NET.Bodk.Device.Controllers;
|
|
|
|
[ApiDescriptionSettings(Groups = new[] { "Bodk Groups" },Name = "DeviceOld",Description = "设备接口服务")]
|
|
public class DeviceController : IDynamicApiController, ITransient
|
|
{
|
|
private readonly ICache _cache;
|
|
|
|
public DeviceController(ICache cache)
|
|
{
|
|
_cache = cache;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 上传设备摘要
|
|
/// </summary>
|
|
/// <param name="input"></param>
|
|
/// <returns></returns>
|
|
[DisplayName("上传设备摘要")]
|
|
[Authorize(AuthenticationSchemes =
|
|
JwtBearerDefaults.AuthenticationScheme + "," + SignatureAuthenticationDefaults.AuthenticationScheme)]
|
|
public Task UploadDeviceSummary(DeviceInput input)
|
|
{
|
|
_cache.Set($"bodk:device:{input.SerialNumber}:summary", input.Summary);
|
|
|
|
return Task.CompletedTask;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取设备摘要
|
|
/// </summary>
|
|
/// <param name="serialNumber"></param>
|
|
/// <returns></returns>
|
|
[DisplayName("获取设备摘要")]
|
|
[Authorize(AuthenticationSchemes =
|
|
JwtBearerDefaults.AuthenticationScheme + "," + SignatureAuthenticationDefaults.AuthenticationScheme)]
|
|
public Task<object> GetDeviceSummary(string serialNumber)
|
|
{
|
|
return Task.Run(() => _cache.Get<object>($"bodk:device:{serialNumber}:summary"));
|
|
}
|
|
}
|