zhengyuxuan
2025-03-31 18325eda17439bdd76f3b7e3f39cfae312738b2b
LifePayment/LifePayment.HttpApi/LifePay/LifePayController.cs
@@ -1,4 +1,7 @@
using LifePayment.Application.Contracts;
using Alipay.AopSdk.F2FPay.Model;
using LifePayment.Application.Contracts;
using LifePayment.Application.LifePay;
using LifePayment.Domain.Common;
using LifePayment.Domain.Shared;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
@@ -22,17 +25,23 @@
        private readonly ILifePayService _lifePayService;
        private readonly IStatisticsService _statisticsService;
        private readonly IWebClientInfoProvider _webClientInfoProvider;
        private readonly ICommonService _commonService;
        private readonly ILifePayOrderService _lifePayOrderService;
        private readonly ILogger<LifePayController> _logger;
        public LifePayController(
              ILifePayService lifePayService,
              IStatisticsService statisticsService,
              IWebClientInfoProvider webClientInfoProvider
            , ILogger<LifePayController> logger
              IWebClientInfoProvider webClientInfoProvider,
              ICommonService commonService,
              ILifePayOrderService lifePayOrderService,
              ILogger<LifePayController> logger
              )
        {
            _lifePayService = lifePayService;
            _statisticsService = statisticsService;
            _webClientInfoProvider = webClientInfoProvider;
            _commonService = commonService;
            _lifePayOrderService = lifePayOrderService;
            _logger = logger;
        }
@@ -44,9 +53,9 @@
        /// <returns></returns>
        [HttpGet]
        [AllowAnonymous]
        public async Task<TopStatisticsOutput> GetTopStatistics()
        public async Task<TopStatisticsOutput> GetTopStatistics(string channleId = "")
        {
            return await _statisticsService.GetTopStatistics();
            return await _statisticsService.GetTopStatistics(channleId);
        }
        /// <summary>
@@ -182,6 +191,16 @@
            return await _lifePayService.GetIntroInfo(type);
        }
        /// <summary>
        /// 获取在线客服
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        [AllowAnonymous]
        public async Task<string> GetOnlineService()
        {
            return await _commonService.GetOnlineService();
        }
        /// <summary>
        /// 获取用户分页数据
@@ -412,6 +431,109 @@
            return data;
        }
        /// <summary>
        /// 获取充值流水分页数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<LifePayRechargeReceiptsPageOutput<LifePayRechargeReceiptsListOutput>> GetLifePayRechargeReceiptsPage(LifePayRechargeReceiptsPageInput input)
        {
            return await _lifePayOrderService.GetLifePayRechargeReceiptsPage(input);
        }
        /// <summary>
        /// 获取收支流水分页数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<LifePayExpensesReceiptsPageOutput<LifePayExpensesReceiptsListOutput>> GetLifePayExpensesReceiptsPage(LifePayExpensesReceiptsPageInput input)
        {
            return await _lifePayOrderService.GetLifePayExpensesReceiptsPage(input);
        }
        /// <summary>
        /// 查询支付宝支付订单信息
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [AllowAnonymous]
        public async Task<Alipay.EasySDK.Payment.Common.Models.AlipayTradeQueryResponse> QueryAlipayTrade(OrderInQuiryInput input)
        {
            var res = await _lifePayService.QueryAlipayTrade(input);
            //await _lifePayOrderService.AddLifePayExpensesReceipts(new AddLifePayExpensesReceiptsInput()
            //{
            //    OrderNo = input.OutTradeNo,
            //    OutOrderNo = res.TradeNo,
            //    LifePayType = LifePayTypeEnum.AliPay,
            //    ExpensesReceiptsType = ExpensesReceiptsTypeEnum.Expenses,
            //    Amount = Convert.ToDecimal(res.ReceiptAmount)
            //});
            return res;
        }
        /// <summary>
        /// 查询支付宝退款订单信息
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        [AllowAnonymous]
        public async Task<Alipay.EasySDK.Payment.Common.Models.AlipayTradeFastpayRefundQueryResponse> QueryAlipayTradeRefund(OrderInQuiryInput input)
        {
            return await _lifePayService.QueryAlipayTradeRefund(input);
        }
        /// <summary>
        /// 查询微信退款信息
        /// </summary>
        /// <param name="outTradeNo"></param>
        /// <returns></returns>
        [HttpGet]
        [AllowAnonymous]
        public async Task<WxPayDomesticRefundsQueryReponse> WxPayDomesticRefundsQuery(string outTradeNo)
        {
            var res = await _lifePayService.WxPayDomesticRefundsQuery(outTradeNo);
            await _lifePayOrderService.AddLifePayExpensesReceipts(new AddLifePayExpensesReceiptsInput()
            {
                OrderNo = res.OutTradeNo,
                OutOrderNo = res.TransactionId,
                LifePayType = LifePayTypeEnum.WxPay,
                ExpensesReceiptsType = ExpensesReceiptsTypeEnum.Expenses,
                Amount = Convert.ToDecimal(res.Amount.Total)
            });
            return res;
        }
        /// <summary>
        /// 查询微信订单信息
        /// </summary>
        /// <param name="outTradeNo"></param>
        /// <returns></returns>
        [HttpGet]
        [AllowAnonymous]
        public async Task<WxPayTradeQueryReponse> WxPayTradeQuery(string outTradeNo)
        {
            var res = await _lifePayService.WxPayTradeQuery(outTradeNo);
            await _lifePayOrderService.AddLifePayExpensesReceipts(new AddLifePayExpensesReceiptsInput()
            {
                OrderNo = res.OutTradeNo,
                OutOrderNo = res.TransactionId,
                LifePayType = LifePayTypeEnum.WxPay,
                ExpensesReceiptsType = ExpensesReceiptsTypeEnum.Expenses,
                Amount = Convert.ToDecimal(res.Amount.Total)
            });
            return res;
        }
        [HttpGet]
        [AllowAnonymous]
        public async Task GetAllLifePayExpensesReceipts()
        {
            await _lifePayOrderService.GetAllLifePayExpensesReceipts();
        }
        #endregion
@@ -596,6 +718,30 @@
        }
        /// <summary>
        /// 在线客服配置
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<int> UpdateOnlineService(OnlineServiceInput input)
        {
            await _commonService.UpdateOnlineService(input);
            return Constant.SUCCESS;
        }
        /// <summary>
        /// 上传充值流水
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<int> AddUpdatePayRechargeReceipts(AddUpdatePayRechargeReceiptsInput input)
        {
            await _lifePayOrderService.AddUpdatePayRechargeReceipts(input);
            return Constant.SUCCESS;
        }
        /// <summary>
        /// 设置生活缴费支付类型
        /// </summary>
        /// <param name="input"></param>