|
|
|
@ -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) |
|
|
|
|