新增充值消费记录

development
温天培 2 years ago
parent e27bd95b72
commit b65f715c5c

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GDZZ.Application.Enum
{
public enum ConsumeEnum
{
/// <summary>
/// 联系费用
/// </summary>
[Description("联系费用")] Contact = 0,
}
}

@ -409,6 +409,11 @@
地区级别 1-省、自治区、直辖市 2-地级市、地区、自治州、盟 3-市辖区、县级市、县
</summary>
</member>
<member name="F:GDZZ.Application.Enum.ConsumeEnum.Contact">
<summary>
联系费用
</summary>
</member>
<member name="F:GDZZ.Application.PayStatusEnum.Cancel">
<summary>
已取消
@ -590,6 +595,36 @@
余额
</summary>
</member>
<member name="T:GDZZ.Application.Service.WXPay.Dto.ConsumeOut">
<summary>
</summary>
</member>
<member name="P:GDZZ.Application.Service.WXPay.Dto.ConsumeOut.Sort">
<summary>
消费类型
</summary>
</member>
<member name="P:GDZZ.Application.Service.WXPay.Dto.ConsumeOut.ResumeID">
<summary>
沟通ID
</summary>
</member>
<member name="P:GDZZ.Application.Service.WXPay.Dto.ConsumeOut.CAmount">
<summary>
消费金额
</summary>
</member>
<member name="P:GDZZ.Application.Service.WXPay.Dto.ConsumeOut.Surplus">
<summary>
余额
</summary>
</member>
<member name="P:GDZZ.Application.Service.WXPay.Dto.ConsumeOut.UserID">
<summary>
用户ID
</summary>
</member>
<member name="P:GDZZ.Application.Service.WXPay.Dto.RechargeOut.TotalPrice">
<summary>
总价格

@ -30,7 +30,6 @@ namespace GDZZ.Application.Service.Auth
private readonly SqlSugarRepository<SysTenant> _sysTenantRep; //租户仓储
private readonly SqlSugarRepository<SeIF> Self; //职业仓储
private readonly SqlSugarRepository<Company> CompanyRep;
private readonly SqlSugarRepository<MiniRecharge> rechargeRep; //充值仓储
private readonly SqlSugarRepository<MiniPayTake> payTakeRep; //支付仓储
#endregion

@ -21,5 +21,8 @@ namespace GDZZ.Application.Service.WXPay.Dto
/// 余额
/// </summary>
public decimal Amount { get; set; }
}
}

@ -0,0 +1,37 @@
using GDZZ.Application.Enum;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GDZZ.Application.Service.WXPay.Dto
{
/// <summary>
///
/// </summary>
public class ConsumeOut
{
/// <summary>
/// 消费类型
/// </summary>
public ConsumeEnum Sort { get; set; }
/// <summary>
/// 沟通ID
/// </summary>
public long? ResumeID { get; set; }
/// <summary>
/// 消费金额
/// </summary>
public decimal CAmount { get; set; }
/// <summary>
/// 余额
/// </summary>
public decimal Surplus { get; set; }
/// <summary>
/// 用户ID
/// </summary>
public long UserID { get; set; }
}
}

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

Loading…
Cancel
Save