|
@@ -336,14 +336,27 @@ public class IdentityAppService : IIdentityAppService, IScopeDependency
|
|
|
thirdDto = await _thirdAccountDomainFactory.GetThirdParameterAsync(thirdDto, token);
|
|
|
var thirdToken = await _thirdIdentiyFactory.GetTokenAsync(thirdDto, token);
|
|
|
var phone = await _thirdIdentiyFactory.GetPhoneNumberAsync(thirdDto, token);
|
|
|
- var thirdAccount = await _thirdAccountRepository.GetByOpenIdAsync(thirdToken.OpenId, token);
|
|
|
+
|
|
|
+ var inDto = new ThirdOpenIdInDto
|
|
|
+ {
|
|
|
+ OpenId = thirdToken.OpenId,
|
|
|
+ UnionId = thirdToken.UnIonId,
|
|
|
+ AppType = dto.AppType,
|
|
|
+ ThirdType = dto.ThirdType,
|
|
|
+ PhoneNumber = phone.PhoneNumber
|
|
|
+ };
|
|
|
+ return await GetThredTokenAsync(inDto, token);
|
|
|
+ }
|
|
|
+
|
|
|
+ public async Task<Dictionary<string, object>> GetThredTokenAsync(ThirdOpenIdInDto dto, CancellationToken token)
|
|
|
+ {
|
|
|
+ var thirdAccount = await _thirdAccountRepository.GetByOpenIdAsync(dto.OpenId, token);
|
|
|
|
|
|
// 新用户注册
|
|
|
if (thirdAccount is null)
|
|
|
{
|
|
|
thirdAccount = dto.Adapt<ThirdAccount>();
|
|
|
- thirdToken.Adapt(thirdAccount);
|
|
|
- thirdAccount.PhoneNumber = phone.PhoneNumber;
|
|
|
+ thirdAccount.PhoneNumber = dto.PhoneNumber;
|
|
|
thirdAccount.Id = await _thirdAccountRepository.AddAsync(thirdAccount);
|
|
|
await _thirdAccountDomainFactory.RegisterAsync(thirdAccount, token);
|
|
|
thirdAccount = await _thirdAccountRepository.GetAsync(thirdAccount.Id, token);
|