zhengyuxuan
2025-03-28 d6ffbd97603decf4d3922a697414f4f7cec30434
fix:获取用户是否为管理员返回值优化
8个文件已修改
156 ■■■■ 已修改文件
LifePayment/LifePayment.Application.Contracts/LifePay/LifePayInput.cs 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Application.Contracts/LifePay/LifePayOutput.cs 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Application/LifePay/LifePayService.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Application/User/AccountService.cs 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Application/User/UserRoleService.cs 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Domain.Shared/WeChat/WxPayPostBaseModel.cs 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Domain/WeChat/WxClient.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Domain/WeChat/WxPayApi.cs 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Application.Contracts/LifePay/LifePayInput.cs
@@ -631,4 +631,16 @@
    /// 充值凭证
    /// </summary>
    public string Voucher { get; set; }
}
public class SetPayTypeReturn
{
    public string Desc { get; set; }
    public string OrderNo { get; set; }
    public decimal PayAmount { get; set; }
    public LifePayTypeEnum LifePayType { get; set; }
}
LifePayment/LifePayment.Application.Contracts/LifePay/LifePayOutput.cs
@@ -1169,5 +1169,12 @@
    /// <summary>
    /// 渠道号
    /// </summary>
    public string[] ChannlesNum { get; set; }
    public List<ChannelOutput> ChannlesNum { get; set; }
}
public class ChannelOutput
{
    public string Name { get; set; }
    public string ChannlesNum { get; set; }
}
LifePayment/LifePayment.Application/LifePay/LifePayService.cs
@@ -843,6 +843,11 @@
        return result;
    }
    /// <summary>
    /// 查询微信退款订单信息
    /// </summary>
    /// <param name="outTradeNo"></param>
    /// <returns></returns>
    public async Task WxPayDomesticRefundsQuery(string outTradeNo)
    {
        await _wxPayApi.WxPayDomesticRefundsQuery(outTradeNo);
LifePayment/LifePayment.Application/User/AccountService.cs
@@ -5,6 +5,7 @@
using LifePayment.Domain.Shared;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Nest;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -28,6 +29,7 @@
    {
        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;
@@ -43,6 +45,7 @@
               IRepository<User, Guid> userRepository,
               IIdentityUserAppService identityUserService,
               IRepository<LifePayUser, Guid> lifePayUserRepository,
               IRepository<LifePayChannles, Guid> lifePayChannlesRepository,
               IRepository<UserChannle, Guid> userChannleRep,
               IDistributedCache<string> distributedCache)
        {
@@ -50,6 +53,7 @@
            _wxManager = wxManager;
            _identityUserService = identityUserService;
            _lifePayUserRepository = lifePayUserRepository;
            _lifePayChannlesRepository = lifePayChannlesRepository;
            _authenticator = authenticator;
            _userRepository = userRepository;
            _userChannleRep = userChannleRep;
@@ -106,7 +110,6 @@
        /// <exception cref="UserFriendlyException"></exception>
        public async Task<LifePayPhoneMesssageCodeLoginOutput> LifePayPhoneMesssageCodeLogin(LifePayPhoneMesssageCodeLoginInput input)
        {
            string[] channlesNum = new string[0];
            var lifeUser = await _lifePayUserRepository.Where(x => x.PhoneNumber == input.PhoneNumber).FirstOrDefaultAsync();
            if (lifeUser == null)
            {
@@ -126,48 +129,58 @@
                lifeUser.LastLoginTime = DateTime.Now;
                await _lifePayUserRepository.UpdateAsync(lifeUser);
            }
            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)
            {
                channlesNum = await _userChannleRep.Where(x => x.UserId == backClientUser.Id).Select(s => s.ChannleId).ToArrayAsync();
                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();
            }
            LifePayPhoneMesssageCodeLoginOutput result = new LifePayPhoneMesssageCodeLoginOutput()
            {
                UserId = lifeUser.Id,
                IsBackClientUser = backClientUser == null ? false : true,
                ChannlesNum = channlesNum
            };
            var result = await LifePayUserMesssageByPhone(lifeUser.PhoneNumber);
            result.UserId = lifeUser.Id;
            return result;
        }
        public async Task<LifePayPhoneMesssageCodeLoginOutput> LifePayUserMesssageByIduser(Guid id)
        {
            string[] channlesNum = new string[0];
            var lifeUser = await _lifePayUserRepository.Where(x => x.Id == id).FirstOrDefaultAsync();
            CheckExtensions.IfTrueThrowUserFriendlyException(lifeUser == null,
                                                             "用户不存在");
            var result = await LifePayUserMesssageByPhone(lifeUser.PhoneNumber);
            result.UserId = id;
            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 == lifeUser.PhoneNumber).FirstOrDefaultAsync();
             && x.PhoneNumber == phoneNumber).FirstOrDefaultAsync();
            if (backClientUser != null)
            {
                channlesNum = await _userChannleRep.Where(x => x.UserId == backClientUser.Id).Select(s => s.ChannleId).ToArrayAsync();
                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();
            }
            LifePayPhoneMesssageCodeLoginOutput result = new LifePayPhoneMesssageCodeLoginOutput()
            {
                UserId = id,
                IsBackClientUser = backClientUser == null ? false : true,
                ChannlesNum = channlesNum
            };
            return result;
            return result;
        }
        public async Task<IdentityModelTokenCacheItem> GetTokenForWeb(AccessRequestDto accessRequestDto, string webClientIp)
        {
LifePayment/LifePayment.Application/User/UserRoleService.cs
@@ -103,10 +103,16 @@
            List<UserChannle> userChannles = new List<UserChannle>();
            foreach (var item in input.ChannlesId)
            {
                var channleNum = item;
                if (IsGuid(channleNum))
                {
                    channleNum = await _channleRepository.Where(x => x.Id == Guid.Parse(item)).Select(s => s.ChannlesNum).FirstOrDefaultAsync();
                }
                userChannles.Add(new UserChannle()
                {
                    Id = Guid.NewGuid(),
                    ChannleId = item,
                    ChannleId = channleNum,
                    UserId = entity.Id
                });
            }
@@ -221,5 +227,11 @@
            await _roleRepository.DeleteAsync(id);
            return Constant.SUCCESS;
        }
        private bool IsGuid(string input)
        {
            Guid guidOutput;
            return Guid.TryParse(input, out guidOutput);
        }
    }
}
}
LifePayment/LifePayment.Domain.Shared/WeChat/WxPayPostBaseModel.cs
@@ -802,4 +802,64 @@
        [JsonProperty("download_url")]
        public string DownloadUrl { get; set; }
    }
    public class WxPayDomesticRefundsQueryReponse
    {
        /// <summary>
        /// 微信支付退款单号
        /// </summary>
        [JsonProperty("refund_id ")]
        public string RefundId { get; set; }
        /// <summary>
        /// 商户退款单号
        /// </summary>
        [JsonProperty("out_refund_no")]
        public string DownloadUrl { get; set; }
        /// <summary>
        /// 微信支付订单号
        /// </summary>
        [JsonProperty("transaction_id ")]
        public string TransactionId { get; set; }
        /// <summary>
        /// 商户订单号
        /// </summary>
        [JsonProperty("out_trade_no")]
        public string OutTradeNo { get; set; }
        /// <summary>
        /// 退款渠道  ORIGINAL: 原路退款  BALANCE: 退回到余额  OTHER_BALANCE: 原账户异常退到其他余额账户  OTHER_BANKCARD: 原银行卡异常退到其他银行卡(发起异常退款成功后返回)
        /// </summary>
        [JsonProperty("channel")]
        public string Channel { get; set; }
        /// <summary>
        /// 退款入账账户
        /// </summary>
        [JsonProperty("user_received_account")]
        public string UserReceivedAccount { get; set; }
        /// <summary>
        /// 退款成功时间
        /// </summary>
        [JsonProperty("success_time")]
        public string SuccessTime { get; set; }
        /// <summary>
        /// 退款创建时间
        /// </summary>
        [JsonProperty("create_time")]
        public string CreateTime { get; set; }
        /// <summary>
        /// 退款状态 SUCCESS: 退款成功 CLOSED: 退款关闭 PROCESSING: 退款处理中 ABNORMAL: 退款异常
        /// </summary>
        [JsonProperty("status")]
        public string Status { get; set; }
        /// <summary>
        /// 金额信息
        /// </summary>
        [JsonProperty("amount")]
        public string Amount { get; set; }
    }
}
LifePayment/LifePayment.Domain/WeChat/WxClient.cs
@@ -121,8 +121,6 @@
            return result;
        }
        public async Task<CertificatesReponse> GetCertificates()
        {
            return await Certificates<CertificatesReponse>(LifePaymentConstant.WxPayCertificates);
LifePayment/LifePayment.Domain/WeChat/WxPayApi.cs
@@ -39,8 +39,7 @@
        public async Task WxPayDomesticRefundsQuery(string outTradeNo)
        {
            var url = $"{string.Format(LifePaymentConstant.WxPayDomesticRefundsQuery, outTradeNo)}";
            var result = await Certificates<PayTransactionsReponse>(url);
            //return result;
            var result = await Certificates<WxPayDomesticRefundsQueryReponse>(url);
        }
        public async Task<WxPayTradeBillApplyReponse> WxPayTradeBillApply(WxPayTradeBillApplyRequest input)