Browse Source

提交

master
gwbvipvip 6 months ago
parent
commit
c1282d77a5
5 changed files with 50 additions and 4 deletions
  1. +6
    -0
      BPA.SAAS.Manage.Application/AExternalPlatform/Enum/ErrorCodeEnum.cs
  2. +9
    -1
      BPA.SAAS.Manage.Application/AExternalPlatform/Service/CheckService/Services/CheckServices.cs
  3. +23
    -2
      BPA.SAAS.Manage.Application/Auth/AuthService.cs
  4. +9
    -1
      BPA.SAAS.Manage.Application/Auth/IAuthService.cs
  5. +3
    -0
      BPA.SAAS.Manage.Core/DataBase/BPA_PlatformAuthorization.cs

+ 6
- 0
BPA.SAAS.Manage.Application/AExternalPlatform/Enum/ErrorCodeEnum.cs View File

@@ -55,5 +55,11 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Enum
/// </summary>
[ErrorCodeItemMetadata("签名过期")]
Code1006,

/// <summary>
/// 授权过期
/// </summary>
[ErrorCodeItemMetadata("授权过期")]
Code1007,
}
}

+ 9
- 1
BPA.SAAS.Manage.Application/AExternalPlatform/Service/CheckService/Services/CheckServices.cs View File

@@ -47,12 +47,20 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.CheckService.Ser
var data = await SqlSugarDb.Db.Queryable<BPA_PlatformAuthorization>()
.ClearFilter()
.FirstAsync(x => x.Key == key);
await CheckTenant(data.GroupId);
if (data == null)
{
throw Oops.Oh(ErrorCodeEnum.Code1004);
}

if (data.PeriodValidity!=null)
{
if (data.PeriodValidity.Value.Date<DateTime.Now.Date)
{
throw Oops.Oh(ErrorCodeEnum.Code1007);
}
}
await CheckTenant(data.GroupId);

}

/// <summary>


+ 23
- 2
BPA.SAAS.Manage.Application/Auth/AuthService.cs View File

@@ -166,6 +166,7 @@ namespace BPA.SAAS.Manage.Application.Auth
{
Key = Guid.NewGuid().ToString(),
PeriodValidity = input.PeriodValidity,
UpdateAt=DateTime.Now,

}).CallEntityMethod(t => t.Create()).ExecuteCommandAsync();

@@ -178,7 +179,27 @@ namespace BPA.SAAS.Manage.Application.Auth
/// <param name="id"></param>
/// <returns></returns>
[HttpPost("/api/authorization/updateauthorization")]
public async Task<bool> UpdateAuthorization(CreateOrUpDatePlatformAuthorizationDto input)
public async Task<bool> UpdateAuthorization(string id)
{
var data = await _db.Queryable<BPA_PlatformAuthorization>().FirstAsync(x => x.Id == id);
if (data == null)
{
throw Oops.Oh("授权信息不存在");
}
data.Key = Guid.NewGuid().ToString();
data.UpdateAt = DateTime.Now;
//data.PeriodValidity = input.PeriodValidity;

return await _db.Updateable(data).ExecuteCommandHasChangeAsync();
}

/// <summary>
/// 修改授权码授权时间
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpPost("/api/authorization/updateauthtime")]
public async Task<bool> UpdateAuthTime(CreateOrUpDatePlatformAuthorizationDto input)
{
var data = await _db.Queryable<BPA_PlatformAuthorization>().FirstAsync(x => x.Id == input.Id);
if (data == null)
@@ -187,11 +208,11 @@ namespace BPA.SAAS.Manage.Application.Auth
}
data.Key = Guid.NewGuid().ToString();
data.PeriodValidity = input.PeriodValidity;
data.UpdateAt = DateTime.Now;

return await _db.Updateable(data).ExecuteCommandHasChangeAsync();
}


#endregion
}
}

+ 9
- 1
BPA.SAAS.Manage.Application/Auth/IAuthService.cs View File

@@ -34,7 +34,15 @@ namespace BPA.SAAS.Manage.Application.Auth
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
Task<bool> UpdateAuthorization(CreateOrUpDatePlatformAuthorizationDto input);
Task<bool> UpdateAuthorization(string id);


/// <summary>
/// 修改授权码授权时间
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
Task<bool> UpdateAuthTime(CreateOrUpDatePlatformAuthorizationDto input);

#endregion
}


+ 3
- 0
BPA.SAAS.Manage.Core/DataBase/BPA_PlatformAuthorization.cs View File

@@ -23,5 +23,8 @@ namespace BPA.SAAS.Manage.Core.DataBase
/// 有效期 长期有效为空
/// </summary>
public DateTime? PeriodValidity { get; set; }


public DateTime UpdateAt { get; set; }
}
}

Loading…
Cancel
Save