From 2f50ba0fcb17e4fbeb9ee425c67f6765f9662ba9 Mon Sep 17 00:00:00 2001
From: wxd <123@qq.com>
Date: Wed, 15 May 2024 23:22:26 +0800
Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../MyUser/IdentityUserCreateNoEmailDto.cs | 4 +-
.../MyUser/MyUserAppService.cs | 44 +++++++++++++------
.../PeisHttpApiHostModule.cs | 6 +--
3 files changed, 36 insertions(+), 18 deletions(-)
diff --git a/src/Shentun.Peis.Application.Contracts/MyUser/IdentityUserCreateNoEmailDto.cs b/src/Shentun.Peis.Application.Contracts/MyUser/IdentityUserCreateNoEmailDto.cs
index d8e744f..0cbba11 100644
--- a/src/Shentun.Peis.Application.Contracts/MyUser/IdentityUserCreateNoEmailDto.cs
+++ b/src/Shentun.Peis.Application.Contracts/MyUser/IdentityUserCreateNoEmailDto.cs
@@ -53,12 +53,12 @@ namespace Shentun.Peis.MyUser
///
- /// 签名
+ /// 签名 base64
///
public string UserSign { get; set; }
///
- /// 照片
+ /// 照片 base64
///
public string UserPhoto { get; set; }
diff --git a/src/Shentun.Peis.Application/MyUser/MyUserAppService.cs b/src/Shentun.Peis.Application/MyUser/MyUserAppService.cs
index 35df1c0..d2a8336 100644
--- a/src/Shentun.Peis.Application/MyUser/MyUserAppService.cs
+++ b/src/Shentun.Peis.Application/MyUser/MyUserAppService.cs
@@ -185,9 +185,15 @@ namespace Shentun.Peis.MyUser
[HttpPost("api/identity/users/create")]
public async Task 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 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
///
///
///
- [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
///
///
///
- [Authorize]
- [HttpPost("api/app/identity/UploadUserSign")]
- public string UploadUserSignAsync(UploadUserPhotoInputDto input)
+ private string UploadUserSignAsync(UploadUserPhotoInputDto input)
{
string fileName = "";
if (input.UserId != null)
diff --git a/src/Shentun.Peis.HttpApi.Host/PeisHttpApiHostModule.cs b/src/Shentun.Peis.HttpApi.Host/PeisHttpApiHostModule.cs
index 2ab90ed..7c8f86e 100644
--- a/src/Shentun.Peis.HttpApi.Host/PeisHttpApiHostModule.cs
+++ b/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() }