From df889ccb557229ae4755731814debe52d58bdac8 Mon Sep 17 00:00:00 2001 From: jianweie code Date: Sat, 1 Jun 2024 19:51:43 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BF=AE=E5=A4=8D=E3=80=91=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E6=94=AF=E4=BB=98=E5=AE=9D=E6=94=AF=E4=BB=98=E9=9D=9E?= =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E6=A8=A1=E5=BC=8F=E4=B8=8B=EF=BC=8C?= =?UTF-8?q?=E4=BD=86=E5=8D=B4=E5=88=A4=E6=96=AD=E6=94=AF=E4=BB=98=E5=AE=9D?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=AF=BC=E8=87=B4=E6=94=AF=E4=BB=98=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E7=9A=84=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CoreCms.Net.Services/Pay/AliPayServices.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/CoreCms.Net.Services/Pay/AliPayServices.cs b/CoreCms.Net.Services/Pay/AliPayServices.cs index 18a4032c..cf86c1d9 100644 --- a/CoreCms.Net.Services/Pay/AliPayServices.cs +++ b/CoreCms.Net.Services/Pay/AliPayServices.cs @@ -67,12 +67,6 @@ namespace CoreCms.Net.Services var billPaymentsServices = container.ServiceProvider.GetService(); var _aliPayUserInfoServices = container.ServiceProvider.GetService(); - var aliUserInfo = await _aliPayUserInfoServices.QueryByClauseAsync(p => p.userInfoId == entity.userId); - if (aliUserInfo == null) - { - jm.msg = "支付宝下单用户获取失败"; - return jm; - } var tradeType = GlobalEnumVars.AliPayPayTradeType.ScanQRCodes.ToString(); if (!string.IsNullOrEmpty(entity.parameters)) @@ -141,6 +135,13 @@ namespace CoreCms.Net.Services //支付宝小程序支付 else if (tradeType == GlobalEnumVars.AliPayPayTradeType.JSAPI.ToString()) { + var aliUserInfo = await _aliPayUserInfoServices.QueryByClauseAsync(p => p.userInfoId == entity.userId); + if (aliUserInfo == null) + { + jm.msg = "支付宝下单用户获取失败"; + return jm; + } + Aop.Api.IAopClient alipayClient = new Aop.Api.DefaultAopClient(_options.AliPublicApi, _options.AppId, _options.AppSecret, "json", "1.0", "RSA2", _options.AliPublicKey, "utf-8", false); Aop.Api.Request.AlipayTradeCreateRequest request = new Aop.Api.Request.AlipayTradeCreateRequest(); @@ -152,7 +153,6 @@ namespace CoreCms.Net.Services model.OpAppId = _options.AppId; model.Body = entity.payTitle.Length > 40 ? entity.payTitle[..40] : entity.payTitle; - if (!string.IsNullOrEmpty(aliUserInfo.userId)) { model.BuyerId = aliUserInfo.userId;