修改支付接口
This commit is contained in:
parent
c8796befe6
commit
630f4fb37e
|
|
@ -49,7 +49,7 @@ namespace HuanMeng.MiaoYu.Code.Order
|
||||||
{
|
{
|
||||||
var ip = HttpContextAccessor.HttpContext.GetClientIpAddress();
|
var ip = HttpContextAccessor.HttpContext.GetClientIpAddress();
|
||||||
var price = product.Price;
|
var price = product.Price;
|
||||||
var payment = PaymentExtend.GetPayment(paymentMethod);
|
var payment = PaymentExtend.GetPayment(paymentMethod, this);
|
||||||
UserInfoBLL userInfo = new UserInfoBLL(Dao, _UserId);
|
UserInfoBLL userInfo = new UserInfoBLL(Dao, _UserId);
|
||||||
if (userInfo.User.IsTest ?? false)
|
if (userInfo.User.IsTest ?? false)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,30 @@
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
namespace HuanMeng.MiaoYu.WebPayApi.Controllers
|
namespace HuanMeng.MiaoYu.WebPayApi.Controllers
|
||||||
{
|
{
|
||||||
[Route("api/[controller]/")]
|
[Route("api/[controller]/")]
|
||||||
[ApiController]
|
[ApiController]
|
||||||
public class PayController : ControllerBase
|
public class PayController(ILogger<PayController> logger, IHttpContextAccessor httpContextAccessor) : ControllerBase
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("{tenant?}/{pay?}/{orderId?}")]
|
[HttpGet("{tenant?}/{pay?}/{orderId?}")]
|
||||||
public string Get(string? tenant, string? pay, string? orderId)
|
public async Task<string> Get(string? tenant, string? pay, string? orderId)
|
||||||
{
|
{
|
||||||
return "ok";
|
var context = httpContextAccessor.HttpContext;
|
||||||
|
context.Request.EnableBuffering(); // Enable buffering to allow the body to be read multiple times
|
||||||
|
using (var reader = new StreamReader(context.Request.Body, Encoding.UTF8, true, 1024, leaveOpen: true))
|
||||||
|
{
|
||||||
|
var bodyContent = await reader.ReadToEndAsync();
|
||||||
|
logger.LogInformation($"请求支付回调接口,请求路径: {context.Request.Path}, 请求Body: {bodyContent}");
|
||||||
|
context.Request.Body.Position = 0;
|
||||||
|
}
|
||||||
|
return $"success";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -22,9 +32,17 @@ namespace HuanMeng.MiaoYu.WebPayApi.Controllers
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("{tenant?}/{pay?}/{orderId?}")]
|
[HttpPost("{tenant?}/{pay?}/{orderId?}")]
|
||||||
public string Post(string? tenant, string? pay,string? orderId)
|
public async Task<string> Post(string? tenant, string? pay, string? orderId)
|
||||||
{
|
{
|
||||||
return $"ok;{pay},{orderId}";
|
var context = httpContextAccessor.HttpContext;
|
||||||
|
context.Request.EnableBuffering(); // Enable buffering to allow the body to be read multiple times
|
||||||
|
using (var reader = new StreamReader(context.Request.Body, Encoding.UTF8, true, 1024, leaveOpen: true))
|
||||||
|
{
|
||||||
|
var bodyContent = await reader.ReadToEndAsync();
|
||||||
|
logger.LogInformation($"请求支付回调接口,请求路径: {context.Request.Path}, 请求Body: {bodyContent}");
|
||||||
|
context.Request.Body.Position = 0;
|
||||||
|
}
|
||||||
|
return $"success";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user