From b65f715c5c9375133c645f0489325f08c41396e0 Mon Sep 17 00:00:00 2001 From: wtp <1813748440@qq.com> Date: Wed, 29 Mar 2023 14:45:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=85=85=E5=80=BC=E6=B6=88?= =?UTF-8?q?=E8=B4=B9=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GDZZ.Application/Enum/ConsumeEnum.cs | 17 +++++++++ GDZZ.Application/GDZZ.Application.xml | 35 ++++++++++++++++++ GDZZ.Application/Service/Auth/AuthService.cs | 1 - .../Service/WXPay/Dto/BalanceOut.cs | 3 ++ .../Service/WXPay/Dto/ConsumeOut.cs | 37 +++++++++++++++++++ .../Service/WXPay/WXPayService.cs | 14 ++++--- 6 files changed, 100 insertions(+), 7 deletions(-) create mode 100644 GDZZ.Application/Enum/ConsumeEnum.cs create mode 100644 GDZZ.Application/Service/WXPay/Dto/ConsumeOut.cs diff --git a/GDZZ.Application/Enum/ConsumeEnum.cs b/GDZZ.Application/Enum/ConsumeEnum.cs new file mode 100644 index 0000000..d00e428 --- /dev/null +++ b/GDZZ.Application/Enum/ConsumeEnum.cs @@ -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 + { + /// + /// 联系费用 + /// + [Description("联系费用")] Contact = 0, + } +} diff --git a/GDZZ.Application/GDZZ.Application.xml b/GDZZ.Application/GDZZ.Application.xml index a689de1..530a62f 100644 --- a/GDZZ.Application/GDZZ.Application.xml +++ b/GDZZ.Application/GDZZ.Application.xml @@ -409,6 +409,11 @@ 地区级别 1-省、自治区、直辖市 2-地级市、地区、自治州、盟 3-市辖区、县级市、县 + + + 联系费用 + + 已取消 @@ -590,6 +595,36 @@ 余额 + + + + + + + + 消费类型 + + + + + 沟通ID + + + + + 消费金额 + + + + + 余额 + + + + + 用户ID + + 总价格 diff --git a/GDZZ.Application/Service/Auth/AuthService.cs b/GDZZ.Application/Service/Auth/AuthService.cs index 4bcc52e..32c3e5a 100644 --- a/GDZZ.Application/Service/Auth/AuthService.cs +++ b/GDZZ.Application/Service/Auth/AuthService.cs @@ -30,7 +30,6 @@ namespace GDZZ.Application.Service.Auth private readonly SqlSugarRepository _sysTenantRep; //租户仓储 private readonly SqlSugarRepository Self; //职业仓储 private readonly SqlSugarRepository CompanyRep; - private readonly SqlSugarRepository rechargeRep; //充值仓储 private readonly SqlSugarRepository payTakeRep; //支付仓储 #endregion diff --git a/GDZZ.Application/Service/WXPay/Dto/BalanceOut.cs b/GDZZ.Application/Service/WXPay/Dto/BalanceOut.cs index bf828e6..7dd13bd 100644 --- a/GDZZ.Application/Service/WXPay/Dto/BalanceOut.cs +++ b/GDZZ.Application/Service/WXPay/Dto/BalanceOut.cs @@ -21,5 +21,8 @@ namespace GDZZ.Application.Service.WXPay.Dto /// 余额 /// public decimal Amount { get; set; } + + + } } diff --git a/GDZZ.Application/Service/WXPay/Dto/ConsumeOut.cs b/GDZZ.Application/Service/WXPay/Dto/ConsumeOut.cs new file mode 100644 index 0000000..5438f1f --- /dev/null +++ b/GDZZ.Application/Service/WXPay/Dto/ConsumeOut.cs @@ -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 +{ + /// + /// + /// + public class ConsumeOut + { + /// + /// 消费类型 + /// + public ConsumeEnum Sort { get; set; } + /// + /// 沟通ID + /// + public long? ResumeID { get; set; } + + /// + /// 消费金额 + /// + public decimal CAmount { get; set; } + /// + /// 余额 + /// + public decimal Surplus { get; set; } + /// + /// 用户ID + /// + public long UserID { get; set; } + } +} diff --git a/GDZZ.Application/Service/WXPay/WXPayService.cs b/GDZZ.Application/Service/WXPay/WXPayService.cs index d836a4d..6d511ed 100644 --- a/GDZZ.Application/Service/WXPay/WXPayService.cs +++ b/GDZZ.Application/Service/WXPay/WXPayService.cs @@ -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 /// [HttpGet] [Route("Mini/v1/GetBalance")] - public async Task GetBalance() + public async Task> 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>(); } @@ -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";//错误的订单处理 } /* 这里可以进行订单处理的逻辑 */