DESKTOP-G961P6V\Zhh 1 year ago
parent
commit
f2160e7b05
  1. 4
      src/Shentun.Peis.Application.Contracts/MyUser/IdentityUserCreateNoEmailDto.cs
  2. 44
      src/Shentun.Peis.Application/MyUser/MyUserAppService.cs
  3. 6
      src/Shentun.Peis.HttpApi.Host/PeisHttpApiHostModule.cs

4
src/Shentun.Peis.Application.Contracts/MyUser/IdentityUserCreateNoEmailDto.cs

@ -53,12 +53,12 @@ namespace Shentun.Peis.MyUser
/// <summary>
/// 签名
/// 签名 base64
/// </summary>
public string UserSign { get; set; }
/// <summary>
/// 照片
/// 照片 base64
/// </summary>
public string UserPhoto { get; set; }

44
src/Shentun.Peis.Application/MyUser/MyUserAppService.cs

@ -185,9 +185,15 @@ namespace Shentun.Peis.MyUser
[HttpPost("api/identity/users/create")]
public async Task<IdentityUserDto> CreateAsync(IdentityUserCreateNoEmailDto input)
{
#region 上传图片
string userPhoto = UploadUserPhotoAsync(new UploadUserPhotoInputDto { PictureBaseStr = input.UserPhoto });
string userSign = UploadUserSignAsync(new UploadUserPhotoInputDto { PictureBaseStr = input.UserPhoto });
#endregion
IdentityUserCreateDto newinput = new IdentityUserCreateDto
{
Email = string.IsNullOrEmpty(input.Email) ? input.UserName + "@qq.com" : input.Email,
Email = string.IsNullOrWhiteSpace(input.Email) ? input.UserName + "@qq.com" : input.Email,
IsActive = input.IsActive,
LockoutEnabled = input.LockoutEnabled,
Name = input.Name,
@ -204,13 +210,13 @@ namespace Shentun.Peis.MyUser
var user = new IdentityUser(
GuidGenerator.Create(),
input.UserName,
input.Email,
newinput.UserName,
newinput.Email,
CurrentTenant.Id
);
user.SetProperty("user_photo", input.UserPhoto);
user.SetProperty("user_sign", input.UserSign);
user.SetProperty("user_photo", userPhoto);
user.SetProperty("user_sign", userSign);
user.SetProperty("operator_type", input.OperatorType);
newinput.MapExtraPropertiesTo(user);
@ -354,12 +360,28 @@ namespace Shentun.Peis.MyUser
public async Task<IdentityUserDto> UpdateIdentityUserAsync(Guid id, IdentityUserUpdateInputDto input)
{
#region 上传图片
string userPhoto = UploadUserPhotoAsync(new UploadUserPhotoInputDto
{
PictureBaseStr = input.UserPhoto,
UserId = id
});
string userSign = UploadUserSignAsync(new UploadUserPhotoInputDto
{
PictureBaseStr = input.UserPhoto,
UserId = id
});
#endregion
input.Email = input.UserName + "@qq.com";
await IdentityOptions.SetAsync();
var user = await UserManager.GetByIdAsync(id);
user.SetProperty("user_sign", input.UserSign);
user.SetProperty("user_photo", input.UserPhoto);
user.SetProperty("user_sign", userSign);
user.SetProperty("user_photo", userPhoto);
user.SetProperty("operator_type", input.OperatorType);
user.SetConcurrencyStampIfNotNull(input.ConcurrencyStamp);
@ -406,9 +428,7 @@ namespace Shentun.Peis.MyUser
/// <param name="input"></param>
/// <returns></returns>
/// <exception cref="UserFriendlyException"></exception>
[Authorize]
[HttpPost("api/app/identity/UploadUserPhoto")]
public string UploadUserPhotoAsync(UploadUserPhotoInputDto input)
private string UploadUserPhotoAsync(UploadUserPhotoInputDto input)
{
string fileName = "";
if (input.UserId != null)
@ -437,9 +457,7 @@ namespace Shentun.Peis.MyUser
/// <param name="input"></param>
/// <returns></returns>
/// <exception cref="UserFriendlyException"></exception>
[Authorize]
[HttpPost("api/app/identity/UploadUserSign")]
public string UploadUserSignAsync(UploadUserPhotoInputDto input)
private string UploadUserSignAsync(UploadUserPhotoInputDto input)
{
string fileName = "";
if (input.UserId != null)

6
src/Shentun.Peis.HttpApi.Host/PeisHttpApiHostModule.cs

@ -463,7 +463,7 @@ public class PeisHttpApiHostModule : AbpModule
{
config.UsePostgreSqlStorage(configuration.GetConnectionString("Default"));
});
context.Services.AddHangfireServer();
//context.Services.AddHangfireServer();
}
public override async void OnApplicationInitialization(ApplicationInitializationContext context)
{
@ -486,8 +486,8 @@ public class PeisHttpApiHostModule : AbpModule
app.UseErrorPage();
}
app.UseHangfireDashboard("/hangfire", new DashboardOptions
{
Authorization = new[] { new CustomAuthorizeFilter() }

Loading…
Cancel
Save