diff --git a/CoreCms.Net.Configuration/GlobalEnumVars.cs b/CoreCms.Net.Configuration/GlobalEnumVars.cs index 3cefb814..6bf8b3bf 100644 --- a/CoreCms.Net.Configuration/GlobalEnumVars.cs +++ b/CoreCms.Net.Configuration/GlobalEnumVars.cs @@ -351,7 +351,9 @@ namespace CoreCms.Net.Configuration [Description("企业付款到银行卡")] 企业付款到银行卡 = 2, [Description("商家转账到零钱")] - 商家转账到零钱 = 3 + 商家转账到零钱 = 3, + [Description("商家转账")] + 商家转账 = 4 } #endregion @@ -3406,6 +3408,47 @@ namespace CoreCms.Net.Configuration #endregion + #region 微信在线客服 + + /// + /// 抽奖活动类型 + /// + public enum WeChatAutoReplyMatchModel + { + /// + /// 完全等于 + /// + [Description("完全等于")] + Complete = 1, + + /// + /// 模糊包含 + /// + [Description("模糊包含")] + FuzzyMatching = 2, + } + + #endregion + + #region 微信支付相关 + + /// + /// 微信支付验证微信支付身份方式 + /// + public enum WeChatPayIdentityVerificationMethods + { + /// + /// 平台证书 + /// + [Description("平台证书")] + PlatformCertificate = 0, + /// + /// 微信支付公钥 + /// + [Description("微信支付公钥")] + PlatformPublicKey = 1, + } + #endregion } } diff --git a/CoreCms.Net.IRepository/Pay/ICoreCmsWeChatPayPlatformCertificateRepository.cs b/CoreCms.Net.IRepository/Pay/ICoreCmsWeChatPayPlatformCertificateRepository.cs new file mode 100644 index 00000000..deaea2e2 --- /dev/null +++ b/CoreCms.Net.IRepository/Pay/ICoreCmsWeChatPayPlatformCertificateRepository.cs @@ -0,0 +1,91 @@ +/*********************************************************************** + * Project: CoreCms + * ProjectName: 核心内容管理系统 + * Web: https://www.corecms.net + * Author: 大灰灰 + * Email: jianweie@163.com + * CreateTime: 2025/7/21 20:36:56 + * Description: 暂无 + ***********************************************************************/ + +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Threading.Tasks; +using CoreCms.Net.Model.Entities; +using CoreCms.Net.Model.ViewModels.Basics; +using CoreCms.Net.Model.ViewModels.UI; +using SqlSugar; + +namespace CoreCms.Net.IRepository +{ + /// + /// 微信支付平台证书 工厂接口 + /// + public interface ICoreCmsWeChatPayPlatformCertificateRepository : IBaseRepository + { + #region 重写增删改查操作=========================================================== + + /// + /// 重写异步插入方法 + /// + /// + /// + Task InsertAsync(CoreCmsWeChatPayPlatformCertificate entity); + + /// + /// 重写异步更新方法 + /// + /// + /// + Task UpdateAsync(CoreCmsWeChatPayPlatformCertificate entity); + + /// + /// 重写异步更新方法 + /// + /// + /// + Task UpdateAsync(List entity); + + /// + /// 重写删除指定ID的数据 + /// + /// + /// + Task DeleteByIdAsync(object id); + + /// + /// 重写删除指定ID集合的数据(批量删除) + /// + /// + /// + Task DeleteByIdsAsync(int[] ids); + + #endregion 重写增删改查操作=========================================================== + + #region 获取缓存的所有数据========================================================== + + /// + /// 获取缓存的所有数据 + /// + /// + Task> GetCaChe(); + + #endregion 获取缓存的所有数据========================================================== + + /// + /// 重写根据条件查询分页数据 + /// + /// 判断集合 + /// 排序方式 + /// 当前页面索引 + /// 分布大小 + /// + /// 是否使用WITH(NOLOCK) + /// + Task> QueryPageAsync( + Expression> predicate, + Expression> orderByExpression, OrderByType orderByType, int pageIndex = 1, + int pageSize = 20, bool blUseNoLock = false); + } +} \ No newline at end of file diff --git a/CoreCms.Net.IRepository/User/ICoreCmsUserTocashWeChatNotifyRepository.cs b/CoreCms.Net.IRepository/User/ICoreCmsUserTocashWeChatNotifyRepository.cs new file mode 100644 index 00000000..53624f09 --- /dev/null +++ b/CoreCms.Net.IRepository/User/ICoreCmsUserTocashWeChatNotifyRepository.cs @@ -0,0 +1,89 @@ +/*********************************************************************** + * Project: CoreCms + * ProjectName: 核心内容管理系统 + * Web: https://www.corecms.net + * Author: 大灰灰 + * Email: jianweie@163.com + * CreateTime: 2025/7/28 23:08:04 + * Description: 暂无 + ***********************************************************************/ + +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Threading.Tasks; +using CoreCms.Net.Model.Entities; +using CoreCms.Net.Model.ViewModels.Basics; +using CoreCms.Net.Model.ViewModels.UI; +using SqlSugar; + +namespace CoreCms.Net.IRepository +{ + /// + /// 用户提现使用商家转账微信回调通知 工厂接口 + /// + public interface ICoreCmsUserTocashWeChatNotifyRepository : IBaseRepository + { + #region 重写增删改查操作=========================================================== + + /// + /// 重写异步插入方法(返回序列) + /// + /// 实体数据 + /// + Task ExecuteReturnIdentityAsync(CoreCmsUserTocashWeChatNotify entity); + + + /// + /// 重写异步插入方法 + /// + /// + /// + Task InsertAsync(CoreCmsUserTocashWeChatNotify entity); + + /// + /// 重写异步更新方法 + /// + /// + /// + Task UpdateAsync(CoreCmsUserTocashWeChatNotify entity); + + /// + /// 重写异步更新方法 + /// + /// + /// + Task UpdateAsync(List entity); + + /// + /// 重写删除指定ID的数据 + /// + /// + /// + Task DeleteByIdAsync(object id); + + /// + /// 重写删除指定ID集合的数据(批量删除) + /// + /// + /// + Task DeleteByIdsAsync(int[] ids); + + #endregion 重写增删改查操作=========================================================== + + /// + /// 重写根据条件查询分页数据 + /// + /// 判断集合 + /// 排序方式 + /// 当前页面索引 + /// 分布大小 + /// + /// 是否使用WITH(NOLOCK) + /// + Task> QueryPageAsync( + Expression> predicate, + Expression> orderByExpression, OrderByType orderByType, int pageIndex = 1, + int pageSize = 20, bool blUseNoLock = false); + } +} \ No newline at end of file diff --git a/CoreCms.Net.IRepository/User/ICoreCmsUserTocashWeChatResponseRepository.cs b/CoreCms.Net.IRepository/User/ICoreCmsUserTocashWeChatResponseRepository.cs new file mode 100644 index 00000000..3f2198bc --- /dev/null +++ b/CoreCms.Net.IRepository/User/ICoreCmsUserTocashWeChatResponseRepository.cs @@ -0,0 +1,81 @@ +/*********************************************************************** + * Project: CoreCms + * ProjectName: 核心内容管理系统 + * Web: https://www.corecms.net + * Author: 大灰灰 + * Email: jianweie@163.com + * CreateTime: 2025/7/23 16:37:18 + * Description: 暂无 + ***********************************************************************/ + +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Threading.Tasks; +using CoreCms.Net.Model.Entities; +using CoreCms.Net.Model.ViewModels.Basics; +using CoreCms.Net.Model.ViewModels.UI; +using SqlSugar; + +namespace CoreCms.Net.IRepository +{ + /// + /// 用户提现使用商家转账回调记录 工厂接口 + /// + public interface ICoreCmsUserTocashWeChatResponseRepository : IBaseRepository + { + #region 重写增删改查操作=========================================================== + + /// + /// 重写异步插入方法 + /// + /// + /// + Task InsertAsync(CoreCmsUserTocashWeChatResponse entity); + + /// + /// 重写异步更新方法 + /// + /// + /// + Task UpdateAsync(CoreCmsUserTocashWeChatResponse entity); + + /// + /// 重写异步更新方法 + /// + /// + /// + Task UpdateAsync(List entity); + + /// + /// 重写删除指定ID的数据 + /// + /// + /// + Task DeleteByIdAsync(object id); + + /// + /// 重写删除指定ID集合的数据(批量删除) + /// + /// + /// + Task DeleteByIdsAsync(int[] ids); + + #endregion 重写增删改查操作=========================================================== + + /// + /// 重写根据条件查询分页数据 + /// + /// 判断集合 + /// 排序方式 + /// 当前页面索引 + /// 分布大小 + /// + /// 是否使用WITH(NOLOCK) + /// + Task> QueryPageAsync( + Expression> predicate, + Expression> orderByExpression, OrderByType orderByType, int pageIndex = 1, + int pageSize = 20, bool blUseNoLock = false); + } +} \ No newline at end of file diff --git a/CoreCms.Net.IServices/CoreCms.Net.IServices.csproj b/CoreCms.Net.IServices/CoreCms.Net.IServices.csproj index 6bc6b92b..97dcad17 100644 --- a/CoreCms.Net.IServices/CoreCms.Net.IServices.csproj +++ b/CoreCms.Net.IServices/CoreCms.Net.IServices.csproj @@ -7,6 +7,7 @@ + diff --git a/CoreCms.Net.IServices/Pay/ICoreCmsWeChatPayPlatformCertificateServices.cs b/CoreCms.Net.IServices/Pay/ICoreCmsWeChatPayPlatformCertificateServices.cs new file mode 100644 index 00000000..8cdc096c --- /dev/null +++ b/CoreCms.Net.IServices/Pay/ICoreCmsWeChatPayPlatformCertificateServices.cs @@ -0,0 +1,95 @@ +/*********************************************************************** + * Project: CoreCms + * ProjectName: 核心内容管理系统 + * Web: https://www.corecms.net + * Author: 大灰灰 + * Email: jianweie@163.com + * CreateTime: 2025/7/21 20:36:56 + * Description: 暂无 + ***********************************************************************/ + +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Threading.Tasks; +using CoreCms.Net.Model.Entities; +using CoreCms.Net.Model.ViewModels.Basics; +using CoreCms.Net.Model.ViewModels.UI; +using SqlSugar; + +namespace CoreCms.Net.IServices +{ + /// + /// 微信支付平台证书 服务工厂接口 + /// + public interface ICoreCmsWeChatPayPlatformCertificateServices : IBaseServices + { + #region 重写增删改查操作=========================================================== + + /// + /// 重写异步插入方法 + /// + /// + /// + Task InsertAsync(CoreCmsWeChatPayPlatformCertificate entity); + + /// + /// 重写异步更新方法 + /// + /// + /// + Task UpdateAsync(CoreCmsWeChatPayPlatformCertificate entity); + + /// + /// 重写异步更新方法 + /// + /// + /// + Task UpdateAsync(List entity); + + /// + /// 重写删除指定ID的数据 + /// + /// + /// + Task DeleteByIdAsync(object id); + + /// + /// 重写删除指定ID集合的数据(批量删除) + /// + /// + /// + Task DeleteByIdsAsync(int[] ids); + + #endregion 重写增删改查操作=========================================================== + + #region 获取缓存的所有数据========================================================== + + /// + /// 获取缓存的所有数据 + /// + /// + Task> GetCaChe(); + + #endregion 获取缓存的所有数据========================================================== + + #region 重写根据条件查询分页数据 + + /// + /// 重写根据条件查询分页数据 + /// + /// 判断集合 + /// 排序方式 + /// 当前页面索引 + /// 分布大小 + /// + /// 是否使用WITH(NOLOCK) + /// + Task> QueryPageAsync( + Expression> predicate, + Expression> orderByExpression, OrderByType orderByType, int pageIndex = 1, + int pageSize = 20, bool blUseNoLock = false); + + #endregion 重写根据条件查询分页数据 + } +} \ No newline at end of file diff --git a/CoreCms.Net.IServices/User/ICoreCmsUserTocashWeChatNotifyServices.cs b/CoreCms.Net.IServices/User/ICoreCmsUserTocashWeChatNotifyServices.cs new file mode 100644 index 00000000..5c193dfa --- /dev/null +++ b/CoreCms.Net.IServices/User/ICoreCmsUserTocashWeChatNotifyServices.cs @@ -0,0 +1,90 @@ +/*********************************************************************** + * Project: CoreCms + * ProjectName: 核心内容管理系统 + * Web: https://www.corecms.net + * Author: 大灰灰 + * Email: jianweie@163.com + * CreateTime: 2025/7/28 23:08:04 + * Description: 暂无 + ***********************************************************************/ + +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Threading.Tasks; +using CoreCms.Net.Model.Entities; +using CoreCms.Net.Model.ViewModels.Basics; +using CoreCms.Net.Model.ViewModels.UI; +using SqlSugar; + +namespace CoreCms.Net.IServices +{ + /// + /// 用户提现使用商家转账微信回调通知 服务工厂接口 + /// + public interface ICoreCmsUserTocashWeChatNotifyServices : IBaseServices + { + #region 重写增删改查操作=========================================================== + + /// + /// 重写异步插入方法(返回序列) + /// + /// 实体数据 + /// + Task ExecuteReturnIdentityAsync(CoreCmsUserTocashWeChatNotify entity); + + /// + /// 重写异步插入方法 + /// + /// + /// + Task InsertAsync(CoreCmsUserTocashWeChatNotify entity); + + /// + /// 重写异步更新方法 + /// + /// + /// + Task UpdateAsync(CoreCmsUserTocashWeChatNotify entity); + + /// + /// 重写异步更新方法 + /// + /// + /// + Task UpdateAsync(List entity); + + /// + /// 重写删除指定ID的数据 + /// + /// + /// + Task DeleteByIdAsync(object id); + + /// + /// 重写删除指定ID集合的数据(批量删除) + /// + /// + /// + Task DeleteByIdsAsync(int[] ids); + + #endregion + + #region 重写根据条件查询分页数据 + /// + /// 重写根据条件查询分页数据 + /// + /// 判断集合 + /// 排序方式 + /// 当前页面索引 + /// 分布大小 + /// + /// 是否使用WITH(NOLOCK) + /// + Task> QueryPageAsync( + Expression> predicate, + Expression> orderByExpression, OrderByType orderByType, int pageIndex = 1, + int pageSize = 20, bool blUseNoLock = false); + #endregion + } +} diff --git a/CoreCms.Net.IServices/User/ICoreCmsUserTocashWeChatResponseServices.cs b/CoreCms.Net.IServices/User/ICoreCmsUserTocashWeChatResponseServices.cs new file mode 100644 index 00000000..028b4eab --- /dev/null +++ b/CoreCms.Net.IServices/User/ICoreCmsUserTocashWeChatResponseServices.cs @@ -0,0 +1,85 @@ +/*********************************************************************** + * Project: CoreCms + * ProjectName: 核心内容管理系统 + * Web: https://www.corecms.net + * Author: 大灰灰 + * Email: jianweie@163.com + * CreateTime: 2025/7/23 16:37:18 + * Description: 暂无 + ***********************************************************************/ + +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Threading.Tasks; +using CoreCms.Net.Model.Entities; +using CoreCms.Net.Model.ViewModels.Basics; +using CoreCms.Net.Model.ViewModels.UI; +using SqlSugar; + +namespace CoreCms.Net.IServices +{ + /// + /// 用户提现使用商家转账回调记录 服务工厂接口 + /// + public interface ICoreCmsUserTocashWeChatResponseServices : IBaseServices + { + #region 重写增删改查操作=========================================================== + + /// + /// 重写异步插入方法 + /// + /// + /// + Task InsertAsync(CoreCmsUserTocashWeChatResponse entity); + + /// + /// 重写异步更新方法 + /// + /// + /// + Task UpdateAsync(CoreCmsUserTocashWeChatResponse entity); + + /// + /// 重写异步更新方法 + /// + /// + /// + Task UpdateAsync(List entity); + + /// + /// 重写删除指定ID的数据 + /// + /// + /// + Task DeleteByIdAsync(object id); + + /// + /// 重写删除指定ID集合的数据(批量删除) + /// + /// + /// + Task DeleteByIdsAsync(int[] ids); + + #endregion 重写增删改查操作=========================================================== + + #region 重写根据条件查询分页数据 + + /// + /// 重写根据条件查询分页数据 + /// + /// 判断集合 + /// 排序方式 + /// 当前页面索引 + /// 分布大小 + /// + /// 是否使用WITH(NOLOCK) + /// + Task> QueryPageAsync( + Expression> predicate, + Expression> orderByExpression, OrderByType orderByType, int pageIndex = 1, + int pageSize = 20, bool blUseNoLock = false); + + #endregion 重写根据条件查询分页数据 + } +} \ No newline at end of file diff --git a/CoreCms.Net.IServices/WechatTenpay/IWechatTenpayClientFactory.cs b/CoreCms.Net.IServices/WechatTenpay/IWechatTenpayClientFactory.cs new file mode 100644 index 00000000..61c5872d --- /dev/null +++ b/CoreCms.Net.IServices/WechatTenpay/IWechatTenpayClientFactory.cs @@ -0,0 +1,13 @@ +using System.Threading.Tasks; +using SKIT.FlurlHttpClient.Wechat.TenpayV3; + +namespace CoreCms.Net.IServices +{ + /// + /// ΢֧ӹӿ + /// + public interface IWechatTenpayClientFactory + { + Task Create(string merchantId); + } +} diff --git a/CoreCms.Net.Model/CoreCms.Net.Model.xml b/CoreCms.Net.Model/CoreCms.Net.Model.xml index 180edf4d..bdcbf0bd 100644 --- a/CoreCms.Net.Model/CoreCms.Net.Model.xml +++ b/CoreCms.Net.Model/CoreCms.Net.Model.xml @@ -4743,7 +4743,7 @@ - 微信支付配置 + 微信支付配置表 @@ -4826,6 +4826,96 @@ 应用类型 + + + 高级模式 + + + + + 商户证书序列号 + + + + + 商户证书文件内容 + + + + + 平台证书序列号 + + + + + 平台公钥ID + + + + + 平台公钥内容 + + + + + 提现回调通知 + + + + + 微信支付平台证书 + + + + + 构造函数 + + + + + 序列 + + + + + 证书算法类型 + + + + + 证书内容 + + + + + 获取生效时间 + + + + + 获取过期时间 + + + + + 证书编号 + + + + + 商户编号 + + + + + 创建时间 + + + + + 更新时间 + + 拼团商品表 @@ -8292,6 +8382,11 @@ 反馈结果 + + + 需要用户领取 + + 状态说明 @@ -8302,6 +8397,146 @@ 用户昵称 + + + 商家转账反馈数据 + + + + + 用户提现使用商家转账微信回调通知 + + + + + 构造函数 + + + + + 序列 + + + + + 通知ID + + + + + 通知创建时间 + + + + + 通知数据类型 + + + + + 通知类型 + + + + + 回调摘要 + + + + + 通知数据 + + + + + 创建时间 + + + + + 验签的平台证书序列号或支付公钥ID + + + + + 验签的签名值 + + + + + 验签的时间戳 + + + + + 验签的随机字符串 + + + + + 解密数据 + + + + + 用户提现使用商家转账回调记录 + + + + + 构造函数 + + + + + 序列 + + + + + 商户单号 + + + + + 微信转账单号 + + + + + 单据创建时间 + + + + + 单据状态 + + + + + 跳转领取页面的package信息 + + + + + 状态码 + + + + + 消息内容 + + + + + 描述 + + + + + 创建时间 + + 用户token @@ -10094,6 +10329,72 @@ base64数据 + + + 商家转账回调通知实体数据 + + + + + 通知ID】通知的唯一ID + + + + + 【通知创建时间】 + 通知创建的时间,遵循rfc3339标准格式,格式为yyyy-MM-DDTHH:mm:ss+TIMEZONE,yyyy-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss.表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间)。例如:2015-05-20T13:29:35+08:00表示北京时间2015年05月20日13点29分35秒。 + + + + + 【通知数据类型】通知的资源数据类型,商家转账通知为encrypt-resource + + + + + 【通知类型】通知的类型,商家转账通知的类型为MCHTRANSFER.BILL.FINISHED + + + + + 【回调摘要】回调摘要 + + + + + 通知数据 + + + + + 商家转账回调通知实体数据-通知数据 + + + + + 【原始类型】原始回调类型,为mch_payment + + + + + 【加密算法类型】对开启结果数据进行加密的加密算法,目前只支持AEAD_AES_256_GCM + + + + + 数据密文】Base64编码后的商家转账结果数据密文 + + + + + 【附加数据】附加数据 + + + + + 随机串】加密使用的随机串。 + + 按照序列进行更新Bool类型数据 diff --git a/CoreCms.Net.Model/Entities/Pay/CoreCmsWeChatPayConfig.cs b/CoreCms.Net.Model/Entities/Pay/CoreCmsWeChatPayConfig.cs index ce7f315b..9d25f3d9 100644 --- a/CoreCms.Net.Model/Entities/Pay/CoreCmsWeChatPayConfig.cs +++ b/CoreCms.Net.Model/Entities/Pay/CoreCmsWeChatPayConfig.cs @@ -1,10 +1,10 @@ /*********************************************************************** * Project: CoreCms - * ProjectName: 核心内容管理系统 - * Web: https://www.corecms.net - * Author: 大灰灰 - * Email: jianweie@163.com - * CreateTime: 2023/4/22 23:40:15 + * ProjectName: 核心内容管理系统 + * Web: https://www.corecms.net + * Author: 大灰灰 + * Email: jianweie@163.com + * CreateTime: 2025/7/28 22:49:53 * Description: 暂无 ***********************************************************************/ @@ -15,7 +15,7 @@ using System.ComponentModel.DataAnnotations; namespace CoreCms.Net.Model.Entities { /// - /// 微信支付配置 + /// 微信支付配置表 /// public partial class CoreCmsWeChatPayConfig { @@ -25,188 +25,173 @@ namespace CoreCms.Net.Model.Entities public CoreCmsWeChatPayConfig() { } - + /// /// 序列 /// [Display(Name = "序列")] - [SugarColumn(IsPrimaryKey = true, IsIdentity = true)] - [Required(ErrorMessage = "请输入{0}")] - - - - public System.Int32 id { get; set; } - - + public System.Int32 id { get; set; } + /// /// 应用号 /// [Display(Name = "应用号")] - [Required(ErrorMessage = "请输入{0}")] - - [StringLength(maximumLength:50,ErrorMessage = "{0}不能超过{1}字")] - - public System.String appId { get; set; } - - + [StringLength(maximumLength: 50, ErrorMessage = "{0}不能超过{1}字")] + public System.String appId { get; set; } + /// /// 商户号 /// [Display(Name = "商户号")] - [Required(ErrorMessage = "请输入{0}")] - - [StringLength(maximumLength:50,ErrorMessage = "{0}不能超过{1}字")] - - public System.String mchId { get; set; } - - + [StringLength(maximumLength: 50, ErrorMessage = "{0}不能超过{1}字")] + public System.String mchId { get; set; } + /// /// API秘钥 /// [Display(Name = "API秘钥")] - - - - [StringLength(maximumLength:50,ErrorMessage = "{0}不能超过{1}字")] - - public System.String apiKey { get; set; } - - + [Required(ErrorMessage = "请输入{0}")] + [StringLength(maximumLength: 50, ErrorMessage = "{0}不能超过{1}字")] + public System.String apiKey { get; set; } + /// /// APIv3密钥 /// [Display(Name = "APIv3密钥")] - - - - [StringLength(maximumLength:50,ErrorMessage = "{0}不能超过{1}字")] - - public System.String apiV3Key { get; set; } - - + + [StringLength(maximumLength: 50, ErrorMessage = "{0}不能超过{1}字")] + public System.String apiV3Key { get; set; } + /// /// p12证书base64 /// [Display(Name = "p12证书base64")] - - - - [StringLength(maximumLength:8000,ErrorMessage = "{0}不能超过{1}字")] - - public System.String certificate { get; set; } - - + [Required(ErrorMessage = "请输入{0}")] + public System.String certificate { get; set; } + /// /// RSA公钥 /// [Display(Name = "RSA公钥")] - - - - [StringLength(maximumLength:1000,ErrorMessage = "{0}不能超过{1}字")] - - public System.String rsaPublicKey { get; set; } - - + + [StringLength(maximumLength: 1000, ErrorMessage = "{0}不能超过{1}字")] + public System.String rsaPublicKey { get; set; } + /// /// 子商户应用号 /// [Display(Name = "子商户应用号")] - - - - [StringLength(maximumLength:50,ErrorMessage = "{0}不能超过{1}字")] - - public System.String subAppId { get; set; } - - + + [StringLength(maximumLength: 50, ErrorMessage = "{0}不能超过{1}字")] + public System.String subAppId { get; set; } + /// /// 子商户号 /// [Display(Name = "子商户号")] - - - - [StringLength(maximumLength:50,ErrorMessage = "{0}不能超过{1}字")] - - public System.String subMchId { get; set; } - - + + [StringLength(maximumLength: 50, ErrorMessage = "{0}不能超过{1}字")] + public System.String subMchId { get; set; } + /// /// 支付回调通知 /// [Display(Name = "支付回调通知")] - - - - [StringLength(maximumLength:200,ErrorMessage = "{0}不能超过{1}字")] - - public System.String notifyUrl { get; set; } - - + [Required(ErrorMessage = "请输入{0}")] + [StringLength(maximumLength: 200, ErrorMessage = "{0}不能超过{1}字")] + public System.String notifyUrl { get; set; } + /// /// 退款回调 /// [Display(Name = "退款回调")] - - - - [StringLength(maximumLength:200,ErrorMessage = "{0}不能超过{1}字")] - - public System.String refundUrl { get; set; } - - + [Required(ErrorMessage = "请输入{0}")] + [StringLength(maximumLength: 200, ErrorMessage = "{0}不能超过{1}字")] + public System.String refundUrl { get; set; } + /// /// 跳转地址 /// [Display(Name = "跳转地址")] - - - - [StringLength(maximumLength:200,ErrorMessage = "{0}不能超过{1}字")] - - public System.String jumpUrl { get; set; } - - + + [StringLength(maximumLength: 200, ErrorMessage = "{0}不能超过{1}字")] + public System.String jumpUrl { get; set; } + /// /// 是否开启 /// [Display(Name = "是否开启")] - [Required(ErrorMessage = "请输入{0}")] - - - - public System.Boolean isEnable { get; set; } - - + public System.Boolean isEnable { get; set; } + /// /// 是否本类默认 /// [Display(Name = "是否本类默认")] - [Required(ErrorMessage = "请输入{0}")] - - - - public System.Boolean isDefault { get; set; } - - + public System.Boolean isDefault { get; set; } + /// /// 应用类型 /// [Display(Name = "应用类型")] - - - - [StringLength(maximumLength:50,ErrorMessage = "{0}不能超过{1}字")] - - public System.String appType { get; set; } - - + [Required(ErrorMessage = "请输入{0}")] + [StringLength(maximumLength: 50, ErrorMessage = "{0}不能超过{1}字")] + public System.String appType { get; set; } + + /// + /// 高级模式 + /// + [Display(Name = "高级模式")] + [Required(ErrorMessage = "请输入{0}")] + public System.Int32 payType { get; set; } + + /// + /// 商户证书序列号 + /// + [Display(Name = "商户证书序列号")] + + [StringLength(maximumLength: 50, ErrorMessage = "{0}不能超过{1}字")] + public System.String certificateSerialNumber { get; set; } + + /// + /// 商户证书文件内容 + /// + [Display(Name = "商户证书文件内容")] + public System.String certificatePrivateKey { get; set; } + + /// + /// 平台证书序列号 + /// + [Display(Name = "平台证书序列号")] + + [StringLength(maximumLength: 50, ErrorMessage = "{0}不能超过{1}字")] + public System.String platformSerialNumber { get; set; } + + /// + /// 平台公钥ID + /// + [Display(Name = "平台公钥ID")] + + [StringLength(maximumLength: 50, ErrorMessage = "{0}不能超过{1}字")] + public System.String platformPublicKeyId { get; set; } + + /// + /// 平台公钥内容 + /// + [Display(Name = "平台公钥内容")] + public System.String platformPublicKey { get; set; } + + /// + /// 提现回调通知 + /// + [Display(Name = "提现回调通知")] + + [StringLength(maximumLength: 200, ErrorMessage = "{0}不能超过{1}字")] + public System.String transferBillsUrl { get; set; } } -} +} \ No newline at end of file diff --git a/CoreCms.Net.Model/Entities/Pay/CoreCmsWeChatPayPlatformCertificate.cs b/CoreCms.Net.Model/Entities/Pay/CoreCmsWeChatPayPlatformCertificate.cs new file mode 100644 index 00000000..1d7bea01 --- /dev/null +++ b/CoreCms.Net.Model/Entities/Pay/CoreCmsWeChatPayPlatformCertificate.cs @@ -0,0 +1,95 @@ +/*********************************************************************** + * Project: CoreCms + * ProjectName: 核心内容管理系统 + * Web: https://www.corecms.net + * Author: 大灰灰 + * Email: jianweie@163.com + * CreateTime: 2025/7/21 20:39:06 + * Description: 暂无 + ***********************************************************************/ + +using SqlSugar; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; + +namespace CoreCms.Net.Model.Entities +{ + /// + /// 微信支付平台证书 + /// + public partial class CoreCmsWeChatPayPlatformCertificate + { + /// + /// 构造函数 + /// + public CoreCmsWeChatPayPlatformCertificate() + { + } + + /// + /// 序列 + /// + [Display(Name = "序列")] + [SugarColumn(IsPrimaryKey = true, IsIdentity = true)] + [Required(ErrorMessage = "请输入{0}")] + public System.Int32 id { get; set; } + + /// + /// 证书算法类型 + /// + [Display(Name = "证书算法类型")] + [Required(ErrorMessage = "请输入{0}")] + [StringLength(maximumLength: 50, ErrorMessage = "{0}不能超过{1}字")] + public System.String algorithmType { get; set; } + + /// + /// 证书内容 + /// + [Display(Name = "证书内容")] + [Required(ErrorMessage = "请输入{0}")] + public System.String certificate { get; set; } + + /// + /// 获取生效时间 + /// + [Display(Name = "获取生效时间")] + [Required(ErrorMessage = "请输入{0}")] + public System.DateTime effectiveTime { get; set; } + + /// + /// 获取过期时间 + /// + [Display(Name = "获取过期时间")] + [Required(ErrorMessage = "请输入{0}")] + public System.DateTime expireTime { get; set; } + + /// + /// 证书编号 + /// + [Display(Name = "证书编号")] + [Required(ErrorMessage = "请输入{0}")] + [StringLength(maximumLength: 50, ErrorMessage = "{0}不能超过{1}字")] + public System.String serialNumber { get; set; } + + /// + /// 商户编号 + /// + [Display(Name = "商户编号")] + [Required(ErrorMessage = "请输入{0}")] + [StringLength(maximumLength: 50, ErrorMessage = "{0}不能超过{1}字")] + public System.String merchantId { get; set; } + + /// + /// 创建时间 + /// + [Display(Name = "创建时间")] + [Required(ErrorMessage = "请输入{0}")] + public System.DateTime createTime { get; set; } + + /// + /// 更新时间 + /// + [Display(Name = "更新时间")] + public System.DateTime? updataTime { get; set; } + } +} \ No newline at end of file diff --git a/CoreCms.Net.Model/Entities/User/CoreCmsUserTocash.cs b/CoreCms.Net.Model/Entities/User/CoreCmsUserTocash.cs index c5f46a15..720fb931 100644 --- a/CoreCms.Net.Model/Entities/User/CoreCmsUserTocash.cs +++ b/CoreCms.Net.Model/Entities/User/CoreCmsUserTocash.cs @@ -1,10 +1,10 @@ /*********************************************************************** * Project: CoreCms - * ProjectName: 核心内容管理系统 - * Web: https://www.corecms.net - * Author: 大灰灰 - * Email: jianweie@163.com - * CreateTime: 2022/7/4 23:39:39 + * ProjectName: 核心内容管理系统 + * Web: https://www.corecms.net + * Author: 大灰灰 + * Email: jianweie@163.com + * CreateTime: 2025/7/29 16:51:40 * Description: 暂无 ***********************************************************************/ @@ -32,142 +32,115 @@ namespace CoreCms.Net.Model.Entities [Display(Name = "id")] [SugarColumn(IsPrimaryKey = true, IsIdentity = true)] [Required(ErrorMessage = "请输入{0}")] - - public System.Int32 id { get; set; } - /// /// 用户ID /// [Display(Name = "用户ID")] [Required(ErrorMessage = "请输入{0}")] - - public System.Int32 userId { get; set; } - /// /// 提现金额 /// [Display(Name = "提现金额")] [Required(ErrorMessage = "请输入{0}")] - - public System.Decimal money { get; set; } - /// /// 银行名称 /// [Display(Name = "银行名称")] + [StringLength(maximumLength: 60, ErrorMessage = "{0}不能超过{1}字")] - - public System.String bankName { get; set; } - /// /// 银行缩写 /// [Display(Name = "银行缩写")] + [StringLength(maximumLength: 12, ErrorMessage = "{0}不能超过{1}字")] - - public System.String bankCode { get; set; } - /// /// 账号地区ID /// [Display(Name = "账号地区ID")] public System.Int32? bankAreaId { get; set; } - /// /// 开户行 /// [Display(Name = "开户行")] + [StringLength(maximumLength: 255, ErrorMessage = "{0}不能超过{1}字")] - - public System.String accountBank { get; set; } - /// /// 账户名 /// [Display(Name = "账户名")] + [StringLength(maximumLength: 60, ErrorMessage = "{0}不能超过{1}字")] - - public System.String accountName { get; set; } - /// /// 卡号 /// [Display(Name = "卡号")] + [StringLength(maximumLength: 30, ErrorMessage = "{0}不能超过{1}字")] - - public System.String cardNumber { get; set; } - /// /// 提现服务费 /// [Display(Name = "提现服务费")] [Required(ErrorMessage = "请输入{0}")] - - public System.Decimal withdrawals { get; set; } - /// /// 提现状态 /// [Display(Name = "提现状态")] [Required(ErrorMessage = "请输入{0}")] - - public System.Int32 status { get; set; } - /// /// 创建时间 /// [Display(Name = "创建时间")] [Required(ErrorMessage = "请输入{0}")] - - public System.DateTime createTime { get; set; } - /// /// 更新时间 /// [Display(Name = "更新时间")] public System.DateTime? updateTime { get; set; } - /// /// 提现方式 /// [Display(Name = "提现方式")] [Required(ErrorMessage = "请输入{0}")] - - public System.Int32 type { get; set; } - /// /// 反馈结果 /// [Display(Name = "反馈结果")] - [StringLength(maximumLength: 100, ErrorMessage = "{0}不能超过{1}字")] - + [StringLength(maximumLength: 1000, ErrorMessage = "{0}不能超过{1}字")] public System.String message { get; set; } + + /// + /// 需要用户领取 + /// + [Display(Name = "需要用户领取")] + [Required(ErrorMessage = "请输入{0}")] + public System.Boolean needUserGet { get; set; } } } \ No newline at end of file diff --git a/CoreCms.Net.Model/Entities/User/CoreCmsUserTocashPartial.cs b/CoreCms.Net.Model/Entities/User/CoreCmsUserTocashPartial.cs index bc6fc098..b14a86d0 100644 --- a/CoreCms.Net.Model/Entities/User/CoreCmsUserTocashPartial.cs +++ b/CoreCms.Net.Model/Entities/User/CoreCmsUserTocashPartial.cs @@ -32,5 +32,12 @@ namespace CoreCms.Net.Model.Entities [Display(Name = "用户昵称")] [SugarColumn(IsIgnore = true)] public string userNickName { get; set; } + + /// + /// 商家转账反馈数据 + /// + [Display(Name = "商家转账反馈数据")] + [SugarColumn(IsIgnore = true)] + public object merchantTransferData { get; set; } } } \ No newline at end of file diff --git a/CoreCms.Net.Model/Entities/User/CoreCmsUserTocashWeChatNotify.cs b/CoreCms.Net.Model/Entities/User/CoreCmsUserTocashWeChatNotify.cs new file mode 100644 index 00000000..433a9411 --- /dev/null +++ b/CoreCms.Net.Model/Entities/User/CoreCmsUserTocashWeChatNotify.cs @@ -0,0 +1,188 @@ +/*********************************************************************** + * Project: CoreCms + * ProjectName: 核心内容管理系统 + * Web: https://www.corecms.net + * Author: 大灰灰 + * Email: jianweie@163.com + * CreateTime: 2025/8/1 23:54:59 + * Description: 暂无 + ***********************************************************************/ + +using SqlSugar; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; + +namespace CoreCms.Net.Model.Entities +{ + /// + /// 用户提现使用商家转账微信回调通知 + /// + public partial class CoreCmsUserTocashWeChatNotify + { + /// + /// 构造函数 + /// + public CoreCmsUserTocashWeChatNotify() + { + } + + /// + /// 序列 + /// + [Display(Name = "序列")] + + [SugarColumn(IsPrimaryKey = true, IsIdentity = true)] + + [Required(ErrorMessage = "请输入{0}")] + + + + public System.Int32 id { get; set; } + + + /// + /// 通知ID + /// + [Display(Name = "通知ID")] + + [Required(ErrorMessage = "请输入{0}")] + [StringLength(maximumLength:50,ErrorMessage = "{0}不能超过{1}字")] + + + public System.String callBackId { get; set; } + + + /// + /// 通知创建时间 + /// + [Display(Name = "通知创建时间")] + + [Required(ErrorMessage = "请输入{0}")] + [StringLength(maximumLength:50,ErrorMessage = "{0}不能超过{1}字")] + + + public System.String create_time { get; set; } + + + /// + /// 通知数据类型 + /// + [Display(Name = "通知数据类型")] + + [Required(ErrorMessage = "请输入{0}")] + [StringLength(maximumLength:50,ErrorMessage = "{0}不能超过{1}字")] + + + public System.String resource_type { get; set; } + + + /// + /// 通知类型 + /// + [Display(Name = "通知类型")] + + [Required(ErrorMessage = "请输入{0}")] + [StringLength(maximumLength:50,ErrorMessage = "{0}不能超过{1}字")] + + + public System.String event_type { get; set; } + + + /// + /// 回调摘要 + /// + [Display(Name = "回调摘要")] + + [Required(ErrorMessage = "请输入{0}")] + [StringLength(maximumLength:100,ErrorMessage = "{0}不能超过{1}字")] + + + public System.String summary { get; set; } + + + /// + /// 通知数据 + /// + [Display(Name = "通知数据")] + + [Required(ErrorMessage = "请输入{0}")] + + + + public System.String resource { get; set; } + + + /// + /// 创建时间 + /// + [Display(Name = "创建时间")] + + [Required(ErrorMessage = "请输入{0}")] + + + + public System.DateTime createTime { get; set; } + + + /// + /// 验签的平台证书序列号或支付公钥ID + /// + [Display(Name = "验签的平台证书序列号或支付公钥ID")] + + + [StringLength(maximumLength:100,ErrorMessage = "{0}不能超过{1}字")] + + + public System.String wechatpaySerial { get; set; } + + + /// + /// 验签的签名值 + /// + [Display(Name = "验签的签名值")] + + + [StringLength(maximumLength:1000,ErrorMessage = "{0}不能超过{1}字")] + + + public System.String wechatpaySignature { get; set; } + + + /// + /// 验签的时间戳 + /// + [Display(Name = "验签的时间戳")] + + + [StringLength(maximumLength:50,ErrorMessage = "{0}不能超过{1}字")] + + + public System.String wechatpayTimestamp { get; set; } + + + /// + /// 验签的随机字符串 + /// + [Display(Name = "验签的随机字符串")] + + + [StringLength(maximumLength:100,ErrorMessage = "{0}不能超过{1}字")] + + + public System.String wechatpayNonce { get; set; } + + + /// + /// 解密数据 + /// + [Display(Name = "解密数据")] + + + [StringLength(maximumLength:1000,ErrorMessage = "{0}不能超过{1}字")] + + + public System.String decryptedData { get; set; } + + + } +} diff --git a/CoreCms.Net.Model/Entities/User/CoreCmsUserTocashWeChatResponse.cs b/CoreCms.Net.Model/Entities/User/CoreCmsUserTocashWeChatResponse.cs new file mode 100644 index 00000000..6a255c87 --- /dev/null +++ b/CoreCms.Net.Model/Entities/User/CoreCmsUserTocashWeChatResponse.cs @@ -0,0 +1,105 @@ +/*********************************************************************** + * Project: CoreCms + * ProjectName: 核心内容管理系统 + * Web: https://www.corecms.net + * Author: 大灰灰 + * Email: jianweie@163.com + * CreateTime: 2025/7/23 16:44:04 + * Description: 暂无 + ***********************************************************************/ + +using SqlSugar; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; + +namespace CoreCms.Net.Model.Entities +{ + /// + /// 用户提现使用商家转账回调记录 + /// + public partial class CoreCmsUserTocashWeChatResponse + { + /// + /// 构造函数 + /// + public CoreCmsUserTocashWeChatResponse() + { + } + + /// + /// 序列 + /// + [Display(Name = "序列")] + [SugarColumn(IsPrimaryKey = true, IsIdentity = true)] + [Required(ErrorMessage = "请输入{0}")] + public System.Int32 id { get; set; } + + /// + /// 商户单号 + /// + [Display(Name = "商户单号")] + [Required(ErrorMessage = "请输入{0}")] + [StringLength(maximumLength: 50, ErrorMessage = "{0}不能超过{1}字")] + public System.String out_bill_no { get; set; } + + /// + /// 微信转账单号 + /// + [Display(Name = "微信转账单号")] + [Required(ErrorMessage = "请输入{0}")] + [StringLength(maximumLength: 100, ErrorMessage = "{0}不能超过{1}字")] + public System.String transfer_bill_no { get; set; } + + /// + /// 单据创建时间 + /// + [Display(Name = "单据创建时间")] + [Required(ErrorMessage = "请输入{0}")] + public System.DateTime create_time { get; set; } + + /// + /// 单据状态 + /// + [Display(Name = "单据状态")] + [Required(ErrorMessage = "请输入{0}")] + [StringLength(maximumLength: 50, ErrorMessage = "{0}不能超过{1}字")] + public System.String state { get; set; } + + /// + /// 跳转领取页面的package信息 + /// + [Display(Name = "跳转领取页面的package信息")] + + [StringLength(maximumLength: 255, ErrorMessage = "{0}不能超过{1}字")] + public System.String package_info { get; set; } + + /// + /// 状态码 + /// + [Display(Name = "状态码")] + public System.Int32? code { get; set; } + + /// + /// 消息内容 + /// + [Display(Name = "消息内容")] + + [StringLength(maximumLength: 255, ErrorMessage = "{0}不能超过{1}字")] + public System.String message { get; set; } + + /// + /// 描述 + /// + [Display(Name = "描述")] + + [StringLength(maximumLength: 255, ErrorMessage = "{0}不能超过{1}字")] + public System.String detail { get; set; } + + /// + /// 创建时间 + /// + [Display(Name = "创建时间")] + [Required(ErrorMessage = "请输入{0}")] + public System.DateTime createTime { get; set; } + } +} \ No newline at end of file diff --git a/CoreCms.Net.Model/FromBody/FMTransferBillsCallBack.cs b/CoreCms.Net.Model/FromBody/FMTransferBillsCallBack.cs new file mode 100644 index 00000000..a6e96cf3 --- /dev/null +++ b/CoreCms.Net.Model/FromBody/FMTransferBillsCallBack.cs @@ -0,0 +1,80 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CoreCms.Net.Model.FromBody +{ + /// + /// 商家转账回调通知实体数据 + /// + public class FMTransferBillsCallBack + { + /// + /// 通知ID】通知的唯一ID + /// + public string id { get; set; } + + /// + /// 【通知创建时间】 + /// 通知创建的时间,遵循rfc3339标准格式,格式为yyyy-MM-DDTHH:mm:ss+TIMEZONE,yyyy-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss.表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间)。例如:2015-05-20T13:29:35+08:00表示北京时间2015年05月20日13点29分35秒。 + /// + public string create_time { get; set; } + + /// + /// 【通知数据类型】通知的资源数据类型,商家转账通知为encrypt-resource + /// + public string resource_type { get; set; } + + /// + /// 【通知类型】通知的类型,商家转账通知的类型为MCHTRANSFER.BILL.FINISHED + /// + public string event_type { get; set; } + + /// + /// 【回调摘要】回调摘要 + /// + public string summary { get; set; } + + /// + /// 通知数据 + /// + public FMTransferBillsCallBackResource resource { get; set; } + + } + + + /// + /// 商家转账回调通知实体数据-通知数据 + /// + public class FMTransferBillsCallBackResource + { + /// + /// 【原始类型】原始回调类型,为mch_payment + /// + public string original_type { get; set; } + + /// + /// 【加密算法类型】对开启结果数据进行加密的加密算法,目前只支持AEAD_AES_256_GCM + /// + public string algorithm { get; set; } + + /// + /// 数据密文】Base64编码后的商家转账结果数据密文 + /// + public string ciphertext { get; set; } + + /// + /// 【附加数据】附加数据 + /// + public string? associated_data { get; set; } + + /// + /// 随机串】加密使用的随机串。 + /// + public string? nonce { get; set; } + + } + +} diff --git a/CoreCms.Net.Repository/Pay/CoreCmsWeChatPayPlatformCertificateRepository.cs b/CoreCms.Net.Repository/Pay/CoreCmsWeChatPayPlatformCertificateRepository.cs new file mode 100644 index 00000000..734c36c0 --- /dev/null +++ b/CoreCms.Net.Repository/Pay/CoreCmsWeChatPayPlatformCertificateRepository.cs @@ -0,0 +1,212 @@ +/*********************************************************************** + * Project: CoreCms + * ProjectName: 核心内容管理系统 + * Web: https://www.corecms.net + * Author: 大灰灰 + * Email: jianweie@163.com + * CreateTime: 2025/7/21 20:36:56 + * Description: 暂无 + ***********************************************************************/ + +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Threading.Tasks; +using CoreCms.Net.Caching.Manual; +using CoreCms.Net.Configuration; +using CoreCms.Net.Model.Entities; +using CoreCms.Net.Model.ViewModels.Basics; +using CoreCms.Net.IRepository; +using CoreCms.Net.IRepository.UnitOfWork; +using CoreCms.Net.Model.ViewModels.UI; +using SqlSugar; + +namespace CoreCms.Net.Repository +{ + /// + /// 微信支付平台证书 接口实现 + /// + public class CoreCmsWeChatPayPlatformCertificateRepository : BaseRepository, ICoreCmsWeChatPayPlatformCertificateRepository + { + private readonly IUnitOfWork _unitOfWork; + + public CoreCmsWeChatPayPlatformCertificateRepository(IUnitOfWork unitOfWork) : base(unitOfWork) + { + _unitOfWork = unitOfWork; + } + + #region 实现重写增删改查操作========================================================== + + /// + /// 重写异步插入方法 + /// + /// 实体数据 + /// + public async Task InsertAsync(CoreCmsWeChatPayPlatformCertificate entity) + { + var jm = new AdminUiCallBack(); + + var bl = await DbClient.Insertable(entity).ExecuteReturnIdentityAsync() > 0; + jm.code = bl ? 0 : 1; + jm.msg = bl ? GlobalConstVars.CreateSuccess : GlobalConstVars.CreateFailure; + + return jm; + } + + /// + /// 重写异步更新方法 + /// + /// + /// + public async Task UpdateAsync(CoreCmsWeChatPayPlatformCertificate entity) + { + var jm = new AdminUiCallBack(); + + var oldModel = await DbClient.Queryable().In(entity.id).SingleAsync(); + if (oldModel == null) + { + jm.msg = "不存在此信息"; + return jm; + } + //事物处理过程开始 + oldModel.id = entity.id; + oldModel.algorithmType = entity.algorithmType; + oldModel.certificate = entity.certificate; + oldModel.effectiveTime = entity.effectiveTime; + oldModel.expireTime = entity.expireTime; + oldModel.serialNumber = entity.serialNumber; + oldModel.merchantId = entity.merchantId; + oldModel.createTime = entity.createTime; + oldModel.updataTime = entity.updataTime; + + //事物处理过程结束 + var bl = await DbClient.Updateable(oldModel).ExecuteCommandHasChangeAsync(); + jm.code = bl ? 0 : 1; + jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure; + + return jm; + } + + /// + /// 重写异步更新方法 + /// + /// + /// + public async Task UpdateAsync(List entity) + { + var jm = new AdminUiCallBack(); + + var bl = await DbClient.Updateable(entity).ExecuteCommandHasChangeAsync(); + jm.code = bl ? 0 : 1; + jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure; + + return jm; + } + + /// + /// 重写删除指定ID的数据 + /// + /// + /// + public async Task DeleteByIdAsync(object id) + { + var jm = new AdminUiCallBack(); + + var bl = await DbClient.Deleteable(id).ExecuteCommandHasChangeAsync(); + jm.code = bl ? 0 : 1; + jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure; + + return jm; + } + + /// + /// 重写删除指定ID集合的数据(批量删除) + /// + /// + /// + public async Task DeleteByIdsAsync(int[] ids) + { + var jm = new AdminUiCallBack(); + + var bl = await DbClient.Deleteable().In(ids).ExecuteCommandHasChangeAsync(); + jm.code = bl ? 0 : 1; + jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure; + + return jm; + } + + #endregion 实现重写增删改查操作========================================================== + + #region 获取缓存的所有数据========================================================== + + /// + /// 获取缓存的所有数据 + /// + /// + public async Task> GetCaChe() + { + var list = await DbClient.Queryable().With(SqlWith.NoLock).WithCache().ToListAsync(); + return list; + } + + #endregion 获取缓存的所有数据========================================================== + + #region 重写根据条件查询分页数据 + + /// + /// 重写根据条件查询分页数据 + /// + /// 判断集合 + /// 排序方式 + /// 当前页面索引 + /// 分布大小 + /// + /// 是否使用WITH(NOLOCK) + /// + public async Task> QueryPageAsync(Expression> predicate, + Expression> orderByExpression, OrderByType orderByType, int pageIndex = 1, + int pageSize = 20, bool blUseNoLock = false) + { + RefAsync totalCount = 0; + List page; + if (blUseNoLock) + { + page = await DbClient.Queryable() + .OrderByIF(orderByExpression != null, orderByExpression, orderByType) + .WhereIF(predicate != null, predicate).Select(p => new CoreCmsWeChatPayPlatformCertificate + { + id = p.id, + algorithmType = p.algorithmType, + certificate = p.certificate, + effectiveTime = p.effectiveTime, + expireTime = p.expireTime, + serialNumber = p.serialNumber, + merchantId = p.merchantId, + createTime = p.createTime, + updataTime = p.updataTime, + }).With(SqlWith.NoLock).ToPageListAsync(pageIndex, pageSize, totalCount); + } + else + { + page = await DbClient.Queryable() + .OrderByIF(orderByExpression != null, orderByExpression, orderByType) + .WhereIF(predicate != null, predicate).Select(p => new CoreCmsWeChatPayPlatformCertificate + { + id = p.id, + algorithmType = p.algorithmType, + certificate = p.certificate, + effectiveTime = p.effectiveTime, + expireTime = p.expireTime, + serialNumber = p.serialNumber, + merchantId = p.merchantId, + createTime = p.createTime, + updataTime = p.updataTime, + }).ToPageListAsync(pageIndex, pageSize, totalCount); + } + var list = new PageList(page, pageIndex, pageSize, totalCount); + return list; + } + + #endregion 重写根据条件查询分页数据 + } +} \ No newline at end of file diff --git a/CoreCms.Net.Repository/Pay/WeChatPayConfigRepository.cs b/CoreCms.Net.Repository/Pay/WeChatPayConfigRepository.cs index de01564d..ef109208 100644 --- a/CoreCms.Net.Repository/Pay/WeChatPayConfigRepository.cs +++ b/CoreCms.Net.Repository/Pay/WeChatPayConfigRepository.cs @@ -1,9 +1,9 @@ /*********************************************************************** * Project: CoreCms - * ProjectName: 核心内容管理系统 - * Web: https://www.corecms.net - * Author: 大灰灰 - * Email: jianweie@163.com + * ProjectName: 核心内容管理系统 + * Web: https://www.corecms.net + * Author: 大灰灰 + * Email: jianweie@163.com * CreateTime: 2023/4/22 23:40:15 * Description: 暂无 ***********************************************************************/ @@ -29,12 +29,13 @@ namespace CoreCms.Net.Repository public class WeChatPayConfigRepository : BaseRepository, IWeChatPayConfigRepository { private readonly IUnitOfWork _unitOfWork; + public WeChatPayConfigRepository(IUnitOfWork unitOfWork) : base(unitOfWork) { _unitOfWork = unitOfWork; } - #region 实现重写增删改查操作========================================================== + #region 实现重写增删改查操作========================================================== /// /// 重写异步插入方法 @@ -64,11 +65,11 @@ namespace CoreCms.Net.Repository var oldModel = await DbClient.Queryable().In(entity.id).SingleAsync(); if (oldModel == null) { - jm.msg = "不存在此信息"; - return jm; + jm.msg = "不存在此信息"; + return jm; } //事物处理过程开始 - oldModel.id = entity.id; + //oldModel.id = entity.id; oldModel.appId = entity.appId; oldModel.mchId = entity.mchId; oldModel.apiKey = entity.apiKey; @@ -83,7 +84,14 @@ namespace CoreCms.Net.Repository oldModel.isEnable = entity.isEnable; oldModel.isDefault = entity.isDefault; oldModel.appType = entity.appType; - + oldModel.payType = entity.payType; + oldModel.certificateSerialNumber = entity.certificateSerialNumber; + oldModel.certificatePrivateKey = entity.certificatePrivateKey; + oldModel.platformSerialNumber = entity.platformSerialNumber; + oldModel.platformPublicKeyId = entity.platformPublicKeyId; + oldModel.platformPublicKey = entity.platformPublicKey; + oldModel.transferBillsUrl = entity.transferBillsUrl; + //事物处理过程结束 var bl = await DbClient.Updateable(oldModel).ExecuteCommandHasChangeAsync(); jm.code = bl ? 0 : 1; @@ -140,9 +148,9 @@ namespace CoreCms.Net.Repository return jm; } - #endregion + #endregion 实现重写增删改查操作========================================================== - #region 获取缓存的所有数据========================================================== + #region 获取缓存的所有数据========================================================== /// /// 获取缓存的所有数据 @@ -150,14 +158,14 @@ namespace CoreCms.Net.Repository /// public async Task> GetCaChe() { - var list = await DbClient.Queryable().With(SqlWith.NoLock).WithCache().ToListAsync(); + var list = await DbClient.Queryable().With(SqlWith.NoLock).WithCache().ToListAsync(); return list; } - #endregion - + #endregion 获取缓存的所有数据========================================================== #region 重写根据条件查询分页数据 + /// /// 重写根据条件查询分页数据 /// @@ -180,22 +188,28 @@ namespace CoreCms.Net.Repository .OrderByIF(orderByExpression != null, orderByExpression, orderByType) .WhereIF(predicate != null, predicate).Select(p => new CoreCmsWeChatPayConfig { - id = p.id, - appId = p.appId, - mchId = p.mchId, - apiKey = p.apiKey, - apiV3Key = p.apiV3Key, - certificate = p.certificate, - rsaPublicKey = p.rsaPublicKey, - subAppId = p.subAppId, - subMchId = p.subMchId, - notifyUrl = p.notifyUrl, - refundUrl = p.refundUrl, - jumpUrl = p.jumpUrl, - isEnable = p.isEnable, - isDefault = p.isDefault, - appType = p.appType, - + id = p.id, + appId = p.appId, + mchId = p.mchId, + apiKey = p.apiKey, + apiV3Key = p.apiV3Key, + certificate = p.certificate, + rsaPublicKey = p.rsaPublicKey, + subAppId = p.subAppId, + subMchId = p.subMchId, + notifyUrl = p.notifyUrl, + refundUrl = p.refundUrl, + jumpUrl = p.jumpUrl, + isEnable = p.isEnable, + isDefault = p.isDefault, + appType = p.appType, + payType = p.payType, + certificateSerialNumber = p.certificateSerialNumber, + certificatePrivateKey = p.certificatePrivateKey, + platformSerialNumber = p.platformSerialNumber, + platformPublicKey = p.platformPublicKey, + platformPublicKeyId = p.platformPublicKeyId, + transferBillsUrl = p.transferBillsUrl }).With(SqlWith.NoLock).ToPageListAsync(pageIndex, pageSize, totalCount); } else @@ -204,29 +218,33 @@ namespace CoreCms.Net.Repository .OrderByIF(orderByExpression != null, orderByExpression, orderByType) .WhereIF(predicate != null, predicate).Select(p => new CoreCmsWeChatPayConfig { - id = p.id, - appId = p.appId, - mchId = p.mchId, - apiKey = p.apiKey, - apiV3Key = p.apiV3Key, - certificate = p.certificate, - rsaPublicKey = p.rsaPublicKey, - subAppId = p.subAppId, - subMchId = p.subMchId, - notifyUrl = p.notifyUrl, - refundUrl = p.refundUrl, - jumpUrl = p.jumpUrl, - isEnable = p.isEnable, - isDefault = p.isDefault, - appType = p.appType, - + id = p.id, + appId = p.appId, + mchId = p.mchId, + apiKey = p.apiKey, + apiV3Key = p.apiV3Key, + certificate = p.certificate, + rsaPublicKey = p.rsaPublicKey, + subAppId = p.subAppId, + subMchId = p.subMchId, + notifyUrl = p.notifyUrl, + refundUrl = p.refundUrl, + jumpUrl = p.jumpUrl, + isEnable = p.isEnable, + isDefault = p.isDefault, + appType = p.appType, + certificateSerialNumber = p.certificateSerialNumber, + certificatePrivateKey = p.certificatePrivateKey, + platformSerialNumber = p.platformSerialNumber, + platformPublicKey = p.platformPublicKey, + platformPublicKeyId = p.platformPublicKeyId, + transferBillsUrl = p.transferBillsUrl }).ToPageListAsync(pageIndex, pageSize, totalCount); } var list = new PageList(page, pageIndex, pageSize, totalCount); return list; } - #endregion - + #endregion 重写根据条件查询分页数据 } -} +} \ No newline at end of file diff --git a/CoreCms.Net.Repository/User/CoreCmsUserTocashRepository.cs b/CoreCms.Net.Repository/User/CoreCmsUserTocashRepository.cs index c8e95ae8..32bdec64 100644 --- a/CoreCms.Net.Repository/User/CoreCmsUserTocashRepository.cs +++ b/CoreCms.Net.Repository/User/CoreCmsUserTocashRepository.cs @@ -69,7 +69,8 @@ namespace CoreCms.Net.Repository updateTime = p.updateTime, userNickName = sc.nickName, type = p.type, - message = p.message + message = p.message, + needUserGet = p.needUserGet }) .With(SqlWith.NoLock) .MergeTable() @@ -96,7 +97,8 @@ namespace CoreCms.Net.Repository updateTime = p.updateTime, userNickName = sc.nickName, type = p.type, - message = p.message + message = p.message, + needUserGet = p.needUserGet }) .MergeTable() .OrderByIF(orderByExpression != null, orderByExpression, orderByType) diff --git a/CoreCms.Net.Repository/User/CoreCmsUserTocashWeChatNotifyRepository.cs b/CoreCms.Net.Repository/User/CoreCmsUserTocashWeChatNotifyRepository.cs new file mode 100644 index 00000000..d22573ab --- /dev/null +++ b/CoreCms.Net.Repository/User/CoreCmsUserTocashWeChatNotifyRepository.cs @@ -0,0 +1,223 @@ +/*********************************************************************** + * Project: CoreCms + * ProjectName: 核心内容管理系统 + * Web: https://www.corecms.net + * Author: 大灰灰 + * Email: jianweie@163.com + * CreateTime: 2025/8/1 23:54:59 + * Description: 暂无 + ***********************************************************************/ + +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Threading.Tasks; +using CoreCms.Net.Caching.Manual; +using CoreCms.Net.Configuration; +using CoreCms.Net.Model.Entities; +using CoreCms.Net.Model.ViewModels.Basics; +using CoreCms.Net.IRepository; +using CoreCms.Net.IRepository.UnitOfWork; +using CoreCms.Net.Model.ViewModels.UI; +using SqlSugar; + +namespace CoreCms.Net.Repository +{ + /// + /// 用户提现使用商家转账微信回调通知 接口实现 + /// + public class CoreCmsUserTocashWeChatNotifyRepository : BaseRepository, ICoreCmsUserTocashWeChatNotifyRepository + { + private readonly IUnitOfWork _unitOfWork; + public CoreCmsUserTocashWeChatNotifyRepository(IUnitOfWork unitOfWork) : base(unitOfWork) + { + _unitOfWork = unitOfWork; + } + + #region 实现重写增删改查操作========================================================== + + + /// + /// 重写异步插入方法(返回序列) + /// + /// 实体数据 + /// + public async Task ExecuteReturnIdentityAsync(CoreCmsUserTocashWeChatNotify entity) + { + var id = await DbClient.Insertable(entity).ExecuteReturnIdentityAsync(); + return id; + } + + /// + /// 重写异步插入方法 + /// + /// 实体数据 + /// + public async Task InsertAsync(CoreCmsUserTocashWeChatNotify entity) + { + var jm = new AdminUiCallBack(); + + var bl = await DbClient.Insertable(entity).ExecuteReturnIdentityAsync() > 0; + jm.code = bl ? 0 : 1; + jm.msg = bl ? GlobalConstVars.CreateSuccess : GlobalConstVars.CreateFailure; + + return jm; + } + + /// + /// 重写异步更新方法 + /// + /// + /// + public async Task UpdateAsync(CoreCmsUserTocashWeChatNotify entity) + { + var jm = new AdminUiCallBack(); + + var oldModel = await DbClient.Queryable().In(entity.id).SingleAsync(); + if (oldModel == null) + { + jm.msg = "不存在此信息"; + return jm; + } + //事物处理过程开始 + //oldModel.id = entity.id; + oldModel.callBackId = entity.callBackId; + oldModel.create_time = entity.create_time; + oldModel.resource_type = entity.resource_type; + oldModel.event_type = entity.event_type; + oldModel.summary = entity.summary; + oldModel.resource = entity.resource; + oldModel.createTime = entity.createTime; + oldModel.wechatpaySerial = entity.wechatpaySerial; + oldModel.wechatpaySignature = entity.wechatpaySignature; + oldModel.wechatpayTimestamp = entity.wechatpayTimestamp; + oldModel.wechatpayNonce = entity.wechatpayNonce; + oldModel.decryptedData = entity.decryptedData; + + //事物处理过程结束 + var bl = await DbClient.Updateable(oldModel).ExecuteCommandHasChangeAsync(); + jm.code = bl ? 0 : 1; + jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure; + + return jm; + } + + /// + /// 重写异步更新方法 + /// + /// + /// + public async Task UpdateAsync(List entity) + { + var jm = new AdminUiCallBack(); + + var bl = await DbClient.Updateable(entity).ExecuteCommandHasChangeAsync(); + jm.code = bl ? 0 : 1; + jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure; + + return jm; + } + + /// + /// 重写删除指定ID的数据 + /// + /// + /// + public async Task DeleteByIdAsync(object id) + { + var jm = new AdminUiCallBack(); + + var bl = await DbClient.Deleteable(id).ExecuteCommandHasChangeAsync(); + jm.code = bl ? 0 : 1; + jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure; + + return jm; + } + + /// + /// 重写删除指定ID集合的数据(批量删除) + /// + /// + /// + public async Task DeleteByIdsAsync(int[] ids) + { + var jm = new AdminUiCallBack(); + + var bl = await DbClient.Deleteable().In(ids).ExecuteCommandHasChangeAsync(); + jm.code = bl ? 0 : 1; + jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure; + + return jm; + } + + #endregion + + #region 重写根据条件查询分页数据 + /// + /// 重写根据条件查询分页数据 + /// + /// 判断集合 + /// 排序方式 + /// 当前页面索引 + /// 分布大小 + /// + /// 是否使用WITH(NOLOCK) + /// + public async Task> QueryPageAsync(Expression> predicate, + Expression> orderByExpression, OrderByType orderByType, int pageIndex = 1, + int pageSize = 20, bool blUseNoLock = false) + { + RefAsync totalCount = 0; + List page; + if (blUseNoLock) + { + page = await DbClient.Queryable() + .OrderByIF(orderByExpression != null, orderByExpression, orderByType) + .WhereIF(predicate != null, predicate).Select(p => new CoreCmsUserTocashWeChatNotify + { + id = p.id, + callBackId = p.callBackId, + create_time = p.create_time, + resource_type = p.resource_type, + event_type = p.event_type, + summary = p.summary, + resource = p.resource, + createTime = p.createTime, + wechatpaySerial = p.wechatpaySerial, + wechatpaySignature = p.wechatpaySignature, + wechatpayTimestamp = p.wechatpayTimestamp, + wechatpayNonce = p.wechatpayNonce, + decryptedData = p.decryptedData, + + }).With(SqlWith.NoLock).ToPageListAsync(pageIndex, pageSize, totalCount); + } + else + { + page = await DbClient.Queryable() + .OrderByIF(orderByExpression != null, orderByExpression, orderByType) + .WhereIF(predicate != null, predicate).Select(p => new CoreCmsUserTocashWeChatNotify + { + id = p.id, + callBackId = p.callBackId, + create_time = p.create_time, + resource_type = p.resource_type, + event_type = p.event_type, + summary = p.summary, + resource = p.resource, + createTime = p.createTime, + wechatpaySerial = p.wechatpaySerial, + wechatpaySignature = p.wechatpaySignature, + wechatpayTimestamp = p.wechatpayTimestamp, + wechatpayNonce = p.wechatpayNonce, + decryptedData = p.decryptedData, + + }).ToPageListAsync(pageIndex, pageSize, totalCount); + } + var list = new PageList(page, pageIndex, pageSize, totalCount); + return list; + } + + #endregion + + } +} diff --git a/CoreCms.Net.Repository/User/CoreCmsUserTocashWeChatResponseRepository.cs b/CoreCms.Net.Repository/User/CoreCmsUserTocashWeChatResponseRepository.cs new file mode 100644 index 00000000..9f9f05b9 --- /dev/null +++ b/CoreCms.Net.Repository/User/CoreCmsUserTocashWeChatResponseRepository.cs @@ -0,0 +1,201 @@ +/*********************************************************************** + * Project: CoreCms + * ProjectName: 核心内容管理系统 + * Web: https://www.corecms.net + * Author: 大灰灰 + * Email: jianweie@163.com + * CreateTime: 2025/7/23 16:37:18 + * Description: 暂无 + ***********************************************************************/ + +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Threading.Tasks; +using CoreCms.Net.Caching.Manual; +using CoreCms.Net.Configuration; +using CoreCms.Net.Model.Entities; +using CoreCms.Net.Model.ViewModels.Basics; +using CoreCms.Net.IRepository; +using CoreCms.Net.IRepository.UnitOfWork; +using CoreCms.Net.Model.ViewModels.UI; +using SqlSugar; + +namespace CoreCms.Net.Repository +{ + /// + /// 用户提现使用商家转账回调记录 接口实现 + /// + public class CoreCmsUserTocashWeChatResponseRepository : BaseRepository, ICoreCmsUserTocashWeChatResponseRepository + { + private readonly IUnitOfWork _unitOfWork; + + public CoreCmsUserTocashWeChatResponseRepository(IUnitOfWork unitOfWork) : base(unitOfWork) + { + _unitOfWork = unitOfWork; + } + + #region 实现重写增删改查操作========================================================== + + /// + /// 重写异步插入方法 + /// + /// 实体数据 + /// + public async Task InsertAsync(CoreCmsUserTocashWeChatResponse entity) + { + var jm = new AdminUiCallBack(); + + var bl = await DbClient.Insertable(entity).ExecuteReturnIdentityAsync() > 0; + jm.code = bl ? 0 : 1; + jm.msg = bl ? GlobalConstVars.CreateSuccess : GlobalConstVars.CreateFailure; + + return jm; + } + + /// + /// 重写异步更新方法 + /// + /// + /// + public async Task UpdateAsync(CoreCmsUserTocashWeChatResponse entity) + { + var jm = new AdminUiCallBack(); + + var oldModel = await DbClient.Queryable().In(entity.id).SingleAsync(); + if (oldModel == null) + { + jm.msg = "不存在此信息"; + return jm; + } + //事物处理过程开始 + oldModel.id = entity.id; + oldModel.out_bill_no = entity.out_bill_no; + oldModel.transfer_bill_no = entity.transfer_bill_no; + oldModel.create_time = entity.create_time; + oldModel.state = entity.state; + oldModel.package_info = entity.package_info; + oldModel.code = entity.code; + oldModel.message = entity.message; + oldModel.detail = entity.detail; + oldModel.createTime = entity.createTime; + + //事物处理过程结束 + var bl = await DbClient.Updateable(oldModel).ExecuteCommandHasChangeAsync(); + jm.code = bl ? 0 : 1; + jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure; + + return jm; + } + + /// + /// 重写异步更新方法 + /// + /// + /// + public async Task UpdateAsync(List entity) + { + var jm = new AdminUiCallBack(); + + var bl = await DbClient.Updateable(entity).ExecuteCommandHasChangeAsync(); + jm.code = bl ? 0 : 1; + jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure; + + return jm; + } + + /// + /// 重写删除指定ID的数据 + /// + /// + /// + public async Task DeleteByIdAsync(object id) + { + var jm = new AdminUiCallBack(); + + var bl = await DbClient.Deleteable(id).ExecuteCommandHasChangeAsync(); + jm.code = bl ? 0 : 1; + jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure; + + return jm; + } + + /// + /// 重写删除指定ID集合的数据(批量删除) + /// + /// + /// + public async Task DeleteByIdsAsync(int[] ids) + { + var jm = new AdminUiCallBack(); + + var bl = await DbClient.Deleteable().In(ids).ExecuteCommandHasChangeAsync(); + jm.code = bl ? 0 : 1; + jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure; + + return jm; + } + + #endregion 实现重写增删改查操作========================================================== + + #region 重写根据条件查询分页数据 + + /// + /// 重写根据条件查询分页数据 + /// + /// 判断集合 + /// 排序方式 + /// 当前页面索引 + /// 分布大小 + /// + /// 是否使用WITH(NOLOCK) + /// + public async Task> QueryPageAsync(Expression> predicate, + Expression> orderByExpression, OrderByType orderByType, int pageIndex = 1, + int pageSize = 20, bool blUseNoLock = false) + { + RefAsync totalCount = 0; + List page; + if (blUseNoLock) + { + page = await DbClient.Queryable() + .OrderByIF(orderByExpression != null, orderByExpression, orderByType) + .WhereIF(predicate != null, predicate).Select(p => new CoreCmsUserTocashWeChatResponse + { + id = p.id, + out_bill_no = p.out_bill_no, + transfer_bill_no = p.transfer_bill_no, + create_time = p.create_time, + state = p.state, + package_info = p.package_info, + code = p.code, + message = p.message, + detail = p.detail, + createTime = p.createTime, + }).With(SqlWith.NoLock).ToPageListAsync(pageIndex, pageSize, totalCount); + } + else + { + page = await DbClient.Queryable() + .OrderByIF(orderByExpression != null, orderByExpression, orderByType) + .WhereIF(predicate != null, predicate).Select(p => new CoreCmsUserTocashWeChatResponse + { + id = p.id, + out_bill_no = p.out_bill_no, + transfer_bill_no = p.transfer_bill_no, + create_time = p.create_time, + state = p.state, + package_info = p.package_info, + code = p.code, + message = p.message, + detail = p.detail, + createTime = p.createTime, + }).ToPageListAsync(pageIndex, pageSize, totalCount); + } + var list = new PageList(page, pageIndex, pageSize, totalCount); + return list; + } + + #endregion 重写根据条件查询分页数据 + } +} \ No newline at end of file diff --git a/CoreCms.Net.Services/CoreCms.Net.Services.csproj b/CoreCms.Net.Services/CoreCms.Net.Services.csproj index 78e6109f..25d7fe2c 100644 --- a/CoreCms.Net.Services/CoreCms.Net.Services.csproj +++ b/CoreCms.Net.Services/CoreCms.Net.Services.csproj @@ -16,6 +16,7 @@ + diff --git a/CoreCms.Net.Services/Pay/CoreCmsWeChatPayPlatformCertificateServices.cs b/CoreCms.Net.Services/Pay/CoreCmsWeChatPayPlatformCertificateServices.cs new file mode 100644 index 00000000..03da356d --- /dev/null +++ b/CoreCms.Net.Services/Pay/CoreCmsWeChatPayPlatformCertificateServices.cs @@ -0,0 +1,129 @@ +/*********************************************************************** + * Project: CoreCms + * ProjectName: 核心内容管理系统 + * Web: https://www.corecms.net + * Author: 大灰灰 + * Email: jianweie@163.com + * CreateTime: 2025/7/21 20:36:56 + * Description: 暂无 + ***********************************************************************/ + +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Threading.Tasks; +using CoreCms.Net.Configuration; +using CoreCms.Net.IRepository; +using CoreCms.Net.IRepository.UnitOfWork; +using CoreCms.Net.IServices; +using CoreCms.Net.Model.Entities; +using CoreCms.Net.Model.ViewModels.Basics; +using CoreCms.Net.Model.ViewModels.UI; +using SqlSugar; + +namespace CoreCms.Net.Services +{ + /// + /// 微信支付平台证书 接口实现 + /// + public class CoreCmsWeChatPayPlatformCertificateServices : BaseServices, ICoreCmsWeChatPayPlatformCertificateServices + { + private readonly ICoreCmsWeChatPayPlatformCertificateRepository _dal; + private readonly IUnitOfWork _unitOfWork; + + public CoreCmsWeChatPayPlatformCertificateServices(IUnitOfWork unitOfWork, ICoreCmsWeChatPayPlatformCertificateRepository dal) + { + this._dal = dal; + base.BaseDal = dal; + _unitOfWork = unitOfWork; + } + + #region 实现重写增删改查操作========================================================== + + /// + /// 重写异步插入方法 + /// + /// 实体数据 + /// + public async Task InsertAsync(CoreCmsWeChatPayPlatformCertificate entity) + { + return await _dal.InsertAsync(entity); + } + + /// + /// 重写异步更新方法方法 + /// + /// + /// + public async Task UpdateAsync(CoreCmsWeChatPayPlatformCertificate entity) + { + return await _dal.UpdateAsync(entity); + } + + /// + /// 重写异步更新方法方法 + /// + /// + /// + public async Task UpdateAsync(List entity) + { + return await _dal.UpdateAsync(entity); + } + + /// + /// 重写删除指定ID的数据 + /// + /// + /// + public async Task DeleteByIdAsync(object id) + { + return await _dal.DeleteByIdAsync(id); + } + + /// + /// 重写删除指定ID集合的数据(批量删除) + /// + /// + /// + public async Task DeleteByIdsAsync(int[] ids) + { + return await _dal.DeleteByIdsAsync(ids); + } + + #endregion 实现重写增删改查操作========================================================== + + #region 获取缓存的所有数据========================================================== + + /// + /// 获取缓存的所有数据 + /// + /// + public async Task> GetCaChe() + { + return await _dal.GetCaChe(); + } + + #endregion 获取缓存的所有数据========================================================== + + #region 重写根据条件查询分页数据 + + /// + /// 重写根据条件查询分页数据 + /// + /// 判断集合 + /// 排序方式 + /// 当前页面索引 + /// 分布大小 + /// + /// 是否使用WITH(NOLOCK) + /// + public async Task> QueryPageAsync(Expression> predicate, + Expression> orderByExpression, OrderByType orderByType, int pageIndex = 1, + int pageSize = 20, bool blUseNoLock = false) + { + return await _dal.QueryPageAsync(predicate, orderByExpression, orderByType, pageIndex, pageSize, blUseNoLock); + } + + #endregion 重写根据条件查询分页数据 + } +} \ No newline at end of file diff --git a/CoreCms.Net.Services/User/CoreCmsUserTocashServices.cs b/CoreCms.Net.Services/User/CoreCmsUserTocashServices.cs index 302d3efb..acfc67a6 100644 --- a/CoreCms.Net.Services/User/CoreCmsUserTocashServices.cs +++ b/CoreCms.Net.Services/User/CoreCmsUserTocashServices.cs @@ -8,11 +8,6 @@ * Description: 暂无 ***********************************************************************/ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Linq.Expressions; -using System.Threading.Tasks; using CoreCms.Net.Caching.AccressToken; using CoreCms.Net.Configuration; using CoreCms.Net.IRepository; @@ -31,14 +26,27 @@ using Essensoft.Paylink.WeChatPay.V2; using Essensoft.Paylink.WeChatPay.V2.Request; using Essensoft.Paylink.WeChatPay.V3.Domain; using Essensoft.Paylink.WeChatPay.V3.Request; +using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Options; using Newtonsoft.Json; +using SKIT.FlurlHttpClient.Wechat.Api.Models; +using SKIT.FlurlHttpClient.Wechat.TenpayV3; +using SKIT.FlurlHttpClient.Wechat.TenpayV3.Models; +using SKIT.FlurlHttpClient.Wechat.TenpayV3.Settings; using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using System.Net.Http; +using System.Threading.Tasks; using Yitter.IdGenerator; -using Microsoft.AspNetCore.Hosting; +using NLog; + +using static SKIT.FlurlHttpClient.Wechat.Api.Models.ECFinderLiveGetFinderLiveNoticeRecordListResponse.Types; namespace CoreCms.Net.Services @@ -60,11 +68,12 @@ namespace CoreCms.Net.Services private readonly IWebHostEnvironment _webHostEnvironment; private readonly IWeChatPayConfigServices _weChatPayConfigServices; - + private readonly IWechatTenpayClientFactory _wechatTenpayClientFactory; + private readonly ICoreCmsUserTocashWeChatResponseServices _userTocashWeChatResponseServices; public CoreCmsUserTocashServices(IUnitOfWork unitOfWork, ICoreCmsUserTocashRepository dal, - IServiceProvider serviceProvider, ICoreCmsUserServices userServices, ICoreCmsUserBalanceServices userBalanceServices, ICoreCmsUserWeChatInfoServices weChatInfoServices, IWeChatPayClient v2Client, IHttpContextAccessor httpContextAccessor, IWebHostEnvironment webHostEnvironment, Essensoft.Paylink.WeChatPay.V3.IWeChatPayClient v3Client, IWeChatPayConfigServices weChatPayConfigServices) + IServiceProvider serviceProvider, ICoreCmsUserServices userServices, ICoreCmsUserBalanceServices userBalanceServices, ICoreCmsUserWeChatInfoServices weChatInfoServices, IWeChatPayClient v2Client, IHttpContextAccessor httpContextAccessor, IWebHostEnvironment webHostEnvironment, Essensoft.Paylink.WeChatPay.V3.IWeChatPayClient v3Client, IWeChatPayConfigServices weChatPayConfigServices, IWechatTenpayClientFactory wechatTenpayClientFactory, ICoreCmsUserTocashWeChatResponseServices userTocashWeChatResponseServices) { this._dal = dal; base.BaseDal = dal; @@ -78,6 +87,8 @@ namespace CoreCms.Net.Services _webHostEnvironment = webHostEnvironment; _v3Client = v3Client; _weChatPayConfigServices = weChatPayConfigServices; + _wechatTenpayClientFactory = wechatTenpayClientFactory; + _userTocashWeChatResponseServices = userTocashWeChatResponseServices; } /// @@ -162,6 +173,7 @@ namespace CoreCms.Net.Services cashModel.withdrawals = cateMoney; cashModel.createTime = DateTime.Now; cashModel.type = (int)GlobalEnumVars.UserTocashType.银行线下转账; + cashModel.needUserGet = false; var res = await _dal.InsertAsync(cashModel); if (res > 0) @@ -192,6 +204,9 @@ namespace CoreCms.Net.Services public async Task UserToCashList(int userId = 0, int page = 1, int limit = 10, int status = 0) { var jm = new WebApiCallBack(); + using var container = _serviceProvider.CreateScope(); + var weChatPayConfigServices = container.ServiceProvider.GetService(); + var where = PredicateBuilder.True(); if (status > 0) @@ -205,12 +220,27 @@ namespace CoreCms.Net.Services var list = await _dal.QueryPageAsync(where, p => p.createTime, OrderByType.Desc, page, limit); if (list.Any()) { + + //获取商家转账的初始数据 + var payConfig = await weChatPayConfigServices.QueryByClauseAsync(p => + p.isDefault == true && p.isEnable == true && + p.appType == nameof(GlobalEnumVars.WeiChatPayTradeType.JSAPI)); + foreach (var item in list) { item.statusName = EnumHelper.GetEnumDescriptionByValue(item.status); item.cardNumber = UserHelper.BankCardNoFormat(item.cardNumber); + if (item.type == (int)GlobalEnumVars.UserTocashType.商家转账 && item.needUserGet) + { + item.merchantTransferData = new + { + payConfig.appId, + payConfig.mchId + }; + } } } + jm.status = true; jm.data = list; jm.otherData = new @@ -508,6 +538,124 @@ namespace CoreCms.Net.Services break; } + case (int)GlobalEnumVars.UserTocashType.商家转账: + { + var user = await _userServices.QueryByIdAsync(info.userId); + if (user == null) + { + jm.msg = "用户信息获取失败"; + return jm; + } + var weChatUserInfo = await _weChatInfoServices.QueryByClauseAsync(p => p.userId == info.userId); + if (weChatUserInfo == null) + { + jm.msg = "微信用户数据获取失败"; + return jm; + } + + var config = await _weChatPayConfigServices.QueryByClauseAsync(p => p.isDefault == true && p.isEnable == true); + if (config == null) + { + jm.msg = "支付配置信息获取失败"; + return jm; + } + + var client = await _wechatTenpayClientFactory.Create(config.mchId); + + var request = new CreateFundAppMerchantTransferBillRequest(); + + request.WechatpaySerialNumber = config.payType switch + { + (int)GlobalEnumVars.WeChatPayIdentityVerificationMethods.PlatformCertificate => config + .platformSerialNumber, + (int)GlobalEnumVars.WeChatPayIdentityVerificationMethods.PlatformPublicKey => config + .platformPublicKeyId, + _ => request.WechatpaySerialNumber + }; + + request.AppId = config.appId; + request.OutBillNumber = "usertocash" + info.id; + request.TransferSceneId = "1000"; + request.OpenId = weChatUserInfo.openid; + + //按分计算 + request.TransferAmount = Convert.ToInt32(info.money * 100); + if (request.TransferAmount > 30) + { + request.UserName = info.accountName; + } + + request.TransferRemark = "客户推广业务佣金提现处理"; + request.NotifyUrl = config.transferBillsUrl; + request.TransferSceneReportInfoList = new List() + { + new CreateFundAppMerchantTransferBillRequest.Types.TransferSceneReportInfo() + { + InfoType = "活动名称", + InfoContent = "分销佣金提现", + }, + new CreateFundAppMerchantTransferBillRequest.Types.TransferSceneReportInfo() + { + InfoType = "奖励说明", + InfoContent = "用户分销佣金提现申请", + } + }; + + var response = await client.ExecuteCreateFundAppMerchantTransferBillAsync(request); + if (response.IsSuccessful()) + { + status = (int)GlobalEnumVars.UserTocashStatus.提现成功; + var message = JsonConvert.SerializeObject(new + { + response + }); + + bool needUserGet = response.State == "WAIT_USER_CONFIRM"; + + var bl = await _dal.UpdateAsync(p => new CoreCmsUserTocash() { status = status, updateTime = DateTime.Now, message = message, type = type, needUserGet = needUserGet }, p => p.id == id && (p.status == (int)GlobalEnumVars.UserTocashStatus.待审核 || p.status == (int)GlobalEnumVars.UserTocashStatus.提现异常)); + + NLogUtil.WriteAll(LogLevel.Trace, LogType.Refund, "微信提现商家转账回调(成功)", JsonConvert.SerializeObject(new + { + response, + request + })); + + var log = new CoreCmsUserTocashWeChatResponse(); + log.out_bill_no = response.OutBillNumber; + log.transfer_bill_no = response.TransferBillNumber; + log.state = response.State; + log.create_time = response.CreateTime.DateTime; + log.package_info = response.PackageInfo; + log.message = response.FailReason; + log.createTime = DateTime.Now; + await _userTocashWeChatResponseServices.InsertAsync(log); + + + jm.status = bl; + jm.data = status; + } + else + { + status = (int)GlobalEnumVars.UserTocashStatus.提现异常; + var message = JsonConvert.SerializeObject(new + { + response + }); + + var bl = await _dal.UpdateAsync(p => new CoreCmsUserTocash() { status = status, updateTime = DateTime.Now, message = message, type = type }, p => p.id == id && (p.status == (int)GlobalEnumVars.UserTocashStatus.待审核 || p.status == (int)GlobalEnumVars.UserTocashStatus.提现异常)); + + NLogUtil.WriteAll(LogLevel.Trace, LogType.Refund, "微信提现商家转账回调(失败)", JsonConvert.SerializeObject(new + { + response, + request + })); + + jm.status = bl; + jm.data = status; + } + + break; + } default: jm.msg = "提现方式获取失败"; jm.status = false; diff --git a/CoreCms.Net.Services/User/CoreCmsUserTocashWeChatNotifyServices.cs b/CoreCms.Net.Services/User/CoreCmsUserTocashWeChatNotifyServices.cs new file mode 100644 index 00000000..e3c4fbc5 --- /dev/null +++ b/CoreCms.Net.Services/User/CoreCmsUserTocashWeChatNotifyServices.cs @@ -0,0 +1,126 @@ +/*********************************************************************** + * Project: CoreCms + * ProjectName: 核心内容管理系统 + * Web: https://www.corecms.net + * Author: 大灰灰 + * Email: jianweie@163.com + * CreateTime: 2025/7/28 23:08:04 + * Description: 暂无 + ***********************************************************************/ + +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Threading.Tasks; +using CoreCms.Net.Configuration; +using CoreCms.Net.IRepository; +using CoreCms.Net.IRepository.UnitOfWork; +using CoreCms.Net.IServices; +using CoreCms.Net.Model.Entities; +using CoreCms.Net.Model.ViewModels.Basics; +using CoreCms.Net.Model.ViewModels.UI; +using SqlSugar; + +namespace CoreCms.Net.Services +{ + /// + /// 用户提现使用商家转账微信回调通知 接口实现 + /// + public class CoreCmsUserTocashWeChatNotifyServices : BaseServices, ICoreCmsUserTocashWeChatNotifyServices + { + private readonly ICoreCmsUserTocashWeChatNotifyRepository _dal; + private readonly IUnitOfWork _unitOfWork; + + public CoreCmsUserTocashWeChatNotifyServices(IUnitOfWork unitOfWork, ICoreCmsUserTocashWeChatNotifyRepository dal) + { + this._dal = dal; + base.BaseDal = dal; + _unitOfWork = unitOfWork; + } + + #region 实现重写增删改查操作========================================================== + + /// + /// 重写异步插入方法(返回序列) + /// + /// 实体数据 + /// + public async Task ExecuteReturnIdentityAsync(CoreCmsUserTocashWeChatNotify entity) + { + return await _dal.ExecuteReturnIdentityAsync(entity); + } + + /// + /// 重写异步插入方法 + /// + /// 实体数据 + /// + public async Task InsertAsync(CoreCmsUserTocashWeChatNotify entity) + { + return await _dal.InsertAsync(entity); + } + + /// + /// 重写异步更新方法方法 + /// + /// + /// + public async Task UpdateAsync(CoreCmsUserTocashWeChatNotify entity) + { + return await _dal.UpdateAsync(entity); + } + + /// + /// 重写异步更新方法方法 + /// + /// + /// + public async Task UpdateAsync(List entity) + { + return await _dal.UpdateAsync(entity); + } + + /// + /// 重写删除指定ID的数据 + /// + /// + /// + public async Task DeleteByIdAsync(object id) + { + return await _dal.DeleteByIdAsync(id); + } + + /// + /// 重写删除指定ID集合的数据(批量删除) + /// + /// + /// + public async Task DeleteByIdsAsync(int[] ids) + { + return await _dal.DeleteByIdsAsync(ids); + } + + #endregion 实现重写增删改查操作========================================================== + + #region 重写根据条件查询分页数据 + + /// + /// 重写根据条件查询分页数据 + /// + /// 判断集合 + /// 排序方式 + /// 当前页面索引 + /// 分布大小 + /// + /// 是否使用WITH(NOLOCK) + /// + public async Task> QueryPageAsync(Expression> predicate, + Expression> orderByExpression, OrderByType orderByType, int pageIndex = 1, + int pageSize = 20, bool blUseNoLock = false) + { + return await _dal.QueryPageAsync(predicate, orderByExpression, orderByType, pageIndex, pageSize, blUseNoLock); + } + + #endregion 重写根据条件查询分页数据 + } +} \ No newline at end of file diff --git a/CoreCms.Net.Services/User/CoreCmsUserTocashWeChatResponseServices.cs b/CoreCms.Net.Services/User/CoreCmsUserTocashWeChatResponseServices.cs new file mode 100644 index 00000000..2cf81afd --- /dev/null +++ b/CoreCms.Net.Services/User/CoreCmsUserTocashWeChatResponseServices.cs @@ -0,0 +1,116 @@ +/*********************************************************************** + * Project: CoreCms + * ProjectName: 核心内容管理系统 + * Web: https://www.corecms.net + * Author: 大灰灰 + * Email: jianweie@163.com + * CreateTime: 2025/7/23 16:37:18 + * Description: 暂无 + ***********************************************************************/ + +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Threading.Tasks; +using CoreCms.Net.Configuration; +using CoreCms.Net.IRepository; +using CoreCms.Net.IRepository.UnitOfWork; +using CoreCms.Net.IServices; +using CoreCms.Net.Model.Entities; +using CoreCms.Net.Model.ViewModels.Basics; +using CoreCms.Net.Model.ViewModels.UI; +using SqlSugar; + +namespace CoreCms.Net.Services +{ + /// + /// 用户提现使用商家转账回调记录 接口实现 + /// + public class CoreCmsUserTocashWeChatResponseServices : BaseServices, ICoreCmsUserTocashWeChatResponseServices + { + private readonly ICoreCmsUserTocashWeChatResponseRepository _dal; + private readonly IUnitOfWork _unitOfWork; + + public CoreCmsUserTocashWeChatResponseServices(IUnitOfWork unitOfWork, ICoreCmsUserTocashWeChatResponseRepository dal) + { + this._dal = dal; + base.BaseDal = dal; + _unitOfWork = unitOfWork; + } + + #region 实现重写增删改查操作========================================================== + + /// + /// 重写异步插入方法 + /// + /// 实体数据 + /// + public async Task InsertAsync(CoreCmsUserTocashWeChatResponse entity) + { + return await _dal.InsertAsync(entity); + } + + /// + /// 重写异步更新方法方法 + /// + /// + /// + public async Task UpdateAsync(CoreCmsUserTocashWeChatResponse entity) + { + return await _dal.UpdateAsync(entity); + } + + /// + /// 重写异步更新方法方法 + /// + /// + /// + public async Task UpdateAsync(List entity) + { + return await _dal.UpdateAsync(entity); + } + + /// + /// 重写删除指定ID的数据 + /// + /// + /// + public async Task DeleteByIdAsync(object id) + { + return await _dal.DeleteByIdAsync(id); + } + + /// + /// 重写删除指定ID集合的数据(批量删除) + /// + /// + /// + public async Task DeleteByIdsAsync(int[] ids) + { + return await _dal.DeleteByIdsAsync(ids); + } + + #endregion 实现重写增删改查操作========================================================== + + #region 重写根据条件查询分页数据 + + /// + /// 重写根据条件查询分页数据 + /// + /// 判断集合 + /// 排序方式 + /// 当前页面索引 + /// 分布大小 + /// + /// 是否使用WITH(NOLOCK) + /// + public async Task> QueryPageAsync(Expression> predicate, + Expression> orderByExpression, OrderByType orderByType, int pageIndex = 1, + int pageSize = 20, bool blUseNoLock = false) + { + return await _dal.QueryPageAsync(predicate, orderByExpression, orderByType, pageIndex, pageSize, blUseNoLock); + } + + #endregion 重写根据条件查询分页数据 + } +} \ No newline at end of file diff --git a/CoreCms.Net.Services/WechatTenpay/WechatTenpayClientFactory.cs b/CoreCms.Net.Services/WechatTenpay/WechatTenpayClientFactory.cs new file mode 100644 index 00000000..25992814 --- /dev/null +++ b/CoreCms.Net.Services/WechatTenpay/WechatTenpayClientFactory.cs @@ -0,0 +1,79 @@ +using System; +using System.Linq; +using System.Net.Http; +using System.Threading.Tasks; +using CoreCms.Net.Configuration; +using CoreCms.Net.IServices; +using Microsoft.Extensions.Options; +using SKIT.FlurlHttpClient.Wechat.TenpayV3; + +namespace CoreCms.Net.Services +{ + using SKIT.FlurlHttpClient.Wechat.TenpayV3.Settings; + + /// + /// 微信支付链接管理器实现 + /// + internal partial class WechatTenpayClientFactory : IWechatTenpayClientFactory + { + private readonly IHttpClientFactory _httpClientFactory; + private readonly IWeChatPayConfigServices _weChatPayConfigServices; + private readonly ICoreCmsWeChatPayPlatformCertificateServices _weChatPayPlatformCertificateServices; + + + public WechatTenpayClientFactory(IHttpClientFactory httpClientFactory, IWeChatPayConfigServices weChatPayConfigServices, ICoreCmsWeChatPayPlatformCertificateServices weChatPayPlatformCertificateServices) + { + _httpClientFactory = httpClientFactory; + _weChatPayConfigServices = weChatPayConfigServices; + _weChatPayPlatformCertificateServices = weChatPayPlatformCertificateServices; + } + + public async Task Create(string merchantId) + { + var tenpayMerchantOptions = await _weChatPayConfigServices.QueryByClauseAsync(p => p.mchId == merchantId && p.isDefault == true && p.isEnable == true); + + if (tenpayMerchantOptions == null) + { + throw new Exception("未在配置项中找到该 MerchantId 对应的微信商户号。"); + } + + var wechatTenpayClientOptions = new WechatTenpayClientOptions() + { + MerchantId = tenpayMerchantOptions.mchId, + MerchantV3Secret = tenpayMerchantOptions.apiV3Key, + MerchantCertificateSerialNumber = tenpayMerchantOptions.certificateSerialNumber, + MerchantCertificatePrivateKey = tenpayMerchantOptions.certificatePrivateKey, + AutoEncryptRequestSensitiveProperty = true, + AutoDecryptResponseSensitiveProperty = false, + }; + + // 基于平台证书的认证方式还需设置以下参数: + if (tenpayMerchantOptions.payType == (int)GlobalEnumVars.WeChatPayIdentityVerificationMethods.PlatformCertificate) + { + wechatTenpayClientOptions.PlatformAuthScheme = PlatformAuthScheme.Certificate; + + var certificate = await _weChatPayPlatformCertificateServices.QueryByClauseAsync(p => p.merchantId == tenpayMerchantOptions.mchId); + if (certificate != null) + { + var entity = new CertificateEntry(certificate.algorithmType, certificate.serialNumber, certificate.certificate, certificate.effectiveTime, certificate.expireTime); + + wechatTenpayClientOptions.PlatformCertificateManager.AddEntry(entity); + } + } + // 基于平台公钥的认证方式还需设置以下参数: + if (tenpayMerchantOptions.payType == (int)GlobalEnumVars.WeChatPayIdentityVerificationMethods.PlatformPublicKey) + { + wechatTenpayClientOptions.PlatformAuthScheme = PlatformAuthScheme.PublicKey; + wechatTenpayClientOptions.PlatformPublicKeyManager.AddEntry( + new PublicKeyEntry( + PublicKeyEntry.ALGORITHM_TYPE_RSA, + tenpayMerchantOptions.platformPublicKeyId!, + tenpayMerchantOptions.platformPublicKey!) + ); + } + + var wechatTenpayClient = WechatTenpayClientBuilder.Create(wechatTenpayClientOptions).Build(); + return wechatTenpayClient; + } + } +} diff --git a/CoreCms.Net.Task/AutoRefreshPlatformCertificateJob.cs b/CoreCms.Net.Task/AutoRefreshPlatformCertificateJob.cs new file mode 100644 index 00000000..b59113f7 --- /dev/null +++ b/CoreCms.Net.Task/AutoRefreshPlatformCertificateJob.cs @@ -0,0 +1,137 @@ +/*********************************************************************** + * Project: CoreCms.Net * + * Web: https://CoreCms.Net * + * ProjectName: 核心内容管理系统 * + * Author: 大灰灰 * + * Email: JianWeie@163.com * + * CreateTime: 2020-08-25 1:25:29 + * Description: 暂无 + ***********************************************************************/ + + +using CoreCms.Net.IServices; +using CoreCms.Net.Model.Entities; +using Newtonsoft.Json; +using System; +using SKIT.FlurlHttpClient.Wechat.TenpayV3; +using SKIT.FlurlHttpClient.Wechat.TenpayV3.Settings; +using SKIT.FlurlHttpClient.Wechat.TenpayV3.Models; + +namespace CoreCms.Net.Task +{ + /// + /// 定时更新微信支付平台证书 + /// + public class AutoRefreshPlatformCertificateJob + { + + private readonly IWeChatPayConfigServices _weChatPayConfigServices; + private readonly IWechatTenpayClientFactory _wechatTenpayClientFactory; + private readonly ICoreCmsWeChatPayPlatformCertificateServices _weChatPayPlatformCertificateServices; + private readonly ISysTaskLogServices _taskLogServices; + + /// + /// 构造函数 + /// + public AutoRefreshPlatformCertificateJob(IWeChatPayConfigServices weChatPayConfigServices, IWechatTenpayClientFactory wechatTenpayClientFactory, ICoreCmsWeChatPayPlatformCertificateServices weChatPayPlatformCertificateServices, ISysTaskLogServices taskLogServices) + { + _weChatPayConfigServices = weChatPayConfigServices; + _wechatTenpayClientFactory = wechatTenpayClientFactory; + _weChatPayPlatformCertificateServices = weChatPayPlatformCertificateServices; + _taskLogServices = taskLogServices; + } + + public async System.Threading.Tasks.Task Execute() + { + var config = await _weChatPayConfigServices.QueryListByClauseAsync(p => p.isDefault == true && p.isEnable == true); + if (config != null) + { + foreach (var item in config) + { + try + { + const string algorithmType = "RSA"; + var client = await _wechatTenpayClientFactory.Create(item.mchId); + var request = new QueryCertificatesRequest() { AlgorithmType = algorithmType }; + var response = await client.ExecuteQueryCertificatesAsync(request); + if (response.IsSuccessful()) + { + // NOTICE: + // 如果构造 Client 时启用了 `AutoDecryptResponseSensitiveProperty` 配置项,则无需再执行下面一行的手动解密方法: + response = client.DecryptResponseSensitiveProperty(response); + + foreach (var certificate in response.CertificateList) + { + var entity = CertificateEntry.Parse(algorithmType, certificate); + + // 将证书添加到平台证书管理器中 + var model = await _weChatPayPlatformCertificateServices.QueryByClauseAsync(p => + p.merchantId == item.mchId); + if (model != null) + { + model.algorithmType = entity.AlgorithmType; + model.serialNumber = entity.SerialNumber; + model.certificate = entity.Certificate; + model.effectiveTime = entity.EffectiveTime.DateTime; + model.expireTime = entity.ExpireTime.DateTime; + + model.updataTime = DateTime.Now; + await _weChatPayPlatformCertificateServices.UpdateAsync(model); + } + else + { + model = new CoreCmsWeChatPayPlatformCertificate(); + model.algorithmType = entity.AlgorithmType; + model.serialNumber = entity.SerialNumber; + model.certificate = entity.Certificate; + model.effectiveTime = entity.EffectiveTime.DateTime; + model.expireTime = entity.ExpireTime.DateTime; + model.merchantId = item.mchId; + model.createTime = DateTime.Now; + await _weChatPayPlatformCertificateServices.InsertAsync(model); + } + //client.PlatformCertificateManager.AddEntry(entity); + } + + //插入日志 + var log = new SysTaskLog + { + createTime = DateTime.Now, + isSuccess = true, + name = "刷新微信商户平台证书成功", + parameters = JsonConvert.SerializeObject(response) + }; + await _taskLogServices.InsertAsync(log); + + } + else + { + //插入日志 + var log = new SysTaskLog + { + createTime = DateTime.Now, + isSuccess = true, + name = "刷新微信商户平台证书失败", + parameters = $"刷新微信商户平台证书失败(状态码:{response.GetRawStatus()},错误代码:{response.ErrorCode},错误描述:{response.ErrorMessage})。", + }; + await _taskLogServices.InsertAsync(log); + } + } + catch (Exception ex) + { + + //插入日志 + var log = new SysTaskLog + { + createTime = DateTime.Now, + isSuccess = true, + name = "刷新微信商户平台证书遇到异常", + parameters = JsonConvert.SerializeObject(ex) + }; + await _taskLogServices.InsertAsync(log); + } + } + } + } + } +} diff --git a/CoreCms.Net.Task/HangfireDispose.cs b/CoreCms.Net.Task/HangfireDispose.cs index 40bdf536..25e0d929 100644 --- a/CoreCms.Net.Task/HangfireDispose.cs +++ b/CoreCms.Net.Task/HangfireDispose.cs @@ -70,6 +70,9 @@ namespace CoreCms.Net.Task //自动取消服务器订单任务 RecurringJob.AddOrUpdate("AutoCancelServiceOrderJob", s => s.Execute(), "0 0/5 * * * ? ", new RecurringJobOptions { TimeZone = TimeZoneInfo.Local }); // 每5分钟取消一次订单 + //定时更新微信支付平台证书 + RecurringJob.AddOrUpdate("AutoRefreshPlatformCertificateJob", s => s.Execute(), "0 0 6 * * ? ", new RecurringJobOptions { TimeZone = TimeZoneInfo.Local }); // 每天凌晨6点执行,首次可以自主进入定时任务页面手动执行一次 + } diff --git a/CoreCms.Net.Uni-App/CoreShop/core/enum/member.enum.ts b/CoreCms.Net.Uni-App/CoreShop/core/enum/member.enum.ts index e8a6d4fd..6877b30b 100644 --- a/CoreCms.Net.Uni-App/CoreShop/core/enum/member.enum.ts +++ b/CoreCms.Net.Uni-App/CoreShop/core/enum/member.enum.ts @@ -80,4 +80,17 @@ export enum ServiceCardStatusEnum { nullify = 2, /** 已核销 */ verified = 3, +} + +export enum UserTocashType { + /** 银行线下转账 */ + offlineBankTransfer = 0, + /** 企业付款到零钱 */ + enterprisePaymentToChange = 1, + /** 企业付款到银行卡 */ + enterprisePaymentTobankcard = 2, + /** 商家转账到零钱 */ + merchantsTransferMoneyToChange = 3, + /** 商家转账 */ + merchantTransfer = 4, } \ No newline at end of file diff --git a/CoreCms.Net.Uni-App/CoreShop/core/models/balance.ts b/CoreCms.Net.Uni-App/CoreShop/core/models/balance.ts index 45a0da60..81ca7aa1 100644 --- a/CoreCms.Net.Uni-App/CoreShop/core/models/balance.ts +++ b/CoreCms.Net.Uni-App/CoreShop/core/models/balance.ts @@ -47,4 +47,5 @@ export interface CashType { userId ?: number; userNickName ?: string; withdrawals ?: number; + needUserGet?:boolean; } \ No newline at end of file diff --git a/CoreCms.Net.Uni-App/CoreShop/pages/subpackage/member/balance/withdraw-detail/index.scss b/CoreCms.Net.Uni-App/CoreShop/pages/subpackage/member/balance/withdraw-detail/index.scss index bcf3af16..a897e5de 100644 --- a/CoreCms.Net.Uni-App/CoreShop/pages/subpackage/member/balance/withdraw-detail/index.scss +++ b/CoreCms.Net.Uni-App/CoreShop/pages/subpackage/member/balance/withdraw-detail/index.scss @@ -57,6 +57,13 @@ .date { margin-top: 10rpx; } + .btn{ + padding: 10rpx 20rpx; + font-size: 27rpx; + color: #fff; + background-color: #d33123; + border-radius: 10rpx; + } } } } diff --git a/CoreCms.Net.Uni-App/CoreShop/pages/subpackage/member/balance/withdraw-detail/index.vue b/CoreCms.Net.Uni-App/CoreShop/pages/subpackage/member/balance/withdraw-detail/index.vue index abc2b624..7d4fcb92 100644 --- a/CoreCms.Net.Uni-App/CoreShop/pages/subpackage/member/balance/withdraw-detail/index.vue +++ b/CoreCms.Net.Uni-App/CoreShop/pages/subpackage/member/balance/withdraw-detail/index.vue @@ -1,115 +1,174 @@ \ No newline at end of file diff --git a/CoreCms.Net.WeChat.Service/CoreCms.Net.WeChat.Service.csproj b/CoreCms.Net.WeChat.Service/CoreCms.Net.WeChat.Service.csproj index 3fae826b..214ba76f 100644 --- a/CoreCms.Net.WeChat.Service/CoreCms.Net.WeChat.Service.csproj +++ b/CoreCms.Net.WeChat.Service/CoreCms.Net.WeChat.Service.csproj @@ -10,6 +10,7 @@ + diff --git a/CoreCms.Net.Web.Admin/Controllers/Pay/CoreCmsWeChatPayConfigController.cs b/CoreCms.Net.Web.Admin/Controllers/Pay/CoreCmsWeChatPayConfigController.cs index a088b18e..b75c27c7 100644 --- a/CoreCms.Net.Web.Admin/Controllers/Pay/CoreCmsWeChatPayConfigController.cs +++ b/CoreCms.Net.Web.Admin/Controllers/Pay/CoreCmsWeChatPayConfigController.cs @@ -229,9 +229,11 @@ namespace CoreCms.Net.Web.Admin.Controllers var jm = new AdminUiCallBack { code = 0 }; var weiChatPayTradeType = EnumHelper.EnumToList(); + var weChatPayIdentityVerificationMethods = EnumHelper.EnumToList(); jm.data = new { - weiChatPayTradeType + weiChatPayTradeType, + weChatPayIdentityVerificationMethods }; return jm; @@ -252,9 +254,12 @@ namespace CoreCms.Net.Web.Admin.Controllers var jm = new AdminUiCallBack { code = 0 }; var weiChatPayTradeType = EnumHelper.EnumToList(); + var weChatPayIdentityVerificationMethods = EnumHelper.EnumToList(); + jm.data = new { - weiChatPayTradeType + weiChatPayTradeType, + weChatPayIdentityVerificationMethods }; return jm; @@ -299,10 +304,13 @@ namespace CoreCms.Net.Web.Admin.Controllers jm.code = 0; var weiChatPayTradeType = EnumHelper.EnumToList(); + var weChatPayIdentityVerificationMethods = EnumHelper.EnumToList(); + jm.data = new { model, - weiChatPayTradeType + weiChatPayTradeType, + weChatPayIdentityVerificationMethods }; return jm; diff --git a/CoreCms.Net.Web.Admin/Controllers/User/CoreCmsUserTocashController.cs b/CoreCms.Net.Web.Admin/Controllers/User/CoreCmsUserTocashController.cs index 275b8514..a02c5754 100644 --- a/CoreCms.Net.Web.Admin/Controllers/User/CoreCmsUserTocashController.cs +++ b/CoreCms.Net.Web.Admin/Controllers/User/CoreCmsUserTocashController.cs @@ -8,12 +8,6 @@ * Description: 暂无 ***********************************************************************/ -using System; -using System.ComponentModel; -using System.IO; -using System.Linq; -using System.Linq.Expressions; -using System.Threading.Tasks; using CoreCms.Net.Configuration; using CoreCms.Net.Filter; using CoreCms.Net.IServices; @@ -22,6 +16,7 @@ using CoreCms.Net.Model.Entities; using CoreCms.Net.Model.Entities.Expression; using CoreCms.Net.Model.FromBody; using CoreCms.Net.Model.ViewModels.UI; +using CoreCms.Net.Services; using CoreCms.Net.Utility.Extensions; using CoreCms.Net.Utility.Helper; using CoreCms.Net.Web.Admin.Infrastructure; @@ -30,6 +25,12 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc; using NPOI.HSSF.UserModel; using SqlSugar; +using System; +using System.ComponentModel; +using System.IO; +using System.Linq; +using System.Linq.Expressions; +using System.Threading.Tasks; namespace CoreCms.Net.Web.Admin.Controllers { @@ -60,10 +61,9 @@ namespace CoreCms.Net.Web.Admin.Controllers } #region 获取列表============================================================ - // POST: Api/CoreCmsUserTocash/GetPageList /// - /// 获取列表 + /// 获取列表 /// /// [HttpPost] @@ -76,52 +76,27 @@ namespace CoreCms.Net.Web.Admin.Controllers var where = PredicateBuilder.True(); //获取排序字段 var orderField = Request.Form["orderField"].FirstOrDefault(); - Expression> orderEx; - switch (orderField) + + Expression> orderEx = orderField switch { - case "id": - orderEx = p => p.id; - break; - case "userId": - orderEx = p => p.userId; - break; - case "money": - orderEx = p => p.money; - break; - case "bankName": - orderEx = p => p.bankName; - break; - case "bankCode": - orderEx = p => p.bankCode; - break; - case "bankAreaId": - orderEx = p => p.bankAreaId; - break; - case "accountBank": - orderEx = p => p.accountBank; - break; - case "accountName": - orderEx = p => p.accountName; - break; - case "cardNumber": - orderEx = p => p.cardNumber; - break; - case "withdrawals": - orderEx = p => p.withdrawals; - break; - case "status": - orderEx = p => p.status; - break; - case "createTime": - orderEx = p => p.createTime; - break; - case "updateTime": - orderEx = p => p.updateTime; - break; - default: - orderEx = p => p.id; - break; - } + "id" => p => p.id, + "userId" => p => p.userId, + "money" => p => p.money, + "bankName" => p => p.bankName, + "bankCode" => p => p.bankCode, + "bankAreaId" => p => p.bankAreaId, + "accountBank" => p => p.accountBank, + "accountName" => p => p.accountName, + "cardNumber" => p => p.cardNumber, + "withdrawals" => p => p.withdrawals, + "status" => p => p.status, + "createTime" => p => p.createTime, + "updateTime" => p => p.updateTime, + "type" => p => p.type, + "message" => p => p.message, + "needUserGet" => p => p.needUserGet, + _ => p => p.id + }; //设置排序方式 var orderDirection = Request.Form["orderDirection"].FirstOrDefault(); @@ -133,34 +108,72 @@ namespace CoreCms.Net.Web.Admin.Controllers }; //查询筛选 - //ID号 int + //id int var id = Request.Form["id"].FirstOrDefault().ObjectToInt(0); - if (id > 0) @where = @where.And(p => p.id == id); + if (id > 0) + { + where = where.And(p => p.id == id); + } //用户ID int var userId = Request.Form["userId"].FirstOrDefault().ObjectToInt(0); - if (userId > 0) @where = @where.And(p => p.userId == userId); - + if (userId > 0) + { + where = where.And(p => p.userId == userId); + } + //提现金额 decimal + var money = Request.Form["money"].FirstOrDefault().ObjectToDecimal(0); + if (money > 0) + { + where = where.And(p => p.money == money); + } //银行名称 nvarchar var bankName = Request.Form["bankName"].FirstOrDefault(); - if (!string.IsNullOrEmpty(bankName)) @where = @where.And(p => p.bankName.Contains(bankName)); + if (!string.IsNullOrEmpty(bankName)) + { + where = where.And(p => p.bankName.Contains(bankName)); + } //银行缩写 nvarchar var bankCode = Request.Form["bankCode"].FirstOrDefault(); - if (!string.IsNullOrEmpty(bankCode)) @where = @where.And(p => p.bankCode.Contains(bankCode)); + if (!string.IsNullOrEmpty(bankCode)) + { + where = where.And(p => p.bankCode.Contains(bankCode)); + } //账号地区ID int var bankAreaId = Request.Form["bankAreaId"].FirstOrDefault().ObjectToInt(0); - if (bankAreaId > 0) @where = @where.And(p => p.bankAreaId == bankAreaId); + if (bankAreaId > 0) + { + where = where.And(p => p.bankAreaId == bankAreaId); + } //开户行 nvarchar var accountBank = Request.Form["accountBank"].FirstOrDefault(); - if (!string.IsNullOrEmpty(accountBank)) @where = @where.And(p => p.accountBank.Contains(accountBank)); + if (!string.IsNullOrEmpty(accountBank)) + { + where = where.And(p => p.accountBank.Contains(accountBank)); + } //账户名 nvarchar var accountName = Request.Form["accountName"].FirstOrDefault(); - if (!string.IsNullOrEmpty(accountName)) @where = @where.And(p => p.accountName.Contains(accountName)); + if (!string.IsNullOrEmpty(accountName)) + { + where = where.And(p => p.accountName.Contains(accountName)); + } //卡号 nvarchar var cardNumber = Request.Form["cardNumber"].FirstOrDefault(); - if (!string.IsNullOrEmpty(cardNumber)) @where = @where.And(p => p.cardNumber.Contains(cardNumber)); + if (!string.IsNullOrEmpty(cardNumber)) + { + where = where.And(p => p.cardNumber.Contains(cardNumber)); + } + //提现服务费 decimal + var withdrawals = Request.Form["withdrawals"].FirstOrDefault().ObjectToDecimal(0); + if (withdrawals > 0) + { + where = where.And(p => p.withdrawals == withdrawals); + } //提现状态 int var status = Request.Form["status"].FirstOrDefault().ObjectToInt(0); - if (status > 0) @where = @where.And(p => p.status == status); + if (status > 0) + { + where = where.And(p => p.status == status); + } //创建时间 datetime var createTime = Request.Form["createTime"].FirstOrDefault(); if (!string.IsNullOrEmpty(createTime)) @@ -179,7 +192,6 @@ namespace CoreCms.Net.Web.Admin.Controllers where = where.And(p => p.createTime > dt); } } - //更新时间 datetime var updateTime = Request.Form["updateTime"].FirstOrDefault(); if (!string.IsNullOrEmpty(updateTime)) @@ -198,10 +210,28 @@ namespace CoreCms.Net.Web.Admin.Controllers where = where.And(p => p.updateTime > dt); } } - //提现状态 int + //提现方式 int var type = Request.Form["type"].FirstOrDefault().ObjectToInt(0); - if (type > 0) @where = @where.And(p => p.type == type); - + if (type > 0) + { + where = where.And(p => p.type == type); + } + //反馈结果 nvarchar + var message = Request.Form["message"].FirstOrDefault(); + if (!string.IsNullOrEmpty(message)) + { + where = where.And(p => p.message.Contains(message)); + } + //需要用户领取 bit + var needUserGet = Request.Form["needUserGet"].FirstOrDefault(); + if (!string.IsNullOrEmpty(needUserGet) && needUserGet.ToLowerInvariant() == "true") + { + where = where.And(p => p.needUserGet == true); + } + else if (!string.IsNullOrEmpty(needUserGet) && needUserGet.ToLowerInvariant() == "false") + { + where = where.And(p => p.needUserGet == false); + } //获取数据 var list = await _coreCmsUserTocashServices.QueryPageAsync(where, orderEx, orderBy, pageCurrent, pageSize, true); //返回数据 @@ -211,9 +241,9 @@ namespace CoreCms.Net.Web.Admin.Controllers jm.msg = "数据调用成功!"; return jm; } - #endregion + #region 首页数据============================================================ // POST: Api/CoreCmsUserTocash/GetIndex @@ -276,7 +306,6 @@ namespace CoreCms.Net.Web.Admin.Controllers } #endregion - #region 设置状态============================================================ // POST: Api/CoreCmsUser/DoSetisDelete/10 @@ -308,8 +337,6 @@ namespace CoreCms.Net.Web.Admin.Controllers #endregion - - #region 预览数据============================================================ // POST: Api/CoreCmsUserTocash/GetDetails/10 /// @@ -345,7 +372,6 @@ namespace CoreCms.Net.Web.Admin.Controllers } #endregion - #region 选择导出============================================================ // POST: Api/CoreCmsUserTocash/SelectExportExcel/10 diff --git a/CoreCms.Net.Web.Admin/CoreCms.Net.Web.Admin.xml b/CoreCms.Net.Web.Admin/CoreCms.Net.Web.Admin.xml index 76b0d2e5..54d74089 100644 --- a/CoreCms.Net.Web.Admin/CoreCms.Net.Web.Admin.xml +++ b/CoreCms.Net.Web.Admin/CoreCms.Net.Web.Admin.xml @@ -5657,7 +5657,7 @@ - 获取列表 + 获取列表 diff --git a/CoreCms.Net.Web.Admin/wwwroot/views/financial/usertocash/index.html b/CoreCms.Net.Web.Admin/wwwroot/views/financial/usertocash/index.html index 9bf975f2..06929535 100644 --- a/CoreCms.Net.Web.Admin/wwwroot/views/financial/usertocash/index.html +++ b/CoreCms.Net.Web.Admin/wwwroot/views/financial/usertocash/index.html @@ -69,6 +69,15 @@ +
+
+ +
+
@@ -185,6 +194,7 @@ }, { field: 'createTime', title: '创建时间', width: 130, sort: false }, { field: 'updateTime', title: '更新时间', width: 130, sort: false }, + { field: 'needUserGet', title: '等待用户领取', width: 95, templet: '#switch_needUserGet', sort: false, unresize: true }, { width: 120, align: 'center', title: '操作', fixed: 'right', toolbar: '#LAY-app-CoreCmsUserTocash-tableBox-bar' }, { field: 'message', title: '反馈信息', sort: false }, ] @@ -333,6 +343,28 @@ type: 'datetime', range: '到', }); + + + //监听 表格复选框操作 + + layui.form.on('switch(switch_needUserGet)', function (obj) { + coreHelper.Post("Api/CoreCmsUserTocash/DoSetneedUserGet", { id: this.value, data: obj.elem.checked }, function (e) { + if (debug) { console.log(e); } //开启调试返回数据 + //table.reloadData('LAY-app-CoreCmsUserTocash-tableBox'); + layer.msg(e.msg); + }); + }); + + + //重载form + form.render(); + }); }; - \ No newline at end of file + + + + + diff --git a/CoreCms.Net.Web.Admin/wwwroot/views/shop/pay/wechatpayconfig/create.html b/CoreCms.Net.Web.Admin/wwwroot/views/shop/pay/wechatpayconfig/create.html index 227fbb53..0325007c 100644 --- a/CoreCms.Net.Web.Admin/wwwroot/views/shop/pay/wechatpayconfig/create.html +++ b/CoreCms.Net.Web.Admin/wwwroot/views/shop/pay/wechatpayconfig/create.html @@ -1,128 +1,221 @@