wxd 1 year ago
parent
commit
f0520268f8
  1. 6
      src/Shentun.WebPeis.Application/Persons/PersonAppService.cs
  2. 2
      src/Shentun.WebPeis.EntityFrameworkCore/Configures/DiseaseRiskLevelAnswerConfigure.cs
  3. 10
      src/Shentun.WebPeis.HttpApi.Host/Controllers/WeChatController.cs

6
src/Shentun.WebPeis.Application/Persons/PersonAppService.cs

@ -198,8 +198,6 @@ namespace Shentun.WebPeis.Persons
} }
person.WechatOpenId = input.WechatOpenId; person.WechatOpenId = input.WechatOpenId;
await _repository.UpdateAsync(person); await _repository.UpdateAsync(person);
await unitOfWork.SaveChangesAsync();
await unitOfWork.CompleteAsync();
} }
else else
{ {
@ -216,10 +214,10 @@ namespace Shentun.WebPeis.Persons
(await _userManager.AddPasswordAsync(userWithPerson.User, Shentun.Utilities. (await _userManager.AddPasswordAsync(userWithPerson.User, Shentun.Utilities.
Encrypt.RandomHelper.CreateRandom(Utilities.Enums.RandomType.NumAndChar, 10) + "0Cz*")).CheckErrors(); 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)) using (var unitOfWork = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: false))

2
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.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("疾病风险对应的答案"));
} }
} }
} }

10
src/Shentun.WebPeis.HttpApi.Host/Controllers/WeChatController.cs

@ -41,7 +41,7 @@ namespace Shentun.WebPeis.Controllers
} }
[IgnoreAntiforgeryToken] [IgnoreAntiforgeryToken]
[ApiExplorerSettings(IgnoreApi = true)] [ApiExplorerSettings(IgnoreApi = true)]
public class WeChatController : AbpOpenIdDictControllerBase, ITokenExtensionGrant, IWeChatController,ITransientDependency
public class WeChatController : AbpOpenIdDictControllerBase, ITokenExtensionGrant, IWeChatController, ITransientDependency
{ {
private readonly IConfiguration _configuration; private readonly IConfiguration _configuration;
@ -83,7 +83,7 @@ namespace Shentun.WebPeis.Controllers
ClientSecret = context.Request.GetParameter("client_secret").ToString(), ClientSecret = context.Request.GetParameter("client_secret").ToString(),
}; };
var clientCredentialsResult = await httpClient.RequestClientCredentialsTokenAsync(request); var clientCredentialsResult = await httpClient.RequestClientCredentialsTokenAsync(request);
if(clientCredentialsResult.IsError)
if (clientCredentialsResult.IsError)
{ {
throw new Exception("应用程序没有权限" + clientCredentialsResult.ErrorDescription); throw new Exception("应用程序没有权限" + clientCredentialsResult.ErrorDescription);
} }
@ -121,7 +121,7 @@ namespace Shentun.WebPeis.Controllers
{ {
throw new Exception("用户不存在"); throw new Exception("用户不存在");
} }
if(!user.IsActive)
if (!user.IsActive)
{ {
throw new Exception("用户已被禁用"); throw new Exception("用户已被禁用");
} }
@ -181,7 +181,9 @@ namespace Shentun.WebPeis.Controllers
using (var unitOfWork = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: false)) using (var unitOfWork = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: false))
{ {
//return SignIn(principal, authenticationProperties, wechatSession.OpenId); //return SignIn(principal, authenticationProperties, wechatSession.OpenId);
return SignIn(principal, OpenIddictServerAspNetCoreDefaults.AuthenticationScheme);
var result = SignIn(principal, OpenIddictServerAspNetCoreDefaults.AuthenticationScheme);
await unitOfWork.CompleteAsync();
return result;
} }
} }

Loading…
Cancel
Save