From 84f97d1b0b2cbf157dea598363e4cfcf8c15348a Mon Sep 17 00:00:00 2001
From: zhengyuxuan <zhengyuxuan1995>
Date: 星期四, 03 四月 2025 15:52:22 +0800
Subject: [PATCH] fix:佣金统计
---
LifePayment/LifePayment.Application/User/AccountService.cs | 63 +++++++++++++++++--------------
1 files changed, 34 insertions(+), 29 deletions(-)
diff --git a/LifePayment/LifePayment.Application/User/AccountService.cs b/LifePayment/LifePayment.Application/User/AccountService.cs
index 7ba7018..936156c 100644
--- a/LifePayment/LifePayment.Application/User/AccountService.cs
+++ b/LifePayment/LifePayment.Application/User/AccountService.cs
@@ -9,6 +9,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;
@@ -93,25 +94,25 @@
return result;
}
- public async Task<List<ChannelOutput>> GetUserChannel()
+ public async Task<BackClientUserInfoOutput> GetBackClientUserInfo()
{
- var userchannel = await _userChannleRep.Where(x => x.UserId == CurrentUser.Id)
- .Select(s => new ChannelOutput()
- {
- Name = _lifePayChannlesRepository.Where(x => x.ChannlesNum == s.ChannleId).Select(r => r.ChannlesName).FirstOrDefault(),
- ChannlesNum = s.ChannleId
- }).ToListAsync();
- if (userchannel.Count() == 0)
- {
- userchannel = await _lifePayChannlesRepository
- .Select(s => new ChannelOutput()
- {
- Name = s.ChannlesName,
- ChannlesNum = s.ChannlesNum
- }).ToListAsync();
- }
+ var channlesNums = await _userChannleRep.Where(x => x.UserId == CurrentUser.Id).Select(s => s.ChannleId).Distinct().ToListAsync();
- return userchannel;
+ 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,
+ ChannleList = channleList
+ };
+ return result;
}
@@ -157,12 +158,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);
@@ -188,12 +191,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()
--
Gitblit v1.9.1