Browse Source

新增通过设备Id获取授权码20240816

ingredientmanage
gwbvipvip 4 months ago
parent
commit
42cc6020ea
3 changed files with 29 additions and 0 deletions
  1. +10
    -0
      BPA.SAAS.Manage.Application/AExternalPlatform/Service/CheckService/CheckServices.cs
  2. +12
    -0
      BPA.SAAS.Manage.Application/AExternalPlatform/Service/CheckService/Services/CheckServices.cs
  3. +7
    -0
      BPA.SAAS.Manage.Application/AExternalPlatform/Service/CheckService/Services/ICheckServices.cs

+ 10
- 0
BPA.SAAS.Manage.Application/AExternalPlatform/Service/CheckService/CheckServices.cs View File

@@ -42,5 +42,15 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.CheckService
{ {
return await _checkServices.GetUserId(key); return await _checkServices.GetUserId(key);
} }

/// <summary>
/// 通过设备Id获取授权码
/// </summary>
/// <param name="deviceId"></param>
/// <returns></returns>
public async Task<string> GetAuthKey(int deviceId)
{
return await _checkServices.GetAuthKey(deviceId);
}
} }
} }

+ 12
- 0
BPA.SAAS.Manage.Application/AExternalPlatform/Service/CheckService/Services/CheckServices.cs View File

@@ -13,6 +13,7 @@ using System.Threading.Tasks;
using BPA.SAAS.KitChenManage.Core; using BPA.SAAS.KitChenManage.Core;
using BPA.KitChen.GroupMeal.SqlSugar; using BPA.KitChen.GroupMeal.SqlSugar;
using BPA.SAAS.Manage.Core.System; using BPA.SAAS.Manage.Core.System;
using BPA.SAAS.Manage.Core.Device;


namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.CheckService.Services 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 null;
return data.CreateBy; return data.CreateBy;
} }

public async Task<string> GetAuthKey(int deviceId)
{
var deviceInfo = await SqlSugarDb.Db.Queryable<BPA_DeviceInfo>().ClearFilter().FirstAsync(t => t.AutoKey == deviceId);
if (deviceInfo == null)
throw Oops.Oh("设备不存在");
var auth = await SqlSugarDb.Db.Queryable<BPA_PlatformAuthorization>().ClearFilter().FirstAsync(t => t.GroupId == deviceInfo.GroupId);
if (auth == null)
throw Oops.Oh("不存在授权码");
return auth.Key;
}
} }
} }

+ 7
- 0
BPA.SAAS.Manage.Application/AExternalPlatform/Service/CheckService/Services/ICheckServices.cs View File

@@ -25,5 +25,12 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.CheckService.Ser
/// <param name="key"></param> /// <param name="key"></param>
/// <returns></returns> /// <returns></returns>
Task<string> GetUserId(string key); Task<string> GetUserId(string key);

/// <summary>
/// 通过设备Id获取授权码
/// </summary>
/// <param name="deviceId"></param>
/// <returns></returns>
Task<string> GetAuthKey(int deviceId);
} }
} }

Loading…
Cancel
Save