【修复】修复支付宝支付非小程序模式下,但却判断支付宝用户导致支付异常的问题。

This commit is contained in:
jianweie code
2024-06-01 19:51:43 +08:00
parent 047db04ba5
commit df889ccb55

View File

@@ -67,12 +67,6 @@ namespace CoreCms.Net.Services
var billPaymentsServices = container.ServiceProvider.GetService<ICoreCmsBillPaymentsServices>();
var _aliPayUserInfoServices = container.ServiceProvider.GetService<ICoreCmsAliPayUserInfoServices>();
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;