From 1845a44888128d3b95ee463541cd802ef2dbf396 Mon Sep 17 00:00:00 2001 From: wanghaomei Date: Mon, 9 Jan 2023 10:58:28 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=98=E9=92=A5=E9=87=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Myshipping.Application.xml | 7 +++++ .../Service/DjyApiAuth/DjyApiAuthService.cs | 30 +++++++++++++++++-- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/Myshipping.Application/Myshipping.Application.xml b/Myshipping.Application/Myshipping.Application.xml index a3d40920..6aeb46b1 100644 --- a/Myshipping.Application/Myshipping.Application.xml +++ b/Myshipping.Application/Myshipping.Application.xml @@ -9968,6 +9968,13 @@ 数据同步服务 + + + 同步客户 + + + + 测试用 diff --git a/Myshipping.Core/Service/DjyApiAuth/DjyApiAuthService.cs b/Myshipping.Core/Service/DjyApiAuth/DjyApiAuthService.cs index 3986ecd4..3485fbbe 100644 --- a/Myshipping.Core/Service/DjyApiAuth/DjyApiAuthService.cs +++ b/Myshipping.Core/Service/DjyApiAuth/DjyApiAuthService.cs @@ -37,8 +37,8 @@ namespace Myshipping.Core.Service public async Task Page([FromQuery] QueryDjyApiAuthInput input) { var entities = await _rep.AsQueryable() - .WhereIF(!string.IsNullOrWhiteSpace(input.ApiCode), u => u.ApiCode == input.ApiCode) - .WhereIF(!string.IsNullOrWhiteSpace(input.ApiName), u => u.ApiName == input.ApiName) + .WhereIF(!string.IsNullOrWhiteSpace(input.ApiCode), u => u.ApiCode.Contains(input.ApiCode)) + .WhereIF(!string.IsNullOrWhiteSpace(input.ApiName), u => u.ApiName.Contains(input.ApiName)) .WhereIF(!string.IsNullOrWhiteSpace(input.TenantName), u => u.TenantName == input.TenantName) .WhereIF(!string.IsNullOrWhiteSpace(input.UserName), u => u.UserName == input.UserName) .WhereIF(input.IsDisable.HasValue, u => u.IsDisable == input.IsDisable.Value) @@ -59,7 +59,7 @@ namespace Myshipping.Core.Service { entity = input.Adapt(); entity.ApiKey = Guid.NewGuid().ToString().Replace("-", "").ToLower(); - entity.ApiSecret = DESCEncryption.Encrypt(Guid.NewGuid().ToString(), "132456").ToLower(); + entity.ApiSecret = GenSecret(); await _rep.InsertAsync(entity); } else @@ -94,6 +94,30 @@ namespace Myshipping.Core.Service return await _rep.FirstOrDefaultAsync(u => u.Id == input.Id); } + /// + /// 重置秘钥 + /// + /// + /// + [HttpPost("/DjyApiAuth/secretReset")] + public async Task SecretReset(long id) + { + var entity = _rep.AsQueryable().Filter(null, true).First(x => x.Id == id); + entity.ApiSecret = GenSecret(); + await _rep.UpdateAsync(entity); + return entity.ApiSecret; + } + + /// + /// 生成新秘钥 + /// + /// + [NonAction] + private string GenSecret() + { + return DESCEncryption.Encrypt(Guid.NewGuid().ToString(), "13245687").ToLower(); + } + ///// ///// 获取接口授权列表 /////