sunpengfei
2025-06-11 257abf061e8a2e2ffb5ea4eabe6355657fd8262f
LifePayment/LifePayment.Application/User/AccountService.cs
@@ -1,6 +1,7 @@

using LifePayment.Application.Contracts;
using LifePayment.Domain;
using LifePayment.Domain.LifePay;
using LifePayment.Domain.Models;
using LifePayment.Domain.Shared;
using Microsoft.EntityFrameworkCore;
@@ -36,6 +37,7 @@
        private readonly IRepository<User, Guid> _userRepository;
        private readonly IRepository<UserChannle, Guid> _userChannleRep;
        private readonly IIdentityUserAppService _identityUserService;
        private readonly IRepository<LifePayPromoter, Guid> lifePayPromoterRepository;
        private readonly IDistributedCache<string> _distributedCache;
@@ -45,6 +47,7 @@
               IIdentityModelAuthenticationService authenticator,
               IRepository<User, Guid> userRepository,
               IIdentityUserAppService identityUserService,
               IRepository<LifePayPromoter, Guid> lifePayPromoterRepository,
               IRepository<LifePayUser, Guid> lifePayUserRepository,
               IRepository<LifePayChannles, Guid> lifePayChannlesRepository,
               IRepository<UserChannle, Guid> userChannleRep,
@@ -53,6 +56,7 @@
            _configuration = configuration;
            _wxManager = wxManager;
            _identityUserService = identityUserService;
            this.lifePayPromoterRepository = lifePayPromoterRepository;
            _lifePayUserRepository = lifePayUserRepository;
            _lifePayChannlesRepository = lifePayChannlesRepository;
            _authenticator = authenticator;
@@ -178,9 +182,14 @@
            var lifeUser = await _lifePayUserRepository.Where(x => x.Id == id).FirstOrDefaultAsync();
            CheckExtensions.IfTrueThrowUserFriendlyException(lifeUser == null,
                                                             "用户不存在");
            var result = await LifePayUserMesssageByPhone(lifeUser.PhoneNumber);
            result.UserId = id;
            var promoter = await lifePayPromoterRepository.FirstOrDefaultAsync(it => it.PhoneNumber == lifeUser.PhoneNumber);
            if (promoter != null)
            {
                result.PromoterIdNumber = promoter.IdNumber;
            }
            return result;
        }