feat 添加微信获取openid,微信支付调起接口
This commit is contained in:
parent
ece0023cdc
commit
18365aa006
@ -34,6 +34,7 @@ namespace ARW.WebApi.Controllers.Api.Wechat.WxPay
|
||||
_PaymentService = paymentService;
|
||||
}
|
||||
|
||||
|
||||
#region 微信支付
|
||||
/// <summary>
|
||||
/// 微信支付
|
||||
@ -50,9 +51,15 @@ namespace ARW.WebApi.Controllers.Api.Wechat.WxPay
|
||||
// 获取金额
|
||||
var price = 1;//单位:分
|
||||
|
||||
var user = JwtUtil.GetLoginUser(App.HttpContext);
|
||||
//var customer = await _CustomerService.GetFirstAsync(s => s.CustomerGuid == user.UserId);
|
||||
//if (customer != null)
|
||||
//{
|
||||
// //parm.openId = customer.CustomerXcxOpenid;
|
||||
//}
|
||||
|
||||
var orderNo = Common.Common.CreateNoQuery();
|
||||
var payEntity = await pay.PrePay(parm.ProductGuid, parm.openId, orderNo, parm.type, price);
|
||||
var payEntity = await pay.PrePay(0, parm.openId, orderNo, parm.payType, price);
|
||||
|
||||
if (payEntity == null)
|
||||
{
|
||||
@ -60,23 +67,23 @@ namespace ARW.WebApi.Controllers.Api.Wechat.WxPay
|
||||
}
|
||||
else
|
||||
{
|
||||
var user = JwtUtil.GetLoginUser(App.HttpContext);
|
||||
|
||||
var userId = 1600478763014033408;
|
||||
|
||||
Payment payment = new Payment
|
||||
{
|
||||
PaymentBusinessGuid = parm.ProductGuid,
|
||||
//PaymentBusinessGuid = parm.ProductGuid,
|
||||
PaymentNumber = orderNo,
|
||||
PaymentBuytype = parm.type,
|
||||
PaymentBuytype = parm.payType,
|
||||
CustomerGuid = userId,
|
||||
PaymentStatus = 1
|
||||
};
|
||||
|
||||
var response = _PaymentService.InsertReturnSnowflakeId(payment);
|
||||
var response = await _PaymentService.InsertReturnSnowflakeIdAsync(payment);
|
||||
if (response == 0)
|
||||
throw new CustomException("数据加入失败");
|
||||
|
||||
var res = _PaymentService.GetFirst(s => s.PaymentGuid == response);
|
||||
var res = await _PaymentService.GetFirstAsync(s => s.PaymentGuid == response);
|
||||
|
||||
PayParams pay1 = new PayParams
|
||||
{
|
||||
@ -86,11 +93,10 @@ namespace ARW.WebApi.Controllers.Api.Wechat.WxPay
|
||||
OverTime = res.Create_time.AddMinutes(1)
|
||||
};
|
||||
|
||||
return new JsonResult(pay1);
|
||||
return SUCCESS(pay1);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
Loading…
Reference in New Issue
Block a user