|
|
@@ -154,7 +154,7 @@ namespace BPA.SAAS.Manage.Application.Auth |
|
|
|
/// </summary> |
|
|
|
/// <returns></returns> |
|
|
|
[HttpPost("/api/authorization/addauthorization")] |
|
|
|
public async Task<bool> AddAuthorization() |
|
|
|
public async Task<bool> AddAuthorization(CreateOrUpDatePlatformAuthorizationDto input) |
|
|
|
{ |
|
|
|
var data = _db.Queryable<BPA_PlatformAuthorization>().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 |
|
|
|
/// <param name="id"></param> |
|
|
|
/// <returns></returns> |
|
|
|
[HttpPost("/api/authorization/updateauthorization")] |
|
|
|
public async Task<bool> UpdateAuthorization(string id) |
|
|
|
public async Task<bool> UpdateAuthorization(CreateOrUpDatePlatformAuthorizationDto input) |
|
|
|
{ |
|
|
|
var data = await _db.Queryable<BPA_PlatformAuthorization>().FirstAsync(x => x.Id == id); |
|
|
|
var data = await _db.Queryable<BPA_PlatformAuthorization>().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(); |
|
|
|
} |
|
|
|