秘钥重置

optimize
wanghaomei 2 years ago
parent 2857eaa867
commit 1845a44888

@ -9968,6 +9968,13 @@
数据同步服务 数据同步服务
</summary> </summary>
</member> </member>
<member name="M:Myshipping.Application.DataSyncService.SyncCustomer(Myshipping.Application.DjyCustomerSyncDto)">
<summary>
同步客户
</summary>
<param name="model"></param>
<returns></returns>
</member>
<member name="M:Myshipping.Application.DataSyncService.Test"> <member name="M:Myshipping.Application.DataSyncService.Test">
<summary> <summary>
测试用 测试用

@ -37,8 +37,8 @@ namespace Myshipping.Core.Service
public async Task<dynamic> Page([FromQuery] QueryDjyApiAuthInput input) public async Task<dynamic> Page([FromQuery] QueryDjyApiAuthInput input)
{ {
var entities = await _rep.AsQueryable() var entities = await _rep.AsQueryable()
.WhereIF(!string.IsNullOrWhiteSpace(input.ApiCode), u => u.ApiCode == input.ApiCode) .WhereIF(!string.IsNullOrWhiteSpace(input.ApiCode), u => u.ApiCode.Contains(input.ApiCode))
.WhereIF(!string.IsNullOrWhiteSpace(input.ApiName), u => u.ApiName == input.ApiName) .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.TenantName), u => u.TenantName == input.TenantName)
.WhereIF(!string.IsNullOrWhiteSpace(input.UserName), u => u.UserName == input.UserName) .WhereIF(!string.IsNullOrWhiteSpace(input.UserName), u => u.UserName == input.UserName)
.WhereIF(input.IsDisable.HasValue, u => u.IsDisable == input.IsDisable.Value) .WhereIF(input.IsDisable.HasValue, u => u.IsDisable == input.IsDisable.Value)
@ -59,7 +59,7 @@ namespace Myshipping.Core.Service
{ {
entity = input.Adapt<DjyApiAuth>(); entity = input.Adapt<DjyApiAuth>();
entity.ApiKey = Guid.NewGuid().ToString().Replace("-", "").ToLower(); entity.ApiKey = Guid.NewGuid().ToString().Replace("-", "").ToLower();
entity.ApiSecret = DESCEncryption.Encrypt(Guid.NewGuid().ToString(), "132456").ToLower(); entity.ApiSecret = GenSecret();
await _rep.InsertAsync(entity); await _rep.InsertAsync(entity);
} }
else else
@ -94,6 +94,30 @@ namespace Myshipping.Core.Service
return await _rep.FirstOrDefaultAsync(u => u.Id == input.Id); return await _rep.FirstOrDefaultAsync(u => u.Id == input.Id);
} }
/// <summary>
/// 重置秘钥
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpPost("/DjyApiAuth/secretReset")]
public async Task<string> 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;
}
/// <summary>
/// 生成新秘钥
/// </summary>
/// <returns></returns>
[NonAction]
private string GenSecret()
{
return DESCEncryption.Encrypt(Guid.NewGuid().ToString(), "13245687").ToLower();
}
///// <summary> ///// <summary>
///// 获取接口授权列表 ///// 获取接口授权列表
///// </summary> ///// </summary>

Loading…
Cancel
Save