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 | 119 +++++++++++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 103 insertions(+), 16 deletions(-)
diff --git a/LifePayment/LifePayment.Application/User/AccountService.cs b/LifePayment/LifePayment.Application/User/AccountService.cs
index f0af87b..4faeebd 100644
--- a/LifePayment/LifePayment.Application/User/AccountService.cs
+++ b/LifePayment/LifePayment.Application/User/AccountService.cs
@@ -1,13 +1,16 @@
锘�
using LifePayment.Application.Contracts;
using LifePayment.Domain;
+using LifePayment.Domain.LifePay;
using LifePayment.Domain.Models;
using LifePayment.Domain.Shared;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
+using Nest;
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;
@@ -16,6 +19,7 @@
using Volo.Abp.Identity;
using Volo.Abp.Identity.Application.Contracts.Account;
using Volo.Abp.IdentityModel;
+using Volo.Abp.Threading;
using ZeroD.Util;
using ZeroD.Util.Fadd;
using static LifePayment.Domain.Shared.LifePaymentConstant;
@@ -27,11 +31,13 @@
{
private readonly IWxManager _wxManager;
private readonly IRepository<LifePayUser, Guid> _lifePayUserRepository;
+ private readonly IRepository<LifePayChannles, Guid> _lifePayChannlesRepository;
private readonly IConfiguration _configuration;
private readonly IIdentityModelAuthenticationService _authenticator;
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;
@@ -41,14 +47,18 @@
IIdentityModelAuthenticationService authenticator,
IRepository<User, Guid> userRepository,
IIdentityUserAppService identityUserService,
+ IRepository<LifePayPromoter, Guid> lifePayPromoterRepository,
IRepository<LifePayUser, Guid> lifePayUserRepository,
+ IRepository<LifePayChannles, Guid> lifePayChannlesRepository,
IRepository<UserChannle, Guid> userChannleRep,
IDistributedCache<string> distributedCache)
{
_configuration = configuration;
_wxManager = wxManager;
_identityUserService = identityUserService;
+ this.lifePayPromoterRepository = lifePayPromoterRepository;
_lifePayUserRepository = lifePayUserRepository;
+ _lifePayChannlesRepository = lifePayChannlesRepository;
_authenticator = authenticator;
_userRepository = userRepository;
_userChannleRep = userChannleRep;
@@ -88,6 +98,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
#region 鎿嶄綔
@@ -103,17 +136,8 @@
/// <param name="input"></param>
/// <returns></returns>
/// <exception cref="UserFriendlyException"></exception>
- public async Task<Guid> LifePayPhoneMesssageCodeLogin(LifePayPhoneMesssageCodeLoginInput input)
+ public async Task<LifePayPhoneMesssageCodeLoginOutput> LifePayPhoneMesssageCodeLogin(LifePayPhoneMesssageCodeLoginInput input)
{
- //var vcodeType = VerificationCodeBusinessTypeEnum.LifePayPhoneMesssageCodeLogin;
-
- //var checkResult = await _verificationCodeManager.CheckVerificationCodeByBusinessType(vcodeType,
- // input.PhoneNumber,
- // input.Code,
- // true);
- //CheckExtensions.IfTrueThrowUserFriendlyException(!checkResult,
- // CustomeErrorMessage.SometingWrongOrSometing, "楠岃瘉鐮�", "宸插け鏁�");
-
var lifeUser = await _lifePayUserRepository.Where(x => x.PhoneNumber == input.PhoneNumber).FirstOrDefaultAsync();
if (lifeUser == null)
{
@@ -134,7 +158,65 @@
await _lifePayUserRepository.UpdateAsync(lifeUser);
}
- return lifeUser.Id;
+ List<ChannelOutput> channlesNum = new List<ChannelOutput>();
+ var backClientUser = await _userRepository.Where(x => x.ClientId == Constant.ClientType.Back
+ && x.PhoneNumber == input.PhoneNumber).FirstOrDefaultAsync();
+ if (backClientUser != null)
+ {
+ 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);
+ result.UserId = lifeUser.Id;
+ return result;
+ }
+
+ public async Task<LifePayPhoneMesssageCodeLoginOutput> LifePayUserMesssageByIduser(Guid id)
+ {
+ 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;
+ }
+
+ public async Task<LifePayPhoneMesssageCodeLoginOutput> LifePayUserMesssageByPhone(string phoneNumber)
+ {
+ List<ChannelOutput> channlesNum = new List<ChannelOutput>();
+ var backClientUser = await _userRepository.Where(x => x.ClientId == Constant.ClientType.Back
+ && x.PhoneNumber == phoneNumber).FirstOrDefaultAsync();
+ if (backClientUser != null)
+ {
+ 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()
+ {
+ IsBackClientUser = backClientUser == null ? false : true,
+ ChannlesNum = channlesNum
+ };
+ return result;
}
public async Task<IdentityModelTokenCacheItem> GetTokenForWeb(AccessRequestDto accessRequestDto, string webClientIp)
@@ -160,11 +242,11 @@
public async Task<Guid> CreateAccount(CreateAccountInput input, bool isSend, bool isAdminCreate = false)
{
- if (input.ClientId == LifePaymentConstant.ClientId.Back)
- {
- CheckExtensions.IfTrueThrowUserFriendlyException(!input.CompanyOrgId.HasValue || !input.DepartmentOrgId.HasValue,
- "鎵�灞炲叕鍙稿拰閮ㄩ棬涓嶈兘涓虹┖");
- }
+ //if (input.ClientId == LifePaymentConstant.ClientId.Back)
+ //{
+ // CheckExtensions.IfTrueThrowUserFriendlyException(!input.CompanyOrgId.HasValue || !input.DepartmentOrgId.HasValue,
+ // "鎵�灞炲叕鍙稿拰閮ㄩ棬涓嶈兘涓虹┖");
+ //}
var any = await _userRepository.Where(x => x.PhoneNumber == input.PhoneNumber && x.ClientId == input.ClientId).AnyAsync();
CheckExtensions.IfTrueThrowUserFriendlyException(any,
@@ -277,10 +359,15 @@
return res.Id;
}
+
+
+
+
#endregion
#endregion
}
+
}
\ No newline at end of file
--
Gitblit v1.9.1