From 42cc6020ea3bb38a8590b78b1904b9dbf320d808 Mon Sep 17 00:00:00 2001 From: gwbvipvip Date: Fri, 16 Aug 2024 13:43:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=80=9A=E8=BF=87=E8=AE=BE?= =?UTF-8?q?=E5=A4=87Id=E8=8E=B7=E5=8F=96=E6=8E=88=E6=9D=83=E7=A0=812024081?= =?UTF-8?q?6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/CheckService/CheckServices.cs | 10 ++++++++++ .../Service/CheckService/Services/CheckServices.cs | 12 ++++++++++++ .../Service/CheckService/Services/ICheckServices.cs | 7 +++++++ 3 files changed, 29 insertions(+) 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); } }