// 大名科技(天津)有限公司版权所有 电话: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 = "Device",Description = "设备接口服务")] public class DeviceController : IDynamicApiController, ITransient { private readonly ICache _cache; public DeviceController(ICache cache) { _cache = cache; } /// /// 上传设备摘要 /// /// /// [DisplayName("上传设备摘要")] [Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme + "," + SignatureAuthenticationDefaults.AuthenticationScheme)] public Task UploadDeviceSummary(DeviceInput input) { _cache.Set($"bodk:device:{input.SerialNumber}:summary", input.Summary); return Task.CompletedTask; } /// /// 获取设备摘要 /// /// /// [DisplayName("获取设备摘要")] [Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme + "," + SignatureAuthenticationDefaults.AuthenticationScheme)] public Task GetDeviceSummary(string serialNumber) { return Task.Run(() => _cache.Get($"bodk:device:{serialNumber}:summary")); } }