From 5b3e0c0bdc2f64ccc76aa94b455c51b080edc229 Mon Sep 17 00:00:00 2001 From: gwbvipvip Date: Fri, 1 Mar 2024 16:07:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Material/Dtos/MaterialDto.cs | 8 ++++---- BPA.SAAS.Manage.Application/Auth/AuthService.cs | 8 +++++--- .../Auth/Dtos/PlatformAuthorizationDto.cs | 14 ++++++++++++++ BPA.SAAS.Manage.Application/Auth/IAuthService.cs | 4 ++-- .../DataBase/BPA_PlatformAuthorization.cs | 6 ++++++ 5 files changed, 31 insertions(+), 9 deletions(-) diff --git a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Material/Dtos/MaterialDto.cs b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Material/Dtos/MaterialDto.cs index a0ab82b..43c9791 100644 --- a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Material/Dtos/MaterialDto.cs +++ b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Material/Dtos/MaterialDto.cs @@ -8,7 +8,7 @@ using System.Threading.Tasks; namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Material.Dtos { - public class MaterialPageInputDto: BaseEPDto + public class MaterialPageInputDto { /// /// 当前页码 @@ -90,13 +90,13 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Material.Dtos } - public class DelMaterialDto : BaseEPDto + public class DelMaterialDto { public string MaterialId { get; set; } } - public class MaterialCreateDto : BaseEPDto + public class MaterialCreateDto { /// /// 原料编码 @@ -125,7 +125,7 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Material.Dtos } - public class MaterialUpdateDto : BaseEPDto + public class MaterialUpdateDto { public string Id { get; set; } diff --git a/BPA.SAAS.Manage.Application/Auth/AuthService.cs b/BPA.SAAS.Manage.Application/Auth/AuthService.cs index 1c2a5f8..f0b2035 100644 --- a/BPA.SAAS.Manage.Application/Auth/AuthService.cs +++ b/BPA.SAAS.Manage.Application/Auth/AuthService.cs @@ -154,7 +154,7 @@ namespace BPA.SAAS.Manage.Application.Auth /// /// [HttpPost("/api/authorization/addauthorization")] - public async Task AddAuthorization() + public async Task AddAuthorization(CreateOrUpDatePlatformAuthorizationDto input) { var data = _db.Queryable().ToList(); if (data.Count > 0) @@ -165,6 +165,7 @@ namespace BPA.SAAS.Manage.Application.Auth var res = await _db.Insertable(new BPA_PlatformAuthorization() { Key = Guid.NewGuid().ToString(), + PeriodValidity = input.PeriodValidity, }).CallEntityMethod(t => t.Create()).ExecuteCommandAsync(); @@ -177,14 +178,15 @@ namespace BPA.SAAS.Manage.Application.Auth /// /// [HttpPost("/api/authorization/updateauthorization")] - public async Task UpdateAuthorization(string id) + public async Task UpdateAuthorization(CreateOrUpDatePlatformAuthorizationDto input) { - var data = await _db.Queryable().FirstAsync(x => x.Id == id); + var data = await _db.Queryable().FirstAsync(x => x.Id == input.Id); if (data == null) { throw Oops.Oh("授权信息不存在"); } data.Key = Guid.NewGuid().ToString(); + data.PeriodValidity = input.PeriodValidity; return await _db.Updateable(data).ExecuteCommandHasChangeAsync(); } diff --git a/BPA.SAAS.Manage.Application/Auth/Dtos/PlatformAuthorizationDto.cs b/BPA.SAAS.Manage.Application/Auth/Dtos/PlatformAuthorizationDto.cs index d5dba2a..51ad6c4 100644 --- a/BPA.SAAS.Manage.Application/Auth/Dtos/PlatformAuthorizationDto.cs +++ b/BPA.SAAS.Manage.Application/Auth/Dtos/PlatformAuthorizationDto.cs @@ -9,5 +9,19 @@ namespace BPA.SAAS.Manage.Application.Auth.Dtos { public class PlatformAuthorizationDto: BPA_PlatformAuthorization { + + } + + public class CreateOrUpDatePlatformAuthorizationDto + { + public string Id { get; set; } + + public string Key { get; set; } + + + /// + /// 有效期 长期有效为空 + /// + public DateTime? PeriodValidity { get; set;} } } diff --git a/BPA.SAAS.Manage.Application/Auth/IAuthService.cs b/BPA.SAAS.Manage.Application/Auth/IAuthService.cs index 82fce55..9312b34 100644 --- a/BPA.SAAS.Manage.Application/Auth/IAuthService.cs +++ b/BPA.SAAS.Manage.Application/Auth/IAuthService.cs @@ -27,14 +27,14 @@ namespace BPA.SAAS.Manage.Application.Auth /// 添加授权码 /// /// - Task AddAuthorization(); + Task AddAuthorization(CreateOrUpDatePlatformAuthorizationDto input); /// /// 修改授权码 /// /// /// - Task UpdateAuthorization(string id); + Task UpdateAuthorization(CreateOrUpDatePlatformAuthorizationDto input); #endregion } diff --git a/BPA.SAAS.Manage.Core/DataBase/BPA_PlatformAuthorization.cs b/BPA.SAAS.Manage.Core/DataBase/BPA_PlatformAuthorization.cs index 46eb491..0a101d5 100644 --- a/BPA.SAAS.Manage.Core/DataBase/BPA_PlatformAuthorization.cs +++ b/BPA.SAAS.Manage.Core/DataBase/BPA_PlatformAuthorization.cs @@ -17,5 +17,11 @@ namespace BPA.SAAS.Manage.Core.DataBase public string Key { get; set; } public string GroupId { get; set; } + + + /// + /// 有效期 长期有效为空 + /// + public DateTime? PeriodValidity { get; set; } } }