秘钥重置

optimize
wanghaomei 2 years ago
parent 2857eaa867
commit 1845a44888

@ -9968,6 +9968,13 @@
数据同步服务
</summary>
</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">
<summary>
测试用

@ -37,8 +37,8 @@ namespace Myshipping.Core.Service
public async Task<dynamic> 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<DjyApiAuth>();
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);
}
/// <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>

Loading…
Cancel
Save