|
|
@ -23,6 +23,7 @@ using Microsoft.AspNetCore.Authorization;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using Mapster;
|
|
|
|
using Mapster;
|
|
|
|
using Furion.FriendlyException;
|
|
|
|
using Furion.FriendlyException;
|
|
|
|
|
|
|
|
using GDZZ.Application.Enum;
|
|
|
|
|
|
|
|
|
|
|
|
namespace GDZZ.Application.Service.WXPay
|
|
|
|
namespace GDZZ.Application.Service.WXPay
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -44,7 +45,6 @@ namespace GDZZ.Application.Service.WXPay
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private readonly WechatOAuth _wechatOAuth; //微信权限服务
|
|
|
|
private readonly WechatOAuth _wechatOAuth; //微信权限服务
|
|
|
|
private readonly IEventPublisher _eventPublisher; //事件写入服务
|
|
|
|
|
|
|
|
private readonly IHttpContextAccessor _httpContextAccessor; //http服务
|
|
|
|
private readonly IHttpContextAccessor _httpContextAccessor; //http服务
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -139,6 +139,7 @@ namespace GDZZ.Application.Service.WXPay
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CAmount= Consume,
|
|
|
|
CAmount= Consume,
|
|
|
|
Surplus = ban.Amount,
|
|
|
|
Surplus = ban.Amount,
|
|
|
|
|
|
|
|
Sort =(int)ConsumeEnum.Contact,
|
|
|
|
ResumeID = ResumeID
|
|
|
|
ResumeID = ResumeID
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
@ -152,9 +153,10 @@ namespace GDZZ.Application.Service.WXPay
|
|
|
|
/// <returns></returns>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpGet]
|
|
|
|
[HttpGet]
|
|
|
|
[Route("Mini/v1/GetBalance")]
|
|
|
|
[Route("Mini/v1/GetBalance")]
|
|
|
|
public async Task<dynamic> GetBalance()
|
|
|
|
public async Task<List<ConsumeOut>> GetBalance()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return await this.ComsumeRep.Where(x=>x.UserID == UserManager.UserId).ToListAsync();
|
|
|
|
var comsume = await this.ComsumeRep.Where(x => x.CreatedUserId == UserManager.UserId).OrderByDescending(x=>x.CreatedTime).ToListAsync();
|
|
|
|
|
|
|
|
return comsume.Adapt<List<ConsumeOut>>();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -237,12 +239,12 @@ namespace GDZZ.Application.Service.WXPay
|
|
|
|
string return_code = resHandler.GetParameter("return_code");
|
|
|
|
string return_code = resHandler.GetParameter("return_code");
|
|
|
|
string return_msg = resHandler.GetParameter("return_msg");
|
|
|
|
string return_msg = resHandler.GetParameter("return_msg");
|
|
|
|
|
|
|
|
|
|
|
|
var res = "";
|
|
|
|
//var res = "";
|
|
|
|
resHandler.SetKey(Config.SenparcWeixinSetting.TenPayV3_Key);
|
|
|
|
resHandler.SetKey(Config.SenparcWeixinSetting.TenPayV3_Key);
|
|
|
|
//验证请求是否从微信发过来(安全)
|
|
|
|
//验证请求是否从微信发过来(安全)
|
|
|
|
if (resHandler.IsTenpaySign() && return_code.ToUpper() == "SUCCESS")
|
|
|
|
if (resHandler.IsTenpaySign() && return_code.ToUpper() == "SUCCESS")
|
|
|
|
{
|
|
|
|
{
|
|
|
|
res = "success";//正确的订单处理
|
|
|
|
//res = "success";//正确的订单处理
|
|
|
|
//直到这里,才能认为交易真正成功了,可以进行数据库操作,但是别忘了返回规定格式的消息!
|
|
|
|
//直到这里,才能认为交易真正成功了,可以进行数据库操作,但是别忘了返回规定格式的消息!
|
|
|
|
Console.WriteLine("回调成功");
|
|
|
|
Console.WriteLine("回调成功");
|
|
|
|
//attach
|
|
|
|
//attach
|
|
|
@ -278,7 +280,7 @@ namespace GDZZ.Application.Service.WXPay
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Console.WriteLine("回调失败");
|
|
|
|
Console.WriteLine("回调失败");
|
|
|
|
res = "wrong";//错误的订单处理
|
|
|
|
//res = "wrong";//错误的订单处理
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* 这里可以进行订单处理的逻辑 */
|
|
|
|
/* 这里可以进行订单处理的逻辑 */
|
|
|
|