From 474b0a8e3ff0c43d9e8a10e2c49cbc72f833fdc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E6=A2=93=E5=BD=AD?= Date: Wed, 25 Mar 2026 22:02:24 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E9=85=8D=E7=BD=AE=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- YD_Event.Core/Entities/WeChatPayConfig.cs | 69 +++++++++++++++++++ .../WeChat/Dto/WeChatCode2SessionResponse.cs | 27 ++++++++ .../Infrastructure/WeChat/WeChatService.cs | 21 +----- 3 files changed, 98 insertions(+), 19 deletions(-) create mode 100644 YD_Event.Core/Entities/WeChatPayConfig.cs create mode 100644 YD_Event.Core/Infrastructure/WeChat/Dto/WeChatCode2SessionResponse.cs diff --git a/YD_Event.Core/Entities/WeChatPayConfig.cs b/YD_Event.Core/Entities/WeChatPayConfig.cs new file mode 100644 index 0000000..0b6b855 --- /dev/null +++ b/YD_Event.Core/Entities/WeChatPayConfig.cs @@ -0,0 +1,69 @@ +using YD_Event.Core.Enum; + +namespace YD_Event.Core.Entities; + +/// +/// 微信支付配置表 +/// +[SugarTable("WeChatPayConfig")] +public class WeChatPayConfig : Entity, ISoftDelete, ICreatedUserId, ICreatedTime, IUpdatedUserId, IUpdatedTime, IAvailability +{ + /// + /// 商户ID(外键) + /// + public long MerchantId { get; set; } + + /// + /// 微信支付商户号 + /// + [SugarColumn(Length = 32)] + public string MerchantIdValue { get; set; } + + /// + /// 微信支付 APIv3 密钥 + /// + [SugarColumn(Length = 64)] + public string MerchantV3Secret { get; set; } + + /// + /// 微信支付商户证书序列号 + /// + [SugarColumn(Length = 64)] + public string MerchantCertificateSerialNumber { get; set; } + + /// + /// 微信支付商户私钥(PEM格式) + /// + [SugarColumn(ColumnDataType = "text")] + public string MerchantCertificatePrivateKey { get; set; } + + /// + /// 可用状态 + /// + public AvailabilityStatus Status { get; set; } + + /// + /// 标记删除 + /// + public bool DeleteMark { get; set; } + + /// + /// 创建人 + /// + public long CreatedUserId { get; set; } + + /// + /// 创建时间 + /// + public DateTime CreatedTime { get; set; } + + /// + /// 更新人 + /// + public long? UpdatedUserId { get; set; } + + /// + /// 更新时间 + /// + public DateTime? UpdatedTime { get; set; } +} \ No newline at end of file diff --git a/YD_Event.Core/Infrastructure/WeChat/Dto/WeChatCode2SessionResponse.cs b/YD_Event.Core/Infrastructure/WeChat/Dto/WeChatCode2SessionResponse.cs new file mode 100644 index 0000000..3f206a6 --- /dev/null +++ b/YD_Event.Core/Infrastructure/WeChat/Dto/WeChatCode2SessionResponse.cs @@ -0,0 +1,27 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace YD_Event.Core.Infrastructure.WeChat.Dto +{ + public class WeChatCode2SessionResponse + { + [JsonProperty("openid")] + public string OpenId { get; set; } + + [JsonProperty("session_key")] + public string SessionKey { get; set; } + + [JsonProperty("unionid")] + public string UnionId { get; set; } + + [JsonProperty("errcode")] + public int ErrCode { get; set; } + + [JsonProperty("errmsg")] + public string ErrMsg { get; set; } + } +} diff --git a/YD_Event.Core/Infrastructure/WeChat/WeChatService.cs b/YD_Event.Core/Infrastructure/WeChat/WeChatService.cs index ee8ba3c..680171e 100644 --- a/YD_Event.Core/Infrastructure/WeChat/WeChatService.cs +++ b/YD_Event.Core/Infrastructure/WeChat/WeChatService.cs @@ -9,6 +9,7 @@ using Furion.DependencyInjection; using System.Net.Http; using System.Threading.Tasks; using Furion.FriendlyException; +using YD_Event.Core.Infrastructure.WeChat.Dto; namespace YD_Event.Core.Infrastructure.WeChat; @@ -72,22 +73,4 @@ public class WeChatService : ITransient throw Oops.Bah("微信服务暂不可用,请稍后重试"); } } -} - -public class WeChatCode2SessionResponse -{ - [JsonProperty("openid")] - public string OpenId { get; set; } - - [JsonProperty("session_key")] - public string SessionKey { get; set; } - - [JsonProperty("unionid")] - public string UnionId { get; set; } - - [JsonProperty("errcode")] - public int ErrCode { get; set; } - - [JsonProperty("errmsg")] - public string ErrMsg { get; set; } -} +} \ No newline at end of file