From 7a540f529d2c9a541993bc9818cad9c9093fec91 Mon Sep 17 00:00:00 2001
From: zhengyiming <540361168@qq.com>
Date: 星期三, 03 十二月 2025 11:04:35 +0800
Subject: [PATCH] fix: bug
---
LifePayment/LifePayment.Application/User/AccountService.cs | 68 +++++++++++++++++++++++++++------
1 files changed, 55 insertions(+), 13 deletions(-)
diff --git a/LifePayment/LifePayment.Application/User/AccountService.cs b/LifePayment/LifePayment.Application/User/AccountService.cs
index 951403b..4faeebd 100644
--- a/LifePayment/LifePayment.Application/User/AccountService.cs
+++ b/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;
@@ -9,6 +10,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Linq.Dynamic.Core;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Application.Services;
@@ -35,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;
@@ -44,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,
@@ -52,6 +56,7 @@
_configuration = configuration;
_wxManager = wxManager;
_identityUserService = identityUserService;
+ this.lifePayPromoterRepository = lifePayPromoterRepository;
_lifePayUserRepository = lifePayUserRepository;
_lifePayChannlesRepository = lifePayChannlesRepository;
_authenticator = authenticator;
@@ -92,6 +97,29 @@
return result;
}
+
+ public async Task<BackClientUserInfoOutput> GetBackClientUserInfo()
+ {
+ var channlesNums = await _userChannleRep.Where(x => x.UserId == CurrentUser.Id).Select(s => s.ChannleId).Distinct().ToListAsync();
+
+ var channleList = await _lifePayChannlesRepository.Where(x => channlesNums.Contains(x.ChannlesNum)).Select(s => new ChannelOutput()
+ {
+ Name = s.ChannlesName,
+ ChannlesId = s.Id,
+ ChannlesNum = s.ChannlesNum,
+ SwitchType = s.SwitchType,
+ }).ToListAsync();
+
+ BackClientUserInfoOutput result = new BackClientUserInfoOutput()
+ {
+ IsBackClientUser = CurrentUser.ClientId == Constant.ClientType.Back,
+ IsSystem = CurrentUser.IsSystem,
+ Roles = CurrentUser.Roles,
+ ChannleList = channleList
+ };
+ return result;
+ }
+
#endregion
@@ -135,12 +163,14 @@
&& x.PhoneNumber == input.PhoneNumber).FirstOrDefaultAsync();
if (backClientUser != null)
{
- channlesNum = await _userChannleRep.Where(x => x.UserId == backClientUser.Id)
- .Select(s => new ChannelOutput()
- {
- Name = _lifePayChannlesRepository.Where(x => x.ChannlesNum == s.ChannleId).Select(r => r.ChannlesName).FirstOrDefault(),
- ChannlesNum = s.ChannleId
- }).ToListAsync();
+ var channlesNums = await _userChannleRep.Where(x => x.UserId == backClientUser.Id).Select(s => s.ChannleId).Distinct().ToListAsync();
+ channlesNum = await _lifePayChannlesRepository.Where(x => channlesNums.Contains(x.ChannlesNum)).Select(s => new ChannelOutput()
+ {
+ Name = s.ChannlesName,
+ ChannlesId = s.Id,
+ ChannlesNum = s.ChannlesNum,
+ SwitchType = s.SwitchType,
+ }).ToListAsync();
}
var result = await LifePayUserMesssageByPhone(lifeUser.PhoneNumber);
@@ -153,9 +183,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;
}
@@ -166,12 +201,14 @@
&& x.PhoneNumber == phoneNumber).FirstOrDefaultAsync();
if (backClientUser != null)
{
- channlesNum = await _userChannleRep.Where(x => x.UserId == backClientUser.Id)
- .Select(s => new ChannelOutput()
- {
- Name = _lifePayChannlesRepository.Where(x => x.ChannlesNum == s.ChannleId).Select(r => r.ChannlesName).FirstOrDefault(),
- ChannlesNum = s.ChannleId
- }).ToListAsync();
+ var channlesNums = await _userChannleRep.Where(x => x.UserId == backClientUser.Id).Select(s => s.ChannleId).Distinct().ToListAsync();
+ channlesNum = await _lifePayChannlesRepository.Where(x => channlesNums.Contains(x.ChannlesNum)).Select(s => new ChannelOutput()
+ {
+ Name = s.ChannlesName,
+ ChannlesId = s.Id,
+ ChannlesNum = s.ChannlesNum,
+ SwitchType = s.SwitchType,
+ }).ToListAsync();
}
LifePayPhoneMesssageCodeLoginOutput result = new LifePayPhoneMesssageCodeLoginOutput()
@@ -322,10 +359,15 @@
return res.Id;
}
+
+
+
+
#endregion
#endregion
}
+
}
\ No newline at end of file
--
Gitblit v1.9.1