From f9bc1d677008142990cdef0b824700a4bcb72a71 Mon Sep 17 00:00:00 2001 From: zhengyuxuan <zhengyuxuan1995> Date: 星期四, 27 三月 2025 17:10:05 +0800 Subject: [PATCH] fix:用户登录 --- LifePayment/LifePayment.Application.Contracts/User/IAccountService.cs | 2 +- LifePayment/LifePayment.Application.Contracts/LifePay/LifePayOutput.cs | 18 ++++++++++++++++++ LifePayment/LifePayment.HttpApi/LifePay/AccountController.cs | 2 +- LifePayment/LifePayment.Application/User/AccountService.cs | 28 +++++++++++++++++----------- LifePayment/LifePayment.Application/LifePay/LifePayService.cs | 2 +- 5 files changed, 38 insertions(+), 14 deletions(-) diff --git a/LifePayment/LifePayment.Application.Contracts/LifePay/LifePayOutput.cs b/LifePayment/LifePayment.Application.Contracts/LifePay/LifePayOutput.cs index be0014f..ef60775 100644 --- a/LifePayment/LifePayment.Application.Contracts/LifePay/LifePayOutput.cs +++ b/LifePayment/LifePayment.Application.Contracts/LifePay/LifePayOutput.cs @@ -1152,4 +1152,22 @@ /// 璁拌处鏃堕棿 /// </summary> public DateTime CreationTime { get; set; } +} + +public class LifePayPhoneMesssageCodeLoginOutput +{ + /// <summary> + /// 鐢ㄦ埛Id + /// </summary> + public Guid UserId { get; set; } + + /// <summary> + /// 鏄惁鏄悗鍙扮敤鎴� + /// </summary> + public bool IsBackClientUser { get; set; } + + /// <summary> + /// 娓犻亾鍙� + /// </summary> + public string[] ChannlesNum { get; set; } } \ No newline at end of file diff --git a/LifePayment/LifePayment.Application.Contracts/User/IAccountService.cs b/LifePayment/LifePayment.Application.Contracts/User/IAccountService.cs index af013fc..e751aa2 100644 --- a/LifePayment/LifePayment.Application.Contracts/User/IAccountService.cs +++ b/LifePayment/LifePayment.Application.Contracts/User/IAccountService.cs @@ -19,7 +19,7 @@ /// <param name="input"></param> /// <returns></returns> /// <exception cref="UserFriendlyException"></exception> - Task<Guid> LifePayPhoneMesssageCodeLogin(LifePayPhoneMesssageCodeLoginInput input); + Task<LifePayPhoneMesssageCodeLoginOutput> LifePayPhoneMesssageCodeLogin(LifePayPhoneMesssageCodeLoginInput input); Task<IdentityModelTokenCacheItem> GetTokenForWeb(AccessRequestDto accessRequestDto, string webClientIp); diff --git a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs index 727e993..cb51b66 100644 --- a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs +++ b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs @@ -932,7 +932,7 @@ var repeatOrder = await _lifePayOrderRepository.Where(x => x.LifePayOrderType == LifePayOrderTypeEnum.鐢佃垂璁㈠崟 && x.PayStatus == LifePayStatusEnum.宸叉敮浠� && x.LifePayOrderStatus == LifePayOrderStatusEnum.鍏呭�间腑 && x.OrderParamDetailJsonStr.Contains(input.ProductData.ElectricAccount)).ToListAsync(); - CheckExtensions.IfTrueThrowUserFriendlyException(repeatOrder.Count() > 0, "鎮ㄦ湁鍚屾埛鍙疯鍗曟鍦ㄥ厖鍊间腑锛岃鍕块噸澶嶅厖鍊�"); + CheckExtensions.IfTrueThrowUserFriendlyException(repeatOrder.Count() > 0, "鎮ㄦ湁鍚屾埛鍙疯鍗曟鍦ㄥ厖鍊间腑锛岃鍕块噸澶嶅厖鍊�"); var rate = await GetLifePayRate(channle, LifePayRateTypeEnum.榛樿鐢佃垂鎶樻墸); diff --git a/LifePayment/LifePayment.Application/User/AccountService.cs b/LifePayment/LifePayment.Application/User/AccountService.cs index 11dcf39..7ddb6db 100644 --- a/LifePayment/LifePayment.Application/User/AccountService.cs +++ b/LifePayment/LifePayment.Application/User/AccountService.cs @@ -103,17 +103,9 @@ /// <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, "楠岃瘉鐮�", "宸插け鏁�"); - + string[] channlesNum = new string[0]; var lifeUser = await _lifePayUserRepository.Where(x => x.PhoneNumber == input.PhoneNumber).FirstOrDefaultAsync(); if (lifeUser == null) { @@ -133,8 +125,22 @@ lifeUser.LastLoginTime = DateTime.Now; await _lifePayUserRepository.UpdateAsync(lifeUser); } + var backClientUser = await _userRepository.Where(x => x.ClientId == Constant.ClientType.Back + && x.PhoneNumber == input.PhoneNumber).FirstOrDefaultAsync(); + if (backClientUser != null) + { + channlesNum = await _userChannleRep.Where(x => x.UserId == backClientUser.Id).Select(s => s.ChannleId).ToArrayAsync(); + } - return lifeUser.Id; + LifePayPhoneMesssageCodeLoginOutput result = new LifePayPhoneMesssageCodeLoginOutput() + { + UserId = lifeUser.Id, + IsBackClientUser = backClientUser == null ? false : true, + ChannlesNum = channlesNum + }; + + + return result; } public async Task<IdentityModelTokenCacheItem> GetTokenForWeb(AccessRequestDto accessRequestDto, string webClientIp) diff --git a/LifePayment/LifePayment.HttpApi/LifePay/AccountController.cs b/LifePayment/LifePayment.HttpApi/LifePay/AccountController.cs index 5737e00..c0407bc 100644 --- a/LifePayment/LifePayment.HttpApi/LifePay/AccountController.cs +++ b/LifePayment/LifePayment.HttpApi/LifePay/AccountController.cs @@ -60,7 +60,7 @@ [HttpPost] [AllowAnonymous] [ChannelFilter] - public async Task<Guid> LifePayPhoneMesssageCodeLogin(LifePayPhoneMesssageCodeLoginInput input) + public async Task<LifePayPhoneMesssageCodeLoginOutput> LifePayPhoneMesssageCodeLogin(LifePayPhoneMesssageCodeLoginInput input) { return await _accountService.LifePayPhoneMesssageCodeLogin(input); } -- Gitblit v1.9.1