diff --git a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/CheckService/CheckServices.cs b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/CheckService/CheckServices.cs index fbf3825..51a6428 100644 --- a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/CheckService/CheckServices.cs +++ b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/CheckService/CheckServices.cs @@ -42,5 +42,15 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.CheckService { return await _checkServices.GetUserId(key); } + + /// + /// 通过设备Id获取授权码 + /// + /// + /// + public async Task GetAuthKey(int deviceId) + { + return await _checkServices.GetAuthKey(deviceId); + } } } diff --git a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/CheckService/Services/CheckServices.cs b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/CheckService/Services/CheckServices.cs index e9e7b91..ad7cdc0 100644 --- a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/CheckService/Services/CheckServices.cs +++ b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/CheckService/Services/CheckServices.cs @@ -13,6 +13,7 @@ using System.Threading.Tasks; using BPA.SAAS.KitChenManage.Core; using BPA.KitChen.GroupMeal.SqlSugar; using BPA.SAAS.Manage.Core.System; +using BPA.SAAS.Manage.Core.Device; namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.CheckService.Services { @@ -94,5 +95,16 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.CheckService.Ser return null; return data.CreateBy; } + + public async Task GetAuthKey(int deviceId) + { + var deviceInfo = await SqlSugarDb.Db.Queryable().ClearFilter().FirstAsync(t => t.AutoKey == deviceId); + if (deviceInfo == null) + throw Oops.Oh("设备不存在"); + var auth = await SqlSugarDb.Db.Queryable().ClearFilter().FirstAsync(t => t.GroupId == deviceInfo.GroupId); + if (auth == null) + throw Oops.Oh("不存在授权码"); + return auth.Key; + } } } diff --git a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/CheckService/Services/ICheckServices.cs b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/CheckService/Services/ICheckServices.cs index ff640aa..dfa391e 100644 --- a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/CheckService/Services/ICheckServices.cs +++ b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/CheckService/Services/ICheckServices.cs @@ -25,5 +25,12 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.CheckService.Ser /// /// Task GetUserId(string key); + + /// + /// 通过设备Id获取授权码 + /// + /// + /// + Task GetAuthKey(int deviceId); } }