diff --git a/src/Shentun.WebPeis.Application/Persons/PersonAppService.cs b/src/Shentun.WebPeis.Application/Persons/PersonAppService.cs index 116ffaa..44054b9 100644 --- a/src/Shentun.WebPeis.Application/Persons/PersonAppService.cs +++ b/src/Shentun.WebPeis.Application/Persons/PersonAppService.cs @@ -198,8 +198,6 @@ namespace Shentun.WebPeis.Persons } person.WechatOpenId = input.WechatOpenId; await _repository.UpdateAsync(person); - await unitOfWork.SaveChangesAsync(); - await unitOfWork.CompleteAsync(); } else { @@ -216,10 +214,10 @@ namespace Shentun.WebPeis.Persons (await _userManager.AddPasswordAsync(userWithPerson.User, Shentun.Utilities. Encrypt.RandomHelper.CreateRandom(Utilities.Enums.RandomType.NumAndChar, 10) + "0Cz*")).CheckErrors(); - await unitOfWork.SaveChangesAsync(); - await unitOfWork.CompleteAsync(); + } + await unitOfWork.CompleteAsync(); } using (var unitOfWork = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: false)) diff --git a/src/Shentun.WebPeis.EntityFrameworkCore/Configures/DiseaseRiskLevelAnswerConfigure.cs b/src/Shentun.WebPeis.EntityFrameworkCore/Configures/DiseaseRiskLevelAnswerConfigure.cs index d8880ed..4a8137b 100644 --- a/src/Shentun.WebPeis.EntityFrameworkCore/Configures/DiseaseRiskLevelAnswerConfigure.cs +++ b/src/Shentun.WebPeis.EntityFrameworkCore/Configures/DiseaseRiskLevelAnswerConfigure.cs @@ -15,7 +15,7 @@ namespace Shentun.WebPeis.Configures { entity.HasKey(e => new { e.DiseaseRiskLevelId, e.QuestionAnswerId }).HasName("pk_disease_risk_level_answer"); - entity.ToTable("medical_package_detail", tb => tb.HasComment("疾病风险对应的答案")); + entity.ToTable("disease_risk_level_answer", tb => tb.HasComment("疾病风险对应的答案")); } } } diff --git a/src/Shentun.WebPeis.HttpApi.Host/Controllers/WeChatController.cs b/src/Shentun.WebPeis.HttpApi.Host/Controllers/WeChatController.cs index 4821e4e..04bc3f3 100644 --- a/src/Shentun.WebPeis.HttpApi.Host/Controllers/WeChatController.cs +++ b/src/Shentun.WebPeis.HttpApi.Host/Controllers/WeChatController.cs @@ -41,7 +41,7 @@ namespace Shentun.WebPeis.Controllers } [IgnoreAntiforgeryToken] [ApiExplorerSettings(IgnoreApi = true)] - public class WeChatController : AbpOpenIdDictControllerBase, ITokenExtensionGrant, IWeChatController,ITransientDependency + public class WeChatController : AbpOpenIdDictControllerBase, ITokenExtensionGrant, IWeChatController, ITransientDependency { private readonly IConfiguration _configuration; @@ -83,7 +83,7 @@ namespace Shentun.WebPeis.Controllers ClientSecret = context.Request.GetParameter("client_secret").ToString(), }; var clientCredentialsResult = await httpClient.RequestClientCredentialsTokenAsync(request); - if(clientCredentialsResult.IsError) + if (clientCredentialsResult.IsError) { throw new Exception("应用程序没有权限" + clientCredentialsResult.ErrorDescription); } @@ -121,11 +121,11 @@ namespace Shentun.WebPeis.Controllers { throw new Exception("用户不存在"); } - if(!user.IsActive) + if (!user.IsActive) { throw new Exception("用户已被禁用"); } - + principal = await SignInManager.CreateUserPrincipalAsync(user); if (principal == null) { @@ -177,13 +177,15 @@ namespace Shentun.WebPeis.Controllers }); await _unitOfWorkManager.Current.CompleteAsync(); var authenticationProperties = new AuthenticationProperties(); - + using (var unitOfWork = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: false)) { //return SignIn(principal, authenticationProperties, wechatSession.OpenId); - return SignIn(principal, OpenIddictServerAspNetCoreDefaults.AuthenticationScheme); + var result = SignIn(principal, OpenIddictServerAspNetCoreDefaults.AuthenticationScheme); + await unitOfWork.CompleteAsync(); + return result; } - + } catch (Exception ex) {