sunpengfei
9 天以前 11e0c46d96a9de0c77cbc7509d34f470823bbc65
FlexJobApi.UserServer.Application/EnterpriseWallets/Commands/GetAlipayNotifyCommandHandler.cs
@@ -1,7 +1,12 @@
using FlexJobApi.Core;
using Azure;
using FlexJobApi.Core;
using Furion;
using Furion.DatabaseAccessor;
using Furion.FriendlyException;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.EntityFrameworkCore;
using Org.BouncyCastle.Ocsp;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -14,12 +19,14 @@
    /// 支付宝通知回传
    /// </summary>
    public class GetAlipayNotifyCommandHandler(
            IHttpContextAccessor httpContextAccessor
            IRepository<EnterpriseWallet> rep,
            IMediator mediator
        ) :
        IRequestHandler<GetAlipayNotifyCommand, bool>,
        IRequestHandler<AlipayUserAgreementPageSignNotifyCommand, bool>
    {
        private readonly IHttpContextAccessor httpContextAccessor = httpContextAccessor;
        private readonly IRepository<EnterpriseWallet> rep = rep;
        private readonly IMediator mediator = mediator;
        /// <summary>
        /// 支付宝通知回传
@@ -38,10 +45,18 @@
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public Task<bool> Handle(AlipayUserAgreementPageSignNotifyCommand request, CancellationToken cancellationToken)
        public async Task<bool> Handle(AlipayUserAgreementPageSignNotifyCommand request, CancellationToken cancellationToken)
        {
            Console.WriteLine(httpContextAccessor.HttpContext.Request.QueryString);
            return Task.FromResult(true);
            var entity = await rep.AsQueryable()
                .Where(it => it.Code == request.external_agreement_no)
                .FirstOrDefaultAsync();
            if (entity == null) throw Oops.Oh(EnumErrorCodeType.s404, "企业钱包");
            await mediator.Send(new GetEnterpriseWalletQuery
            {
                EnterpriseId = entity.EnterpriseId,
                Access = EnumEnterpriseWalletAccess.Alipay
            });
            return true;
        }
    }
}