mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 20:23:27 +08:00
Merge branch 'jianweie_dev_payconfig' into 'master'
Jianweie dev payconfig See merge request jianweie/coreshoppro!23
This commit is contained in:
@@ -121,26 +121,6 @@ namespace CoreCms.Net.Configuration
|
||||
public static readonly int MiddlewareConcurrencyLimiterRequestQueueLimit = AppSettingsHelper.GetContent("Middleware", "ConcurrencyLimiter", "RequestQueueLimit").ObjToInt(100);
|
||||
#endregion
|
||||
|
||||
#region 支付================================================================================
|
||||
|
||||
/// <summary>
|
||||
/// 微信支付回调
|
||||
/// </summary>
|
||||
public static readonly string PayCallBackWeChatPayUrl = AppSettingsHelper.GetContent("PayCallBack", "WeChatPayUrl");
|
||||
/// <summary>
|
||||
/// 微信退款回调
|
||||
/// </summary>
|
||||
public static readonly string PayCallBackWeChatRefundUrl = AppSettingsHelper.GetContent("PayCallBack", "WeChatRefundUrl");
|
||||
/// <summary>
|
||||
/// 支付宝支付回调
|
||||
/// </summary>
|
||||
public static readonly string PayCallBackAlipayUrl = AppSettingsHelper.GetContent("PayCallBack", "AlipayUrl");
|
||||
/// <summary>
|
||||
/// 支付宝退款回调
|
||||
/// </summary>
|
||||
public static readonly string PayCallBackAlipayRefundUrl = AppSettingsHelper.GetContent("PayCallBack", "AlipayRefundUrl");
|
||||
#endregion
|
||||
|
||||
#region HangFire定时任务================================================================================
|
||||
/// <summary>
|
||||
/// 登录账号
|
||||
|
||||
98
CoreCms.Net.IRepository/Pay/IAlipayConfigRepository.cs
Normal file
98
CoreCms.Net.IRepository/Pay/IAlipayConfigRepository.cs
Normal file
@@ -0,0 +1,98 @@
|
||||
/***********************************************************************
|
||||
* Project: CoreCms
|
||||
* ProjectName: 核心内容管理系统
|
||||
* Web: https://www.corecms.net
|
||||
* Author: 大灰灰
|
||||
* Email: jianweie@163.com
|
||||
* CreateTime: 2023/4/20 23:33:03
|
||||
* 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
|
||||
{
|
||||
/// <summary>
|
||||
/// 支付宝支付配置 工厂接口
|
||||
/// </summary>
|
||||
public interface IAlipayConfigRepository : IBaseRepository<CoreCmsAlipayConfig>
|
||||
{
|
||||
#region 重写增删改查操作===========================================================
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步插入方法
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
Task<AdminUiCallBack> InsertAsync(CoreCmsAlipayConfig entity);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步更新方法
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
Task<AdminUiCallBack> UpdateAsync(CoreCmsAlipayConfig entity);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步更新方法
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
Task<AdminUiCallBack> UpdateAsync(List<CoreCmsAlipayConfig> entity);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 重写删除指定ID的数据
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<AdminUiCallBack> DeleteByIdAsync(object id);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 重写删除指定ID集合的数据(批量删除)
|
||||
/// </summary>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
Task<AdminUiCallBack> DeleteByIdsAsync(int[] ids);
|
||||
|
||||
#endregion
|
||||
|
||||
#region 获取缓存的所有数据==========================================================
|
||||
|
||||
/// <summary>
|
||||
/// 获取缓存的所有数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<CoreCmsAlipayConfig>> GetCaChe();
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 重写根据条件查询分页数据
|
||||
/// </summary>
|
||||
/// <param name="predicate">判断集合</param>
|
||||
/// <param name="orderByType">排序方式</param>
|
||||
/// <param name="pageIndex">当前页面索引</param>
|
||||
/// <param name="pageSize">分布大小</param>
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
Task<IPageList<CoreCmsAlipayConfig>> QueryPageAsync(
|
||||
Expression<Func<CoreCmsAlipayConfig, bool>> predicate,
|
||||
Expression<Func<CoreCmsAlipayConfig, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false);
|
||||
|
||||
}
|
||||
}
|
||||
98
CoreCms.Net.IRepository/Pay/IWeChatPayConfigRepository.cs
Normal file
98
CoreCms.Net.IRepository/Pay/IWeChatPayConfigRepository.cs
Normal file
@@ -0,0 +1,98 @@
|
||||
/***********************************************************************
|
||||
* Project: CoreCms
|
||||
* ProjectName: 核心内容管理系统
|
||||
* Web: https://www.corecms.net
|
||||
* Author: 大灰灰
|
||||
* Email: jianweie@163.com
|
||||
* CreateTime: 2023/4/20 23:42:07
|
||||
* 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
|
||||
{
|
||||
/// <summary>
|
||||
/// 微信支付配置 工厂接口
|
||||
/// </summary>
|
||||
public interface IWeChatPayConfigRepository : IBaseRepository<CoreCmsWeChatPayConfig>
|
||||
{
|
||||
#region 重写增删改查操作===========================================================
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步插入方法
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
Task<AdminUiCallBack> InsertAsync(CoreCmsWeChatPayConfig entity);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步更新方法
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
Task<AdminUiCallBack> UpdateAsync(CoreCmsWeChatPayConfig entity);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步更新方法
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
Task<AdminUiCallBack> UpdateAsync(List<CoreCmsWeChatPayConfig> entity);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 重写删除指定ID的数据
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<AdminUiCallBack> DeleteByIdAsync(object id);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 重写删除指定ID集合的数据(批量删除)
|
||||
/// </summary>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
Task<AdminUiCallBack> DeleteByIdsAsync(int[] ids);
|
||||
|
||||
#endregion
|
||||
|
||||
#region 获取缓存的所有数据==========================================================
|
||||
|
||||
/// <summary>
|
||||
/// 获取缓存的所有数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<CoreCmsWeChatPayConfig>> GetCaChe();
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 重写根据条件查询分页数据
|
||||
/// </summary>
|
||||
/// <param name="predicate">判断集合</param>
|
||||
/// <param name="orderByType">排序方式</param>
|
||||
/// <param name="pageIndex">当前页面索引</param>
|
||||
/// <param name="pageSize">分布大小</param>
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
Task<IPageList<CoreCmsWeChatPayConfig>> QueryPageAsync(
|
||||
Expression<Func<CoreCmsWeChatPayConfig, bool>> predicate,
|
||||
Expression<Func<CoreCmsWeChatPayConfig, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false);
|
||||
|
||||
}
|
||||
}
|
||||
94
CoreCms.Net.IServices/Pay/IAlipayConfigServices.cs
Normal file
94
CoreCms.Net.IServices/Pay/IAlipayConfigServices.cs
Normal file
@@ -0,0 +1,94 @@
|
||||
/***********************************************************************
|
||||
* Project: CoreCms
|
||||
* ProjectName: 核心内容管理系统
|
||||
* Web: https://www.corecms.net
|
||||
* Author: 大灰灰
|
||||
* Email: jianweie@163.com
|
||||
* CreateTime: 2023/4/20 23:33:03
|
||||
* 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
|
||||
{
|
||||
/// <summary>
|
||||
/// 支付宝支付配置 服务工厂接口
|
||||
/// </summary>
|
||||
public interface IAlipayConfigServices : IBaseServices<CoreCmsAlipayConfig>
|
||||
{
|
||||
#region 重写增删改查操作===========================================================
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步插入方法
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
Task<AdminUiCallBack> InsertAsync(CoreCmsAlipayConfig entity);
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步更新方法
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
Task<AdminUiCallBack> UpdateAsync(CoreCmsAlipayConfig entity);
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步更新方法
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
Task<AdminUiCallBack> UpdateAsync(List<CoreCmsAlipayConfig> entity);
|
||||
|
||||
/// <summary>
|
||||
/// 重写删除指定ID的数据
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<AdminUiCallBack> DeleteByIdAsync(object id);
|
||||
|
||||
/// <summary>
|
||||
/// 重写删除指定ID集合的数据(批量删除)
|
||||
/// </summary>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
Task<AdminUiCallBack> DeleteByIdsAsync(int[] ids);
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 获取缓存的所有数据==========================================================
|
||||
|
||||
/// <summary>
|
||||
/// 获取缓存的所有数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<CoreCmsAlipayConfig>> GetCaChe();
|
||||
|
||||
#endregion
|
||||
|
||||
#region 重写根据条件查询分页数据
|
||||
/// <summary>
|
||||
/// 重写根据条件查询分页数据
|
||||
/// </summary>
|
||||
/// <param name="predicate">判断集合</param>
|
||||
/// <param name="orderByType">排序方式</param>
|
||||
/// <param name="pageIndex">当前页面索引</param>
|
||||
/// <param name="pageSize">分布大小</param>
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
Task<IPageList<CoreCmsAlipayConfig>> QueryPageAsync(
|
||||
Expression<Func<CoreCmsAlipayConfig, bool>> predicate,
|
||||
Expression<Func<CoreCmsAlipayConfig, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false);
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
94
CoreCms.Net.IServices/Pay/IWeChatPayConfigServices.cs
Normal file
94
CoreCms.Net.IServices/Pay/IWeChatPayConfigServices.cs
Normal file
@@ -0,0 +1,94 @@
|
||||
/***********************************************************************
|
||||
* Project: CoreCms
|
||||
* ProjectName: 核心内容管理系统
|
||||
* Web: https://www.corecms.net
|
||||
* Author: 大灰灰
|
||||
* Email: jianweie@163.com
|
||||
* CreateTime: 2023/4/20 23:42:07
|
||||
* 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
|
||||
{
|
||||
/// <summary>
|
||||
/// 微信支付配置 服务工厂接口
|
||||
/// </summary>
|
||||
public interface IWeChatPayConfigServices : IBaseServices<CoreCmsWeChatPayConfig>
|
||||
{
|
||||
#region 重写增删改查操作===========================================================
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步插入方法
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
Task<AdminUiCallBack> InsertAsync(CoreCmsWeChatPayConfig entity);
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步更新方法
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
Task<AdminUiCallBack> UpdateAsync(CoreCmsWeChatPayConfig entity);
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步更新方法
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
Task<AdminUiCallBack> UpdateAsync(List<CoreCmsWeChatPayConfig> entity);
|
||||
|
||||
/// <summary>
|
||||
/// 重写删除指定ID的数据
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<AdminUiCallBack> DeleteByIdAsync(object id);
|
||||
|
||||
/// <summary>
|
||||
/// 重写删除指定ID集合的数据(批量删除)
|
||||
/// </summary>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
Task<AdminUiCallBack> DeleteByIdsAsync(int[] ids);
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 获取缓存的所有数据==========================================================
|
||||
|
||||
/// <summary>
|
||||
/// 获取缓存的所有数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<CoreCmsWeChatPayConfig>> GetCaChe();
|
||||
|
||||
#endregion
|
||||
|
||||
#region 重写根据条件查询分页数据
|
||||
/// <summary>
|
||||
/// 重写根据条件查询分页数据
|
||||
/// </summary>
|
||||
/// <param name="predicate">判断集合</param>
|
||||
/// <param name="orderByType">排序方式</param>
|
||||
/// <param name="pageIndex">当前页面索引</param>
|
||||
/// <param name="pageSize">分布大小</param>
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
Task<IPageList<CoreCmsWeChatPayConfig>> QueryPageAsync(
|
||||
Expression<Func<CoreCmsWeChatPayConfig, bool>> predicate,
|
||||
Expression<Func<CoreCmsWeChatPayConfig, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false);
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -4666,6 +4666,176 @@
|
||||
类型说明
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:CoreCms.Net.Model.Entities.CoreCmsAlipayConfig">
|
||||
<summary>
|
||||
支付宝支付配置
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Model.Entities.CoreCmsAlipayConfig.#ctor">
|
||||
<summary>
|
||||
构造函数
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.Entities.CoreCmsAlipayConfig.id">
|
||||
<summary>
|
||||
序列
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.Entities.CoreCmsAlipayConfig.appId">
|
||||
<summary>
|
||||
支付宝开放平台AppId
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.Entities.CoreCmsAlipayConfig.publicKey">
|
||||
<summary>
|
||||
支付宝公钥
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.Entities.CoreCmsAlipayConfig.privateKey">
|
||||
<summary>
|
||||
应用私钥
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.Entities.CoreCmsAlipayConfig.serverUrl">
|
||||
<summary>
|
||||
服务网关地址
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.Entities.CoreCmsAlipayConfig.signType">
|
||||
<summary>
|
||||
签名类型
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.Entities.CoreCmsAlipayConfig.appPublicCert">
|
||||
<summary>
|
||||
应用公钥证书
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.Entities.CoreCmsAlipayConfig.alipayPublicCert">
|
||||
<summary>
|
||||
支付宝公钥证书
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.Entities.CoreCmsAlipayConfig.alipayRootCert">
|
||||
<summary>
|
||||
支付宝根证书
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.Entities.CoreCmsAlipayConfig.appType">
|
||||
<summary>
|
||||
应用类型
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.Entities.CoreCmsAlipayConfig.notifyUrl">
|
||||
<summary>
|
||||
支付宝支付回调通知
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.Entities.CoreCmsAlipayConfig.refundUrl">
|
||||
<summary>
|
||||
支付宝退款回调
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.Entities.CoreCmsAlipayConfig.jumpUrl">
|
||||
<summary>
|
||||
支付跳转地址
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.Entities.CoreCmsAlipayConfig.isEnable">
|
||||
<summary>
|
||||
是否启用
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.Entities.CoreCmsAlipayConfig.isDefault">
|
||||
<summary>
|
||||
当前多端默认
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:CoreCms.Net.Model.Entities.CoreCmsWeChatPayConfig">
|
||||
<summary>
|
||||
微信支付配置
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Model.Entities.CoreCmsWeChatPayConfig.#ctor">
|
||||
<summary>
|
||||
构造函数
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.Entities.CoreCmsWeChatPayConfig.id">
|
||||
<summary>
|
||||
序列
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.Entities.CoreCmsWeChatPayConfig.appId">
|
||||
<summary>
|
||||
应用号
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.Entities.CoreCmsWeChatPayConfig.mchId">
|
||||
<summary>
|
||||
商户号
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.Entities.CoreCmsWeChatPayConfig.apiKey">
|
||||
<summary>
|
||||
API秘钥
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.Entities.CoreCmsWeChatPayConfig.apiV3Key">
|
||||
<summary>
|
||||
APIv3密钥
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.Entities.CoreCmsWeChatPayConfig.certificate">
|
||||
<summary>
|
||||
p12证书base64
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.Entities.CoreCmsWeChatPayConfig.rsaPublicKey">
|
||||
<summary>
|
||||
RSA公钥
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.Entities.CoreCmsWeChatPayConfig.subAppId">
|
||||
<summary>
|
||||
子商户应用号
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.Entities.CoreCmsWeChatPayConfig.subMchId">
|
||||
<summary>
|
||||
子商户号
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.Entities.CoreCmsWeChatPayConfig.notifyUrl">
|
||||
<summary>
|
||||
支付回调通知
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.Entities.CoreCmsWeChatPayConfig.refundUrl">
|
||||
<summary>
|
||||
退款回调
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.Entities.CoreCmsWeChatPayConfig.jumpUrl">
|
||||
<summary>
|
||||
跳转地址
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.Entities.CoreCmsWeChatPayConfig.isEnable">
|
||||
<summary>
|
||||
是否开启
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.Entities.CoreCmsWeChatPayConfig.isDefault">
|
||||
<summary>
|
||||
是否本类默认
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.Entities.CoreCmsWeChatPayConfig.appType">
|
||||
<summary>
|
||||
应用类型
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:CoreCms.Net.Model.Entities.CoreCmsPinTuanGoods">
|
||||
<summary>
|
||||
拼团商品表
|
||||
|
||||
212
CoreCms.Net.Model/Entities/Pay/CoreCmsAlipayConfig.cs
Normal file
212
CoreCms.Net.Model/Entities/Pay/CoreCmsAlipayConfig.cs
Normal file
@@ -0,0 +1,212 @@
|
||||
/***********************************************************************
|
||||
* Project: CoreCms
|
||||
* ProjectName: 核心内容管理系统
|
||||
* Web: https://www.corecms.net
|
||||
* Author: 大灰灰
|
||||
* Email: jianweie@163.com
|
||||
* CreateTime: 2023/4/20 23:33:03
|
||||
* Description: 暂无
|
||||
***********************************************************************/
|
||||
|
||||
using SqlSugar;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace CoreCms.Net.Model.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// 支付宝支付配置
|
||||
/// </summary>
|
||||
public partial class CoreCmsAlipayConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
public CoreCmsAlipayConfig()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 序列
|
||||
/// </summary>
|
||||
[Display(Name = "序列")]
|
||||
|
||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
||||
|
||||
[Required(ErrorMessage = "请输入{0}")]
|
||||
|
||||
|
||||
|
||||
public System.Int32 id { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 支付宝开放平台AppId
|
||||
/// </summary>
|
||||
[Display(Name = "支付宝开放平台AppId")]
|
||||
|
||||
[Required(ErrorMessage = "请输入{0}")]
|
||||
|
||||
[StringLength(maximumLength:50,ErrorMessage = "{0}不能超过{1}字")]
|
||||
|
||||
public System.String appId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 支付宝公钥
|
||||
/// </summary>
|
||||
[Display(Name = "支付宝公钥")]
|
||||
|
||||
[Required(ErrorMessage = "请输入{0}")]
|
||||
|
||||
[StringLength(maximumLength:500,ErrorMessage = "{0}不能超过{1}字")]
|
||||
|
||||
public System.String publicKey { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 应用私钥
|
||||
/// </summary>
|
||||
[Display(Name = "应用私钥")]
|
||||
|
||||
[Required(ErrorMessage = "请输入{0}")]
|
||||
|
||||
[StringLength(maximumLength:2000,ErrorMessage = "{0}不能超过{1}字")]
|
||||
|
||||
public System.String privateKey { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 服务网关地址
|
||||
/// </summary>
|
||||
[Display(Name = "服务网关地址")]
|
||||
|
||||
|
||||
|
||||
[StringLength(maximumLength:100,ErrorMessage = "{0}不能超过{1}字")]
|
||||
|
||||
public System.String serverUrl { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 签名类型
|
||||
/// </summary>
|
||||
[Display(Name = "签名类型")]
|
||||
|
||||
|
||||
|
||||
[StringLength(maximumLength:10,ErrorMessage = "{0}不能超过{1}字")]
|
||||
|
||||
public System.String signType { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 应用公钥证书
|
||||
/// </summary>
|
||||
[Display(Name = "应用公钥证书")]
|
||||
|
||||
|
||||
|
||||
[StringLength(maximumLength:5000,ErrorMessage = "{0}不能超过{1}字")]
|
||||
|
||||
public System.String appPublicCert { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 支付宝公钥证书
|
||||
/// </summary>
|
||||
[Display(Name = "支付宝公钥证书")]
|
||||
|
||||
|
||||
|
||||
[StringLength(maximumLength:5000,ErrorMessage = "{0}不能超过{1}字")]
|
||||
|
||||
public System.String alipayPublicCert { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 支付宝根证书
|
||||
/// </summary>
|
||||
[Display(Name = "支付宝根证书")]
|
||||
|
||||
|
||||
|
||||
[StringLength(maximumLength:5000,ErrorMessage = "{0}不能超过{1}字")]
|
||||
|
||||
public System.String alipayRootCert { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 应用类型
|
||||
/// </summary>
|
||||
[Display(Name = "应用类型")]
|
||||
|
||||
[Required(ErrorMessage = "请输入{0}")]
|
||||
|
||||
[StringLength(maximumLength:10,ErrorMessage = "{0}不能超过{1}字")]
|
||||
|
||||
public System.String appType { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 支付宝支付回调通知
|
||||
/// </summary>
|
||||
[Display(Name = "支付宝支付回调通知")]
|
||||
|
||||
|
||||
|
||||
[StringLength(maximumLength:500,ErrorMessage = "{0}不能超过{1}字")]
|
||||
|
||||
public System.String notifyUrl { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 支付宝退款回调
|
||||
/// </summary>
|
||||
[Display(Name = "支付宝退款回调")]
|
||||
|
||||
|
||||
|
||||
[StringLength(maximumLength:500,ErrorMessage = "{0}不能超过{1}字")]
|
||||
|
||||
public System.String refundUrl { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 支付跳转地址
|
||||
/// </summary>
|
||||
[Display(Name = "支付跳转地址")]
|
||||
|
||||
|
||||
|
||||
[StringLength(maximumLength:500,ErrorMessage = "{0}不能超过{1}字")]
|
||||
|
||||
public System.String jumpUrl { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 是否启用
|
||||
/// </summary>
|
||||
[Display(Name = "是否启用")]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public System.Boolean isEnable { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 当前多端默认
|
||||
/// </summary>
|
||||
[Display(Name = "当前多端默认")]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public System.Boolean isDefault { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
212
CoreCms.Net.Model/Entities/Pay/CoreCmsWeChatPayConfig.cs
Normal file
212
CoreCms.Net.Model/Entities/Pay/CoreCmsWeChatPayConfig.cs
Normal file
@@ -0,0 +1,212 @@
|
||||
/***********************************************************************
|
||||
* Project: CoreCms
|
||||
* ProjectName: 核心内容管理系统
|
||||
* Web: https://www.corecms.net
|
||||
* Author: 大灰灰
|
||||
* Email: jianweie@163.com
|
||||
* CreateTime: 2023/4/22 23:40:15
|
||||
* Description: 暂无
|
||||
***********************************************************************/
|
||||
|
||||
using SqlSugar;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace CoreCms.Net.Model.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// 微信支付配置
|
||||
/// </summary>
|
||||
public partial class CoreCmsWeChatPayConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
public CoreCmsWeChatPayConfig()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 序列
|
||||
/// </summary>
|
||||
[Display(Name = "序列")]
|
||||
|
||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
||||
|
||||
[Required(ErrorMessage = "请输入{0}")]
|
||||
|
||||
|
||||
|
||||
public System.Int32 id { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 应用号
|
||||
/// </summary>
|
||||
[Display(Name = "应用号")]
|
||||
|
||||
[Required(ErrorMessage = "请输入{0}")]
|
||||
|
||||
[StringLength(maximumLength:50,ErrorMessage = "{0}不能超过{1}字")]
|
||||
|
||||
public System.String appId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 商户号
|
||||
/// </summary>
|
||||
[Display(Name = "商户号")]
|
||||
|
||||
[Required(ErrorMessage = "请输入{0}")]
|
||||
|
||||
[StringLength(maximumLength:50,ErrorMessage = "{0}不能超过{1}字")]
|
||||
|
||||
public System.String mchId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// API秘钥
|
||||
/// </summary>
|
||||
[Display(Name = "API秘钥")]
|
||||
|
||||
|
||||
|
||||
[StringLength(maximumLength:50,ErrorMessage = "{0}不能超过{1}字")]
|
||||
|
||||
public System.String apiKey { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// APIv3密钥
|
||||
/// </summary>
|
||||
[Display(Name = "APIv3密钥")]
|
||||
|
||||
|
||||
|
||||
[StringLength(maximumLength:50,ErrorMessage = "{0}不能超过{1}字")]
|
||||
|
||||
public System.String apiV3Key { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// p12证书base64
|
||||
/// </summary>
|
||||
[Display(Name = "p12证书base64")]
|
||||
|
||||
|
||||
|
||||
[StringLength(maximumLength:8000,ErrorMessage = "{0}不能超过{1}字")]
|
||||
|
||||
public System.String certificate { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// RSA公钥
|
||||
/// </summary>
|
||||
[Display(Name = "RSA公钥")]
|
||||
|
||||
|
||||
|
||||
[StringLength(maximumLength:1000,ErrorMessage = "{0}不能超过{1}字")]
|
||||
|
||||
public System.String rsaPublicKey { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 子商户应用号
|
||||
/// </summary>
|
||||
[Display(Name = "子商户应用号")]
|
||||
|
||||
|
||||
|
||||
[StringLength(maximumLength:50,ErrorMessage = "{0}不能超过{1}字")]
|
||||
|
||||
public System.String subAppId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 子商户号
|
||||
/// </summary>
|
||||
[Display(Name = "子商户号")]
|
||||
|
||||
|
||||
|
||||
[StringLength(maximumLength:50,ErrorMessage = "{0}不能超过{1}字")]
|
||||
|
||||
public System.String subMchId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 支付回调通知
|
||||
/// </summary>
|
||||
[Display(Name = "支付回调通知")]
|
||||
|
||||
|
||||
|
||||
[StringLength(maximumLength:200,ErrorMessage = "{0}不能超过{1}字")]
|
||||
|
||||
public System.String notifyUrl { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 退款回调
|
||||
/// </summary>
|
||||
[Display(Name = "退款回调")]
|
||||
|
||||
|
||||
|
||||
[StringLength(maximumLength:200,ErrorMessage = "{0}不能超过{1}字")]
|
||||
|
||||
public System.String refundUrl { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 跳转地址
|
||||
/// </summary>
|
||||
[Display(Name = "跳转地址")]
|
||||
|
||||
|
||||
|
||||
[StringLength(maximumLength:200,ErrorMessage = "{0}不能超过{1}字")]
|
||||
|
||||
public System.String jumpUrl { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 是否开启
|
||||
/// </summary>
|
||||
[Display(Name = "是否开启")]
|
||||
|
||||
[Required(ErrorMessage = "请输入{0}")]
|
||||
|
||||
|
||||
|
||||
public System.Boolean isEnable { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 是否本类默认
|
||||
/// </summary>
|
||||
[Display(Name = "是否本类默认")]
|
||||
|
||||
[Required(ErrorMessage = "请输入{0}")]
|
||||
|
||||
|
||||
|
||||
public System.Boolean isDefault { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 应用类型
|
||||
/// </summary>
|
||||
[Display(Name = "应用类型")]
|
||||
|
||||
|
||||
|
||||
[StringLength(maximumLength:50,ErrorMessage = "{0}不能超过{1}字")]
|
||||
|
||||
public System.String appType { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
232
CoreCms.Net.Repository/Pay/AlipayConfigRepository.cs
Normal file
232
CoreCms.Net.Repository/Pay/AlipayConfigRepository.cs
Normal file
@@ -0,0 +1,232 @@
|
||||
/***********************************************************************
|
||||
* Project: CoreCms
|
||||
* ProjectName: 核心内容管理系统
|
||||
* Web: https://www.corecms.net
|
||||
* Author: 大灰灰
|
||||
* Email: jianweie@163.com
|
||||
* CreateTime: 2023/4/20 23:33:03
|
||||
* 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
|
||||
{
|
||||
/// <summary>
|
||||
/// 支付宝支付配置 接口实现
|
||||
/// </summary>
|
||||
public class AlipayConfigRepository : BaseRepository<CoreCmsAlipayConfig>, IAlipayConfigRepository
|
||||
{
|
||||
private readonly IUnitOfWork _unitOfWork;
|
||||
public AlipayConfigRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
|
||||
{
|
||||
_unitOfWork = unitOfWork;
|
||||
}
|
||||
|
||||
#region 实现重写增删改查操作==========================================================
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步插入方法
|
||||
/// </summary>
|
||||
/// <param name="entity">实体数据</param>
|
||||
/// <returns></returns>
|
||||
public async Task<AdminUiCallBack> InsertAsync(CoreCmsAlipayConfig 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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步更新方法
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<AdminUiCallBack> UpdateAsync(CoreCmsAlipayConfig entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var oldModel = await DbClient.Queryable<CoreCmsAlipayConfig>().In(entity.id).SingleAsync();
|
||||
if (oldModel == null)
|
||||
{
|
||||
jm.msg = "不存在此信息";
|
||||
return jm;
|
||||
}
|
||||
//事物处理过程开始
|
||||
oldModel.id = entity.id;
|
||||
oldModel.appId = entity.appId;
|
||||
oldModel.publicKey = entity.publicKey;
|
||||
oldModel.privateKey = entity.privateKey;
|
||||
oldModel.serverUrl = entity.serverUrl;
|
||||
oldModel.signType = entity.signType;
|
||||
oldModel.appPublicCert = entity.appPublicCert;
|
||||
oldModel.alipayPublicCert = entity.alipayPublicCert;
|
||||
oldModel.alipayRootCert = entity.alipayRootCert;
|
||||
oldModel.appType = entity.appType;
|
||||
oldModel.notifyUrl = entity.notifyUrl;
|
||||
oldModel.refundUrl = entity.refundUrl;
|
||||
oldModel.jumpUrl = entity.jumpUrl;
|
||||
oldModel.isEnable = entity.isEnable;
|
||||
oldModel.isDefault = entity.isDefault;
|
||||
|
||||
//事物处理过程结束
|
||||
var bl = await DbClient.Updateable(oldModel).ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步更新方法
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<AdminUiCallBack> UpdateAsync(List<CoreCmsAlipayConfig> 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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写删除指定ID的数据
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<AdminUiCallBack> DeleteByIdAsync(object id)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Deleteable<CoreCmsAlipayConfig>(id).ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写删除指定ID集合的数据(批量删除)
|
||||
/// </summary>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<AdminUiCallBack> DeleteByIdsAsync(int[] ids)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Deleteable<CoreCmsAlipayConfig>().In(ids).ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 获取缓存的所有数据==========================================================
|
||||
|
||||
/// <summary>
|
||||
/// 获取缓存的所有数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<List<CoreCmsAlipayConfig>> GetCaChe()
|
||||
{
|
||||
var list = await DbClient.Queryable<CoreCmsAlipayConfig>().With(SqlWith.NoLock).WithCache().ToListAsync();
|
||||
return list;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 重写根据条件查询分页数据
|
||||
/// <summary>
|
||||
/// 重写根据条件查询分页数据
|
||||
/// </summary>
|
||||
/// <param name="predicate">判断集合</param>
|
||||
/// <param name="orderByType">排序方式</param>
|
||||
/// <param name="pageIndex">当前页面索引</param>
|
||||
/// <param name="pageSize">分布大小</param>
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public async Task<IPageList<CoreCmsAlipayConfig>> QueryPageAsync(Expression<Func<CoreCmsAlipayConfig, bool>> predicate,
|
||||
Expression<Func<CoreCmsAlipayConfig, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false)
|
||||
{
|
||||
RefAsync<int> totalCount = 0;
|
||||
List<CoreCmsAlipayConfig> page;
|
||||
if (blUseNoLock)
|
||||
{
|
||||
page = await DbClient.Queryable<CoreCmsAlipayConfig>()
|
||||
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
|
||||
.WhereIF(predicate != null, predicate).Select(p => new CoreCmsAlipayConfig
|
||||
{
|
||||
id = p.id,
|
||||
appId = p.appId,
|
||||
publicKey = p.publicKey,
|
||||
privateKey = p.privateKey,
|
||||
serverUrl = p.serverUrl,
|
||||
signType = p.signType,
|
||||
appPublicCert = p.appPublicCert,
|
||||
alipayPublicCert = p.alipayPublicCert,
|
||||
alipayRootCert = p.alipayRootCert,
|
||||
appType = p.appType,
|
||||
notifyUrl = p.notifyUrl,
|
||||
refundUrl = p.refundUrl,
|
||||
jumpUrl = p.jumpUrl,
|
||||
isEnable = p.isEnable,
|
||||
isDefault = p.isDefault,
|
||||
|
||||
}).With(SqlWith.NoLock).ToPageListAsync(pageIndex, pageSize, totalCount);
|
||||
}
|
||||
else
|
||||
{
|
||||
page = await DbClient.Queryable<CoreCmsAlipayConfig>()
|
||||
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
|
||||
.WhereIF(predicate != null, predicate).Select(p => new CoreCmsAlipayConfig
|
||||
{
|
||||
id = p.id,
|
||||
appId = p.appId,
|
||||
publicKey = p.publicKey,
|
||||
privateKey = p.privateKey,
|
||||
serverUrl = p.serverUrl,
|
||||
signType = p.signType,
|
||||
appPublicCert = p.appPublicCert,
|
||||
alipayPublicCert = p.alipayPublicCert,
|
||||
alipayRootCert = p.alipayRootCert,
|
||||
appType = p.appType,
|
||||
notifyUrl = p.notifyUrl,
|
||||
refundUrl = p.refundUrl,
|
||||
jumpUrl = p.jumpUrl,
|
||||
isEnable = p.isEnable,
|
||||
isDefault = p.isDefault,
|
||||
|
||||
}).ToPageListAsync(pageIndex, pageSize, totalCount);
|
||||
}
|
||||
var list = new PageList<CoreCmsAlipayConfig>(page, pageIndex, pageSize, totalCount);
|
||||
return list;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
232
CoreCms.Net.Repository/Pay/WeChatPayConfigRepository.cs
Normal file
232
CoreCms.Net.Repository/Pay/WeChatPayConfigRepository.cs
Normal file
@@ -0,0 +1,232 @@
|
||||
/***********************************************************************
|
||||
* Project: CoreCms
|
||||
* ProjectName: 核心内容管理系统
|
||||
* Web: https://www.corecms.net
|
||||
* Author: 大灰灰
|
||||
* Email: jianweie@163.com
|
||||
* CreateTime: 2023/4/22 23:40:15
|
||||
* 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
|
||||
{
|
||||
/// <summary>
|
||||
/// 微信支付配置 接口实现
|
||||
/// </summary>
|
||||
public class WeChatPayConfigRepository : BaseRepository<CoreCmsWeChatPayConfig>, IWeChatPayConfigRepository
|
||||
{
|
||||
private readonly IUnitOfWork _unitOfWork;
|
||||
public WeChatPayConfigRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
|
||||
{
|
||||
_unitOfWork = unitOfWork;
|
||||
}
|
||||
|
||||
#region 实现重写增删改查操作==========================================================
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步插入方法
|
||||
/// </summary>
|
||||
/// <param name="entity">实体数据</param>
|
||||
/// <returns></returns>
|
||||
public async Task<AdminUiCallBack> InsertAsync(CoreCmsWeChatPayConfig 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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步更新方法
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<AdminUiCallBack> UpdateAsync(CoreCmsWeChatPayConfig entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var oldModel = await DbClient.Queryable<CoreCmsWeChatPayConfig>().In(entity.id).SingleAsync();
|
||||
if (oldModel == null)
|
||||
{
|
||||
jm.msg = "不存在此信息";
|
||||
return jm;
|
||||
}
|
||||
//事物处理过程开始
|
||||
oldModel.id = entity.id;
|
||||
oldModel.appId = entity.appId;
|
||||
oldModel.mchId = entity.mchId;
|
||||
oldModel.apiKey = entity.apiKey;
|
||||
oldModel.apiV3Key = entity.apiV3Key;
|
||||
oldModel.certificate = entity.certificate;
|
||||
oldModel.rsaPublicKey = entity.rsaPublicKey;
|
||||
oldModel.subAppId = entity.subAppId;
|
||||
oldModel.subMchId = entity.subMchId;
|
||||
oldModel.notifyUrl = entity.notifyUrl;
|
||||
oldModel.refundUrl = entity.refundUrl;
|
||||
oldModel.jumpUrl = entity.jumpUrl;
|
||||
oldModel.isEnable = entity.isEnable;
|
||||
oldModel.isDefault = entity.isDefault;
|
||||
oldModel.appType = entity.appType;
|
||||
|
||||
//事物处理过程结束
|
||||
var bl = await DbClient.Updateable(oldModel).ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步更新方法
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<AdminUiCallBack> UpdateAsync(List<CoreCmsWeChatPayConfig> 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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写删除指定ID的数据
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<AdminUiCallBack> DeleteByIdAsync(object id)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Deleteable<CoreCmsWeChatPayConfig>(id).ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写删除指定ID集合的数据(批量删除)
|
||||
/// </summary>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<AdminUiCallBack> DeleteByIdsAsync(int[] ids)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Deleteable<CoreCmsWeChatPayConfig>().In(ids).ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 获取缓存的所有数据==========================================================
|
||||
|
||||
/// <summary>
|
||||
/// 获取缓存的所有数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<List<CoreCmsWeChatPayConfig>> GetCaChe()
|
||||
{
|
||||
var list = await DbClient.Queryable<CoreCmsWeChatPayConfig>().With(SqlWith.NoLock).WithCache().ToListAsync();
|
||||
return list;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 重写根据条件查询分页数据
|
||||
/// <summary>
|
||||
/// 重写根据条件查询分页数据
|
||||
/// </summary>
|
||||
/// <param name="predicate">判断集合</param>
|
||||
/// <param name="orderByType">排序方式</param>
|
||||
/// <param name="pageIndex">当前页面索引</param>
|
||||
/// <param name="pageSize">分布大小</param>
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public async Task<IPageList<CoreCmsWeChatPayConfig>> QueryPageAsync(Expression<Func<CoreCmsWeChatPayConfig, bool>> predicate,
|
||||
Expression<Func<CoreCmsWeChatPayConfig, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false)
|
||||
{
|
||||
RefAsync<int> totalCount = 0;
|
||||
List<CoreCmsWeChatPayConfig> page;
|
||||
if (blUseNoLock)
|
||||
{
|
||||
page = await DbClient.Queryable<CoreCmsWeChatPayConfig>()
|
||||
.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,
|
||||
|
||||
}).With(SqlWith.NoLock).ToPageListAsync(pageIndex, pageSize, totalCount);
|
||||
}
|
||||
else
|
||||
{
|
||||
page = await DbClient.Queryable<CoreCmsWeChatPayConfig>()
|
||||
.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,
|
||||
|
||||
}).ToPageListAsync(pageIndex, pageSize, totalCount);
|
||||
}
|
||||
var list = new PageList<CoreCmsWeChatPayConfig>(page, pageIndex, pageSize, totalCount);
|
||||
return list;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,7 @@ using NLog;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using CoreCms.Net.Utility.Extensions;
|
||||
using CoreCms.Net.Utility.Helper;
|
||||
using Essensoft.Paylink.Alipay;
|
||||
using Essensoft.Paylink.Alipay.Domain;
|
||||
using Essensoft.Paylink.Alipay.Request;
|
||||
@@ -37,14 +38,15 @@ namespace CoreCms.Net.Services
|
||||
{
|
||||
private readonly IAlipayClient _client;
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
private readonly IOptions<AlipayOptions> _optionsAccessor;
|
||||
private readonly IAlipayConfigServices _alipayConfigServices;
|
||||
|
||||
|
||||
public AliPayServices(IWeChatPayRepository dal, IServiceProvider serviceProvider, IAlipayClient client, IOptions<AlipayOptions> optionsAccessor)
|
||||
|
||||
public AliPayServices(IWeChatPayRepository dal, IServiceProvider serviceProvider, IAlipayClient client, IAlipayConfigServices alipayConfigServices)
|
||||
{
|
||||
_serviceProvider = serviceProvider;
|
||||
_client = client;
|
||||
_optionsAccessor = optionsAccessor;
|
||||
_alipayConfigServices = alipayConfigServices;
|
||||
BaseDal = dal;
|
||||
}
|
||||
|
||||
@@ -58,24 +60,49 @@ namespace CoreCms.Net.Services
|
||||
var jm = new WebApiCallBack();
|
||||
using var container = _serviceProvider.CreateScope();
|
||||
var billPaymentsServices = container.ServiceProvider.GetService<ICoreCmsBillPaymentsServices>();
|
||||
var payment = await billPaymentsServices.QueryByClauseAsync(p => p.paymentId == entity.paymentId);
|
||||
var allPayUrl = AppSettingsConstVars.PayCallBackAlipayUrl;
|
||||
var allPayReturnUrl = AppSettingsConstVars.PayCallBackAlipayRefundUrl;
|
||||
if (string.IsNullOrEmpty(allPayUrl))
|
||||
{
|
||||
jm.msg = "未获取到配置的回调地址";
|
||||
return jm;
|
||||
}
|
||||
|
||||
//var payment = await billPaymentsServices.QueryByClauseAsync(p => p.paymentId == entity.paymentId);
|
||||
|
||||
var tradeType = GlobalEnumVars.AliPayPayTradeType.ScanQRCodes.ToString();
|
||||
if (!string.IsNullOrEmpty(entity.parameters))
|
||||
{
|
||||
var jobj = (JObject)JsonConvert.DeserializeObject(entity.parameters);
|
||||
if (jobj != null && jobj.ContainsKey("trade_type"))
|
||||
tradeType = GetTradeType(jobj["trade_type"].ObjectToString());
|
||||
var jObj = (JObject)JsonConvert.DeserializeObject(entity.parameters);
|
||||
if (jObj != null && jObj.TryGetValue("trade_type", out var value))
|
||||
tradeType = PayHelper.GetAliPayPayTradeType(value.ObjectToString());
|
||||
}
|
||||
|
||||
|
||||
|
||||
var config = await _alipayConfigServices.QueryByClauseAsync(p =>
|
||||
p.isDefault == true && p.isEnable == true && p.appType == tradeType);
|
||||
if (config == null)
|
||||
{
|
||||
jm.msg = "支付配置信息获取失败";
|
||||
return jm;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(config.notifyUrl))
|
||||
{
|
||||
jm.msg = "未获取到配置的通知地址";
|
||||
return jm;
|
||||
}
|
||||
|
||||
var notifyUrl = config.notifyUrl.EndsWith("/") ? config.notifyUrl + "m-" + config.appId : config.notifyUrl + "/m-" + config.appId;
|
||||
|
||||
|
||||
//构建linkPay请求配置实体
|
||||
var payOptions = new AlipayOptions
|
||||
{
|
||||
AppId = config.appId,
|
||||
AlipayPublicKey = config.publicKey,
|
||||
AppPrivateKey = config.privateKey,
|
||||
ServerUrl = config.serverUrl,
|
||||
SignType = config.signType,
|
||||
AppPublicCert = config.appPublicCert,
|
||||
AlipayPublicCert = config.alipayPublicCert,
|
||||
AlipayRootCert = config.alipayRootCert
|
||||
};
|
||||
|
||||
|
||||
//扫码支付
|
||||
if (tradeType == GlobalEnumVars.AliPayPayTradeType.ScanQRCodes.ToString())
|
||||
{
|
||||
@@ -89,11 +116,11 @@ namespace CoreCms.Net.Services
|
||||
};
|
||||
var req = new AlipayTradePrecreateRequest();
|
||||
req.SetBizModel(model);
|
||||
req.SetNotifyUrl(allPayUrl);
|
||||
req.SetReturnUrl(allPayReturnUrl);
|
||||
req.SetNotifyUrl(notifyUrl);
|
||||
//req.SetReturnUrl("https://pc.pro.demo.corecms.cn/order/payment/result");
|
||||
|
||||
Loging.NLogUtil.WriteAll(LogLevel.Trace, Loging.LogType.Order, "支付宝ScanQRCodes支付拼接APP入参", JsonConvert.SerializeObject(model));
|
||||
var response = await _client.ExecuteAsync(req, _optionsAccessor.Value);
|
||||
var response = await _client.ExecuteAsync(req, payOptions);
|
||||
Loging.NLogUtil.WriteAll(LogLevel.Trace, Loging.LogType.Order, "支付宝ScanQRCodes支付返回数据", JsonConvert.SerializeObject(response));
|
||||
|
||||
|
||||
@@ -110,18 +137,17 @@ namespace CoreCms.Net.Services
|
||||
{
|
||||
OutTradeNo = entity.paymentId,
|
||||
Subject = entity.payTitle.Length > 40 ? entity.payTitle[..40] : entity.payTitle,
|
||||
//ProductCode = "FAST_INSTANT_TRADE_PAY",
|
||||
ProductCode = "FAST_INSTANT_TRADE_PAY",
|
||||
TotalAmount = entity.money.ToString(CultureInfo.InvariantCulture),
|
||||
Body = entity.payTitle.Length > 40 ? entity.payTitle[..40] : entity.payTitle
|
||||
};
|
||||
var req = new AlipayTradePagePayRequest();
|
||||
req.SetBizModel(model);
|
||||
req.SetNotifyUrl(allPayUrl);
|
||||
req.SetReturnUrl(allPayReturnUrl);
|
||||
|
||||
req.SetNotifyUrl(notifyUrl);
|
||||
req.SetReturnUrl(config.jumpUrl);
|
||||
|
||||
Loging.NLogUtil.WriteAll(LogLevel.Trace, Loging.LogType.Order, "支付宝JSAPI_PC支付拼接APP入参", JsonConvert.SerializeObject(model));
|
||||
var response = await _client.PageExecuteAsync(req, _optionsAccessor.Value);
|
||||
var response = await _client.PageExecuteAsync(req, payOptions);
|
||||
Loging.NLogUtil.WriteAll(LogLevel.Trace, Loging.LogType.Order, "支付宝JSAPI_PC支付返回数据", JsonConvert.SerializeObject(response));
|
||||
|
||||
|
||||
@@ -144,12 +170,11 @@ namespace CoreCms.Net.Services
|
||||
};
|
||||
var req = new AlipayTradeAppPayRequest();
|
||||
req.SetBizModel(model);
|
||||
req.SetNotifyUrl(allPayUrl);
|
||||
req.SetReturnUrl(allPayReturnUrl);
|
||||
|
||||
req.SetNotifyUrl(notifyUrl);
|
||||
//req.SetReturnUrl(config.jumpUrl);
|
||||
|
||||
Loging.NLogUtil.WriteAll(LogLevel.Trace, Loging.LogType.Order, "支付宝APP支付拼接APP入参", JsonConvert.SerializeObject(model));
|
||||
var response = await _client.SdkExecuteAsync(req, _optionsAccessor.Value);
|
||||
var response = await _client.SdkExecuteAsync(req, payOptions);
|
||||
Loging.NLogUtil.WriteAll(LogLevel.Trace, Loging.LogType.Order, "支付宝APP支付返回数据", JsonConvert.SerializeObject(response));
|
||||
|
||||
|
||||
@@ -166,18 +191,18 @@ namespace CoreCms.Net.Services
|
||||
{
|
||||
OutTradeNo = entity.paymentId,
|
||||
Subject = entity.payTitle.Length > 40 ? entity.payTitle[..40] : entity.payTitle,
|
||||
ProductCode = entity.paymentCode,
|
||||
//ProductCode = entity.paymentCode,
|
||||
ProductCode = "QUICK_WAP_PAY",
|
||||
TotalAmount = entity.money.ToString(CultureInfo.InvariantCulture),
|
||||
Body = entity.payTitle.Length > 40 ? entity.payTitle[..40] : entity.payTitle
|
||||
};
|
||||
var req = new AlipayTradeWapPayRequest();
|
||||
req.SetBizModel(model);
|
||||
req.SetNotifyUrl(allPayUrl);
|
||||
req.SetReturnUrl(allPayReturnUrl);
|
||||
|
||||
req.SetNotifyUrl(notifyUrl);
|
||||
req.SetReturnUrl(config.jumpUrl);
|
||||
|
||||
Loging.NLogUtil.WriteAll(LogLevel.Trace, Loging.LogType.Order, "支付宝MWEB支付拼接APP入参", JsonConvert.SerializeObject(model));
|
||||
var response = await _client.PageExecuteAsync(req, _optionsAccessor.Value);
|
||||
var response = await _client.PageExecuteAsync(req, payOptions);
|
||||
Loging.NLogUtil.WriteAll(LogLevel.Trace, Loging.LogType.Order, "支付宝MWEB支付返回数据", JsonConvert.SerializeObject(response));
|
||||
|
||||
|
||||
@@ -193,25 +218,6 @@ namespace CoreCms.Net.Services
|
||||
}
|
||||
|
||||
|
||||
private static string GetTradeType(string tradeType)
|
||||
{
|
||||
if (tradeType != GlobalEnumVars.AliPayPayTradeType.JSAPI.ToString() &&
|
||||
tradeType != GlobalEnumVars.AliPayPayTradeType.JSAPI_PC.ToString() &&
|
||||
tradeType != GlobalEnumVars.AliPayPayTradeType.ScanQRCodes.ToString() &&
|
||||
tradeType != GlobalEnumVars.AliPayPayTradeType.APP.ToString() &&
|
||||
tradeType != GlobalEnumVars.AliPayPayTradeType.MWEB.ToString()
|
||||
)
|
||||
{
|
||||
return GlobalEnumVars.AliPayPayTradeType.JSAPI_PC.ToString();
|
||||
}
|
||||
|
||||
//if (tradeType == GlobalEnumVars.AliPayPayTradeType.JSAPI_PC.ToString())
|
||||
//{
|
||||
// return GlobalEnumVars.AliPayPayTradeType.JSAPI_PC.ToString();
|
||||
//}
|
||||
return tradeType;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
129
CoreCms.Net.Services/Pay/AlipayConfigServices.cs
Normal file
129
CoreCms.Net.Services/Pay/AlipayConfigServices.cs
Normal file
@@ -0,0 +1,129 @@
|
||||
/***********************************************************************
|
||||
* Project: CoreCms
|
||||
* ProjectName: 核心内容管理系统
|
||||
* Web: https://www.corecms.net
|
||||
* Author: 大灰灰
|
||||
* Email: jianweie@163.com
|
||||
* CreateTime: 2023/4/20 23:33:03
|
||||
* 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
|
||||
{
|
||||
/// <summary>
|
||||
/// 支付宝支付配置 接口实现
|
||||
/// </summary>
|
||||
public class AlipayConfigServices : BaseServices<CoreCmsAlipayConfig>, IAlipayConfigServices
|
||||
{
|
||||
private readonly IAlipayConfigRepository _dal;
|
||||
private readonly IUnitOfWork _unitOfWork;
|
||||
|
||||
public AlipayConfigServices(IUnitOfWork unitOfWork, IAlipayConfigRepository dal)
|
||||
{
|
||||
this._dal = dal;
|
||||
base.BaseDal = dal;
|
||||
_unitOfWork = unitOfWork;
|
||||
}
|
||||
|
||||
#region 实现重写增删改查操作==========================================================
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步插入方法
|
||||
/// </summary>
|
||||
/// <param name="entity">实体数据</param>
|
||||
/// <returns></returns>
|
||||
public async Task<AdminUiCallBack> InsertAsync(CoreCmsAlipayConfig entity)
|
||||
{
|
||||
return await _dal.InsertAsync(entity);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步更新方法方法
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<AdminUiCallBack> UpdateAsync(CoreCmsAlipayConfig entity)
|
||||
{
|
||||
return await _dal.UpdateAsync(entity);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步更新方法方法
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<AdminUiCallBack> UpdateAsync(List<CoreCmsAlipayConfig> entity)
|
||||
{
|
||||
return await _dal.UpdateAsync(entity);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写删除指定ID的数据
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<AdminUiCallBack> DeleteByIdAsync(object id)
|
||||
{
|
||||
return await _dal.DeleteByIdAsync(id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写删除指定ID集合的数据(批量删除)
|
||||
/// </summary>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<AdminUiCallBack> DeleteByIdsAsync(int[] ids)
|
||||
{
|
||||
return await _dal.DeleteByIdsAsync(ids);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 获取缓存的所有数据==========================================================
|
||||
|
||||
/// <summary>
|
||||
/// 获取缓存的所有数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<List<CoreCmsAlipayConfig>> GetCaChe()
|
||||
{
|
||||
return await _dal.GetCaChe();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 重写根据条件查询分页数据
|
||||
/// <summary>
|
||||
/// 重写根据条件查询分页数据
|
||||
/// </summary>
|
||||
/// <param name="predicate">判断集合</param>
|
||||
/// <param name="orderByType">排序方式</param>
|
||||
/// <param name="pageIndex">当前页面索引</param>
|
||||
/// <param name="pageSize">分布大小</param>
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public async Task<IPageList<CoreCmsAlipayConfig>> QueryPageAsync(Expression<Func<CoreCmsAlipayConfig, bool>> predicate,
|
||||
Expression<Func<CoreCmsAlipayConfig, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false)
|
||||
{
|
||||
return await _dal.QueryPageAsync(predicate, orderByExpression, orderByType, pageIndex, pageSize, blUseNoLock);
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
129
CoreCms.Net.Services/Pay/WeChatPayConfigServices.cs
Normal file
129
CoreCms.Net.Services/Pay/WeChatPayConfigServices.cs
Normal file
@@ -0,0 +1,129 @@
|
||||
/***********************************************************************
|
||||
* Project: CoreCms
|
||||
* ProjectName: 核心内容管理系统
|
||||
* Web: https://www.corecms.net
|
||||
* Author: 大灰灰
|
||||
* Email: jianweie@163.com
|
||||
* CreateTime: 2023/4/20 23:42:07
|
||||
* 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
|
||||
{
|
||||
/// <summary>
|
||||
/// 微信支付配置 接口实现
|
||||
/// </summary>
|
||||
public class WeChatPayConfigServices : BaseServices<CoreCmsWeChatPayConfig>, IWeChatPayConfigServices
|
||||
{
|
||||
private readonly IWeChatPayConfigRepository _dal;
|
||||
private readonly IUnitOfWork _unitOfWork;
|
||||
|
||||
public WeChatPayConfigServices(IUnitOfWork unitOfWork, IWeChatPayConfigRepository dal)
|
||||
{
|
||||
this._dal = dal;
|
||||
base.BaseDal = dal;
|
||||
_unitOfWork = unitOfWork;
|
||||
}
|
||||
|
||||
#region 实现重写增删改查操作==========================================================
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步插入方法
|
||||
/// </summary>
|
||||
/// <param name="entity">实体数据</param>
|
||||
/// <returns></returns>
|
||||
public async Task<AdminUiCallBack> InsertAsync(CoreCmsWeChatPayConfig entity)
|
||||
{
|
||||
return await _dal.InsertAsync(entity);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步更新方法方法
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<AdminUiCallBack> UpdateAsync(CoreCmsWeChatPayConfig entity)
|
||||
{
|
||||
return await _dal.UpdateAsync(entity);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步更新方法方法
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<AdminUiCallBack> UpdateAsync(List<CoreCmsWeChatPayConfig> entity)
|
||||
{
|
||||
return await _dal.UpdateAsync(entity);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写删除指定ID的数据
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<AdminUiCallBack> DeleteByIdAsync(object id)
|
||||
{
|
||||
return await _dal.DeleteByIdAsync(id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写删除指定ID集合的数据(批量删除)
|
||||
/// </summary>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<AdminUiCallBack> DeleteByIdsAsync(int[] ids)
|
||||
{
|
||||
return await _dal.DeleteByIdsAsync(ids);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 获取缓存的所有数据==========================================================
|
||||
|
||||
/// <summary>
|
||||
/// 获取缓存的所有数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<List<CoreCmsWeChatPayConfig>> GetCaChe()
|
||||
{
|
||||
return await _dal.GetCaChe();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 重写根据条件查询分页数据
|
||||
/// <summary>
|
||||
/// 重写根据条件查询分页数据
|
||||
/// </summary>
|
||||
/// <param name="predicate">判断集合</param>
|
||||
/// <param name="orderByType">排序方式</param>
|
||||
/// <param name="pageIndex">当前页面索引</param>
|
||||
/// <param name="pageSize">分布大小</param>
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public async Task<IPageList<CoreCmsWeChatPayConfig>> QueryPageAsync(Expression<Func<CoreCmsWeChatPayConfig, bool>> predicate,
|
||||
Expression<Func<CoreCmsWeChatPayConfig, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false)
|
||||
{
|
||||
return await _dal.QueryPageAsync(predicate, orderByExpression, orderByType, pageIndex, pageSize, blUseNoLock);
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,6 @@
|
||||
***********************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using CoreCms.Net.Auth.HttpContextUser;
|
||||
using CoreCms.Net.Caching.AccressToken;
|
||||
@@ -19,13 +18,12 @@ using CoreCms.Net.Loging;
|
||||
using CoreCms.Net.Model.Entities;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using CoreCms.Net.Utility.Extensions;
|
||||
using CoreCms.Net.Utility.Helper;
|
||||
using CoreCms.Net.WeChat.Service.HttpClients;
|
||||
using Essensoft.Paylink.Alipay.Domain;
|
||||
using Essensoft.Paylink.WeChatPay;
|
||||
using Essensoft.Paylink.WeChatPay.V2;
|
||||
using Essensoft.Paylink.WeChatPay.V2.Request;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using QRCoder;
|
||||
@@ -40,12 +38,11 @@ namespace CoreCms.Net.Services
|
||||
public class WeChatPayServices : BaseServices<CoreCmsSetting>, IWeChatPayServices
|
||||
{
|
||||
private readonly IWeChatPayClient _client;
|
||||
private readonly IOptions<WeChatPayOptions> _optionsAccessor;
|
||||
private readonly IHttpContextUser _user;
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
private readonly WeChat.Service.HttpClients.IWeChatApiHttpClientFactory _weChatApiHttpClientFactory;
|
||||
|
||||
private readonly IWeChatApiHttpClientFactory _weChatApiHttpClientFactory;
|
||||
|
||||
private readonly IWeChatPayConfigServices _weChatPayConfigServices;
|
||||
|
||||
private readonly ICoreCmsUserServices _userServices;
|
||||
private readonly ICoreCmsUserWeChatInfoServices _userWeChatInfoServices;
|
||||
@@ -53,18 +50,17 @@ namespace CoreCms.Net.Services
|
||||
|
||||
public WeChatPayServices(IHttpContextUser user
|
||||
, IWeChatPayClient client
|
||||
, IOptions<WeChatPayOptions> optionsAccessor
|
||||
, ICoreCmsUserServices userServices
|
||||
, ICoreCmsUserWeChatInfoServices userWeChatInfoServices, IServiceProvider serviceProvider, IWeChatApiHttpClientFactory weChatApiHttpClientFactory)
|
||||
, ICoreCmsUserWeChatInfoServices userWeChatInfoServices, IServiceProvider serviceProvider, IWeChatApiHttpClientFactory weChatApiHttpClientFactory, IWeChatPayConfigServices weChatPayConfigServices)
|
||||
{
|
||||
|
||||
_client = client;
|
||||
_optionsAccessor = optionsAccessor;
|
||||
_user = user;
|
||||
_userServices = userServices;
|
||||
_userWeChatInfoServices = userWeChatInfoServices;
|
||||
_serviceProvider = serviceProvider;
|
||||
_weChatApiHttpClientFactory = weChatApiHttpClientFactory;
|
||||
_weChatPayConfigServices = weChatPayConfigServices;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -92,12 +88,13 @@ namespace CoreCms.Net.Services
|
||||
var accessToken = WeChatCacheAccessTokenHelper.GetWxOpenAccessToken();
|
||||
var client = _weChatApiHttpClientFactory.CreateWxOpenClient();
|
||||
|
||||
var getPaymentParameters = new ShopOrderGetPaymentParametersRequest();
|
||||
|
||||
getPaymentParameters.AccessToken = accessToken;
|
||||
getPaymentParameters.OpenId = order.openid;
|
||||
getPaymentParameters.OrderId = order.orderId;
|
||||
getPaymentParameters.OutOrderId = order.outOrderId;
|
||||
var getPaymentParameters = new ShopOrderGetPaymentParametersRequest
|
||||
{
|
||||
AccessToken = accessToken,
|
||||
OpenId = order.openid,
|
||||
OrderId = order.orderId,
|
||||
OutOrderId = order.outOrderId
|
||||
};
|
||||
|
||||
var shopOrderGetPayment = await client.ExecuteShopOrderGetPaymentParametersAsync(getPaymentParameters);
|
||||
if (shopOrderGetPayment.IsSuccessful())
|
||||
@@ -121,20 +118,42 @@ namespace CoreCms.Net.Services
|
||||
}
|
||||
else
|
||||
{
|
||||
var weChatPayUrl = AppSettingsConstVars.PayCallBackWeChatPayUrl;
|
||||
if (string.IsNullOrEmpty(weChatPayUrl))
|
||||
|
||||
var tradeType = GlobalEnumVars.WeiChatPayTradeType.JSAPI.ToString();
|
||||
if (!string.IsNullOrEmpty(entity.parameters))
|
||||
{
|
||||
var jObj = (JObject)JsonConvert.DeserializeObject(entity.parameters);
|
||||
if (jObj != null && jObj.TryGetValue("trade_type", out var value))
|
||||
tradeType = PayHelper.GetWeiChatPayTradeType(value.ObjectToString());
|
||||
}
|
||||
|
||||
|
||||
var config = await _weChatPayConfigServices.QueryByClauseAsync(p =>
|
||||
p.isDefault == true && p.isEnable == true && p.appType == tradeType);
|
||||
if (config == null)
|
||||
{
|
||||
jm.msg = "支付配置信息获取失败";
|
||||
return jm;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(config.notifyUrl))
|
||||
{
|
||||
jm.msg = "未获取到配置的通知地址";
|
||||
return jm;
|
||||
}
|
||||
|
||||
var tradeType = GlobalEnumVars.WeiChatPayTradeType.JSAPI.ToString();
|
||||
if (!string.IsNullOrEmpty(entity.parameters))
|
||||
//构建linkPay请求配置实体
|
||||
var payOptions = new WeChatPayOptions
|
||||
{
|
||||
var jobj = (JObject)JsonConvert.DeserializeObject(entity.parameters);
|
||||
if (jobj != null && jobj.ContainsKey("trade_type"))
|
||||
tradeType = GetTradeType(jobj["trade_type"].ObjectToString());
|
||||
}
|
||||
AppId = config.appId,
|
||||
MchId = config.mchId,
|
||||
APIKey = config.apiKey,
|
||||
APIv3Key = config.apiV3Key,
|
||||
Certificate = config.certificate,
|
||||
RsaPublicKey = config.rsaPublicKey,
|
||||
SubAppId = config.subAppId,
|
||||
SubMchId = config.subMchId
|
||||
};
|
||||
|
||||
var openId = string.Empty;
|
||||
if (tradeType == GlobalEnumVars.WeiChatPayTradeType.JSAPI.ToString())
|
||||
@@ -162,20 +181,23 @@ namespace CoreCms.Net.Services
|
||||
openId = user.openid;
|
||||
}
|
||||
|
||||
var notifyUrl = config.notifyUrl.EndsWith("/") ? config.notifyUrl + "m-" + config.appId : config.notifyUrl + "/m-" + config.appId;
|
||||
|
||||
|
||||
var orderRequest = new WeChatPayUnifiedOrderRequest
|
||||
{
|
||||
Body = entity.payTitle.Length > 40 ? entity.payTitle[..40] : entity.payTitle,
|
||||
OutTradeNo = entity.paymentId,
|
||||
TotalFee = Convert.ToInt32(entity.money * 100),
|
||||
SpBillCreateIp = entity.ip,
|
||||
NotifyUrl = weChatPayUrl,
|
||||
NotifyUrl = notifyUrl,
|
||||
TradeType = tradeType,
|
||||
//OpenId = openId
|
||||
};
|
||||
|
||||
if (tradeType == GlobalEnumVars.WeiChatPayTradeType.JSAPI.ToString())
|
||||
{
|
||||
if (!string.IsNullOrEmpty(_optionsAccessor.Value.SubMchId))
|
||||
if (!string.IsNullOrEmpty(payOptions.SubMchId))
|
||||
{
|
||||
orderRequest.SubOpenId = openId;
|
||||
}
|
||||
@@ -185,7 +207,7 @@ namespace CoreCms.Net.Services
|
||||
}
|
||||
}
|
||||
|
||||
var response = await _client.ExecuteAsync(orderRequest, _optionsAccessor.Value);
|
||||
var response = await _client.ExecuteAsync(orderRequest, payOptions);
|
||||
if (response.ReturnCode == WeChatPayCode.Success && response.ResultCode == WeChatPayCode.Success)
|
||||
{
|
||||
//App微信支付
|
||||
@@ -195,7 +217,7 @@ namespace CoreCms.Net.Services
|
||||
{
|
||||
PrepayId = response.PrepayId
|
||||
};
|
||||
var parameter = await _client.ExecuteAsync(reqApp, _optionsAccessor.Value);
|
||||
var parameter = await _client.ExecuteAsync(reqApp, payOptions);
|
||||
parameter.Add("paymentId", entity.paymentId);
|
||||
jm.status = true;
|
||||
jm.msg = "创建微信APP支付环境成功";
|
||||
@@ -210,12 +232,12 @@ namespace CoreCms.Net.Services
|
||||
{
|
||||
Package = "prepay_id=" + response.PrepayId
|
||||
};
|
||||
var parameter = await _client.ExecuteAsync(req, _optionsAccessor.Value);
|
||||
var parameter = await _client.ExecuteAsync(req, payOptions);
|
||||
parameter.Add("paymentId", entity.paymentId);
|
||||
jm.status = true;
|
||||
jm.msg = "创建JSAPI支付环境成功";
|
||||
jm.data = parameter;
|
||||
//jm.otherData = response;
|
||||
jm.otherData = response;
|
||||
}
|
||||
//扫码支付
|
||||
else if (tradeType == GlobalEnumVars.WeiChatPayTradeType.NATIVE.ToString())
|
||||
@@ -268,13 +290,42 @@ namespace CoreCms.Net.Services
|
||||
{
|
||||
var jm = new WebApiCallBack();
|
||||
|
||||
var weChatRefundUrl = AppSettingsConstVars.PayCallBackWeChatRefundUrl;
|
||||
if (string.IsNullOrEmpty(weChatRefundUrl))
|
||||
var tradeType = GlobalEnumVars.WeiChatPayTradeType.JSAPI.ToString();
|
||||
if (!string.IsNullOrEmpty(paymentInfo.parameters))
|
||||
{
|
||||
jm.msg = "未获取到配置的通知地址";
|
||||
var jObj = (JObject)JsonConvert.DeserializeObject(paymentInfo.parameters);
|
||||
if (jObj != null && jObj.TryGetValue("trade_type", out var value))
|
||||
tradeType = PayHelper.GetWeiChatPayTradeType(value.ObjectToString());
|
||||
}
|
||||
|
||||
var config = await _weChatPayConfigServices.QueryByClauseAsync(p =>
|
||||
p.isDefault == true && p.isEnable == true && p.appType == tradeType);
|
||||
if (config == null)
|
||||
{
|
||||
jm.msg = "支付配置信息获取失败";
|
||||
return jm;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(config.refundUrl))
|
||||
{
|
||||
jm.msg = "未获取到配置的退款通知地址";
|
||||
return jm;
|
||||
}
|
||||
|
||||
//构建linkPay请求配置实体
|
||||
var payOptions = new WeChatPayOptions
|
||||
{
|
||||
AppId = config.appId,
|
||||
MchId = config.mchId,
|
||||
APIKey = config.apiKey,
|
||||
APIv3Key = config.apiV3Key,
|
||||
Certificate = config.certificate,
|
||||
RsaPublicKey = config.rsaPublicKey,
|
||||
SubAppId = config.subAppId,
|
||||
SubMchId = config.subMchId
|
||||
};
|
||||
|
||||
|
||||
var request = new WeChatPayRefundRequest
|
||||
{
|
||||
OutRefundNo = refundInfo.refundId,
|
||||
@@ -282,9 +333,9 @@ namespace CoreCms.Net.Services
|
||||
OutTradeNo = paymentInfo.paymentId,
|
||||
TotalFee = Convert.ToInt32(paymentInfo.money * 100),
|
||||
RefundFee = Convert.ToInt32(refundInfo.money * 100),
|
||||
NotifyUrl = weChatRefundUrl
|
||||
NotifyUrl = config.refundUrl
|
||||
};
|
||||
var response = await _client.ExecuteAsync(request, _optionsAccessor.Value);
|
||||
var response = await _client.ExecuteAsync(request, payOptions);
|
||||
|
||||
if (response.ReturnCode == WeChatPayCode.Success && response.ResultCode == WeChatPayCode.Success)
|
||||
{
|
||||
@@ -302,18 +353,5 @@ namespace CoreCms.Net.Services
|
||||
return jm;
|
||||
}
|
||||
|
||||
private static string GetTradeType(string tradeType)
|
||||
{
|
||||
if (tradeType != GlobalEnumVars.WeiChatPayTradeType.JSAPI.ToString() &&
|
||||
tradeType != GlobalEnumVars.WeiChatPayTradeType.JSAPI_OFFICIAL.ToString() &&
|
||||
tradeType != GlobalEnumVars.WeiChatPayTradeType.NATIVE.ToString() &&
|
||||
tradeType != GlobalEnumVars.WeiChatPayTradeType.APP.ToString() &&
|
||||
tradeType != GlobalEnumVars.WeiChatPayTradeType.MWEB.ToString()
|
||||
)
|
||||
return "JSAPI";
|
||||
if (tradeType == GlobalEnumVars.WeiChatPayTradeType.JSAPI_OFFICIAL.ToString())
|
||||
return "JSAPI";
|
||||
return tradeType;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -54,16 +54,17 @@ namespace CoreCms.Net.Services
|
||||
private readonly ICoreCmsUserServices _userServices;
|
||||
private readonly ICoreCmsUserBalanceServices _userBalanceServices;
|
||||
private readonly ICoreCmsUserWeChatInfoServices _weChatInfoServices;
|
||||
private readonly IOptions<WeChatPayOptions> _optionsAccessor;
|
||||
private readonly IWeChatPayClient _v2Client;
|
||||
private readonly Essensoft.Paylink.WeChatPay.V3.IWeChatPayClient _v3Client;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
|
||||
private readonly IWebHostEnvironment _webHostEnvironment;
|
||||
private readonly IWeChatPayConfigServices _weChatPayConfigServices;
|
||||
|
||||
|
||||
|
||||
public CoreCmsUserTocashServices(IUnitOfWork unitOfWork, ICoreCmsUserTocashRepository dal,
|
||||
IServiceProvider serviceProvider, ICoreCmsUserServices userServices, ICoreCmsUserBalanceServices userBalanceServices, ICoreCmsUserWeChatInfoServices weChatInfoServices, IOptions<WeChatPayOptions> optionsAccessor, IWeChatPayClient v2Client, IHttpContextAccessor httpContextAccessor, IWebHostEnvironment webHostEnvironment, Essensoft.Paylink.WeChatPay.V3.IWeChatPayClient v3Client)
|
||||
IServiceProvider serviceProvider, ICoreCmsUserServices userServices, ICoreCmsUserBalanceServices userBalanceServices, ICoreCmsUserWeChatInfoServices weChatInfoServices, IWeChatPayClient v2Client, IHttpContextAccessor httpContextAccessor, IWebHostEnvironment webHostEnvironment, Essensoft.Paylink.WeChatPay.V3.IWeChatPayClient v3Client, IWeChatPayConfigServices weChatPayConfigServices)
|
||||
{
|
||||
this._dal = dal;
|
||||
base.BaseDal = dal;
|
||||
@@ -72,11 +73,11 @@ namespace CoreCms.Net.Services
|
||||
_userServices = userServices;
|
||||
_userBalanceServices = userBalanceServices;
|
||||
_weChatInfoServices = weChatInfoServices;
|
||||
_optionsAccessor = optionsAccessor;
|
||||
_v2Client = v2Client;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
_webHostEnvironment = webHostEnvironment;
|
||||
_v3Client = v3Client;
|
||||
_weChatPayConfigServices = weChatPayConfigServices;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -292,6 +293,26 @@ namespace CoreCms.Net.Services
|
||||
jm.msg = "微信用户数据获取失败";
|
||||
return jm;
|
||||
}
|
||||
|
||||
var config = await _weChatPayConfigServices.QueryByClauseAsync(p => p.isDefault == true && p.isEnable == true);
|
||||
if (config == null)
|
||||
{
|
||||
jm.msg = "支付配置信息获取失败";
|
||||
return jm;
|
||||
}
|
||||
//构建linkPay请求配置实体
|
||||
var payOptions = new WeChatPayOptions
|
||||
{
|
||||
AppId = config.appId,
|
||||
MchId = config.mchId,
|
||||
APIKey = config.apiKey,
|
||||
APIv3Key = config.apiV3Key,
|
||||
Certificate = config.certificate,
|
||||
RsaPublicKey = config.rsaPublicKey,
|
||||
SubAppId = config.subAppId,
|
||||
SubMchId = config.subMchId
|
||||
};
|
||||
|
||||
//按分计算
|
||||
var amount = Convert.ToInt16((info.money - info.withdrawals) * 100);
|
||||
//企业付款到零钱
|
||||
@@ -305,7 +326,7 @@ namespace CoreCms.Net.Services
|
||||
Desc = "余额提现零钱",
|
||||
SpBillCreateIp = _httpContextAccessor.HttpContext?.Connection.RemoteIpAddress != null ? _httpContextAccessor.HttpContext.Connection.RemoteIpAddress.MapToIPv4().ToString() : "127.0.0.1"
|
||||
};
|
||||
var response = await _v2Client.ExecuteAsync(request, _optionsAccessor.Value);
|
||||
var response = await _v2Client.ExecuteAsync(request, payOptions);
|
||||
if (response.ReturnCode == WeChatPayCode.Success && response.ResultCode == WeChatPayCode.Success)
|
||||
{
|
||||
status = (int)GlobalEnumVars.UserTocashStatus.提现成功;
|
||||
@@ -351,6 +372,26 @@ namespace CoreCms.Net.Services
|
||||
jm.msg = "微信用户数据获取失败";
|
||||
return jm;
|
||||
}
|
||||
|
||||
var config = await _weChatPayConfigServices.QueryByClauseAsync(p => p.isDefault == true && p.isEnable == true);
|
||||
if (config == null)
|
||||
{
|
||||
jm.msg = "支付配置信息获取失败";
|
||||
return jm;
|
||||
}
|
||||
//构建linkPay请求配置实体
|
||||
var payOptions = new WeChatPayOptions
|
||||
{
|
||||
AppId = config.appId,
|
||||
MchId = config.mchId,
|
||||
APIKey = config.apiKey,
|
||||
APIv3Key = config.apiV3Key,
|
||||
Certificate = config.certificate,
|
||||
RsaPublicKey = config.rsaPublicKey,
|
||||
SubAppId = config.subAppId,
|
||||
SubMchId = config.subMchId
|
||||
};
|
||||
|
||||
//按分计算
|
||||
var amount = Convert.ToInt16((info.money - info.withdrawals) * 100);
|
||||
//企业付款到零钱
|
||||
@@ -363,7 +404,7 @@ namespace CoreCms.Net.Services
|
||||
Amount = amount,
|
||||
Desc = "余额提现银行卡",
|
||||
};
|
||||
var response = await _v2Client.ExecuteAsync(request, _optionsAccessor.Value);
|
||||
var response = await _v2Client.ExecuteAsync(request, payOptions);
|
||||
if (response.ReturnCode == WeChatPayCode.Success && response.ResultCode == WeChatPayCode.Success)
|
||||
{
|
||||
status = (int)GlobalEnumVars.UserTocashStatus.提现成功;
|
||||
@@ -397,12 +438,32 @@ namespace CoreCms.Net.Services
|
||||
jm.msg = "微信用户数据获取失败";
|
||||
return jm;
|
||||
}
|
||||
|
||||
var config = await _weChatPayConfigServices.QueryByClauseAsync(p => p.isDefault == true && p.isEnable == true);
|
||||
if (config == null)
|
||||
{
|
||||
jm.msg = "支付配置信息获取失败";
|
||||
return jm;
|
||||
}
|
||||
//构建linkPay请求配置实体
|
||||
var payOptions = new WeChatPayOptions
|
||||
{
|
||||
AppId = config.appId,
|
||||
MchId = config.mchId,
|
||||
APIKey = config.apiKey,
|
||||
APIv3Key = config.apiV3Key,
|
||||
Certificate = config.certificate,
|
||||
RsaPublicKey = config.rsaPublicKey,
|
||||
SubAppId = config.subAppId,
|
||||
SubMchId = config.subMchId
|
||||
};
|
||||
|
||||
//按分计算
|
||||
var amount = Convert.ToInt16((info.money - info.withdrawals) * 100);
|
||||
|
||||
var model = new WeChatPayTransferBatchesBodyModel
|
||||
{
|
||||
AppId = _optionsAccessor.Value.AppId,
|
||||
AppId = payOptions.AppId,
|
||||
BatchName = info.id + "用户提现处理",
|
||||
BatchRemark = info.id + "用户提现处理",
|
||||
TotalAmount = amount,
|
||||
@@ -424,7 +485,7 @@ namespace CoreCms.Net.Services
|
||||
var request = new WeChatPayTransferBatchesRequest();
|
||||
request.SetBodyModel(model);
|
||||
|
||||
var response = await _v3Client.ExecuteAsync(request, _optionsAccessor.Value);
|
||||
var response = await _v3Client.ExecuteAsync(request, payOptions);
|
||||
if (response.IsError == false)
|
||||
{
|
||||
status = (int)GlobalEnumVars.UserTocashStatus.提现成功;
|
||||
|
||||
@@ -134,7 +134,7 @@
|
||||
payment_code: code,
|
||||
payment_type: this.type,
|
||||
params: {
|
||||
//trade_type: 'NATIVE',
|
||||
trade_type: 'JSAPI',
|
||||
}
|
||||
}
|
||||
data.ids = (this.type == this.$globalConstVars.paymentType.common || this.type == this.$globalConstVars.paymentType.pinTuan || this.type == this.$globalConstVars.paymentType.group || this.type == this.$globalConstVars.paymentType.seckill || this.type == this.$globalConstVars.paymentType.bargain || this.type == this.$globalConstVars.paymentType.giveaway || this.type == this.$globalConstVars.paymentType.solitaire || this.type == this.$globalConstVars.paymentType.transactionComponent || this.type == this.$globalConstVars.paymentType.serviceOrder) ? this.orderId : this.uid
|
||||
|
||||
55
CoreCms.Net.Utility/Helper/PayHelper.cs
Normal file
55
CoreCms.Net.Utility/Helper/PayHelper.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using CoreCms.Net.Configuration;
|
||||
|
||||
namespace CoreCms.Net.Utility.Helper
|
||||
{
|
||||
public static class PayHelper
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 获取微信支付类型
|
||||
/// </summary>
|
||||
/// <param name="tradeType"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetWeiChatPayTradeType(string tradeType)
|
||||
{
|
||||
if (tradeType != GlobalEnumVars.WeiChatPayTradeType.JSAPI.ToString() &&
|
||||
tradeType != GlobalEnumVars.WeiChatPayTradeType.JSAPI_OFFICIAL.ToString() &&
|
||||
tradeType != GlobalEnumVars.WeiChatPayTradeType.NATIVE.ToString() &&
|
||||
tradeType != GlobalEnumVars.WeiChatPayTradeType.APP.ToString() &&
|
||||
tradeType != GlobalEnumVars.WeiChatPayTradeType.MWEB.ToString()
|
||||
)
|
||||
return GlobalEnumVars.WeiChatPayTradeType.JSAPI.ToString();
|
||||
if (tradeType == GlobalEnumVars.WeiChatPayTradeType.JSAPI_OFFICIAL.ToString())
|
||||
return GlobalEnumVars.WeiChatPayTradeType.JSAPI.ToString();
|
||||
return tradeType;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取支付宝支付类型
|
||||
/// </summary>
|
||||
/// <param name="tradeType"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetAliPayPayTradeType(string tradeType)
|
||||
{
|
||||
if (tradeType != GlobalEnumVars.AliPayPayTradeType.JSAPI.ToString() &&
|
||||
tradeType != GlobalEnumVars.AliPayPayTradeType.JSAPI_PC.ToString() &&
|
||||
tradeType != GlobalEnumVars.AliPayPayTradeType.ScanQRCodes.ToString() &&
|
||||
tradeType != GlobalEnumVars.AliPayPayTradeType.APP.ToString() &&
|
||||
tradeType != GlobalEnumVars.AliPayPayTradeType.MWEB.ToString()
|
||||
)
|
||||
{
|
||||
return GlobalEnumVars.AliPayPayTradeType.JSAPI_PC.ToString();
|
||||
}
|
||||
return tradeType;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -31,8 +31,14 @@ using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using NPOI.HSSF.UserModel;
|
||||
using SqlSugar;
|
||||
using CoreCms.Net.Services;
|
||||
using Essensoft.Paylink.Alipay;
|
||||
using Essensoft.Paylink.Alipay.Domain;
|
||||
using Essensoft.Paylink.Alipay.Request;
|
||||
|
||||
namespace CoreCms.Net.Web.Admin.Controllers
|
||||
{
|
||||
@@ -48,24 +54,26 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
{
|
||||
private readonly ICoreCmsBillPaymentsServices _coreCmsBillPaymentsServices;
|
||||
private readonly IWebHostEnvironment _webHostEnvironment;
|
||||
private readonly IWeChatPayClient _client;
|
||||
private readonly IOptions<WeChatPayOptions> _optionsAccessor;
|
||||
private readonly IWeChatPayClient _clientWeCaht;
|
||||
private readonly IAlipayClient _clientAlipay;
|
||||
|
||||
|
||||
private readonly IWeChatPayConfigServices _weChatPayConfigServices;
|
||||
private readonly IAlipayConfigServices _alipayConfigServices;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
/// <param name="webHostEnvironment"></param>
|
||||
/// <param name="coreCmsBillPaymentsServices"></param>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="optionsAccessor"></param>
|
||||
public CoreCmsBillPaymentsController(IWebHostEnvironment webHostEnvironment
|
||||
, ICoreCmsBillPaymentsServices coreCmsBillPaymentsServices, IWeChatPayClient client, IOptions<WeChatPayOptions> optionsAccessor)
|
||||
, ICoreCmsBillPaymentsServices coreCmsBillPaymentsServices, IWeChatPayClient client, IWeChatPayConfigServices weChatPayConfigServices, IAlipayConfigServices alipayConfigServices, IAlipayClient clientAlipay)
|
||||
{
|
||||
_webHostEnvironment = webHostEnvironment;
|
||||
_coreCmsBillPaymentsServices = coreCmsBillPaymentsServices;
|
||||
_client = client;
|
||||
_optionsAccessor = optionsAccessor;
|
||||
_clientWeCaht = client;
|
||||
_weChatPayConfigServices = weChatPayConfigServices;
|
||||
_alipayConfigServices = alipayConfigServices;
|
||||
_clientAlipay = clientAlipay;
|
||||
}
|
||||
|
||||
#region 获取列表============================================================
|
||||
@@ -508,9 +516,9 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
jm.msg = "不存在此信息";
|
||||
return jm;
|
||||
}
|
||||
if (model.paymentCode != GlobalEnumVars.PaymentsTypes.wechatpay.ToString())
|
||||
if (model.paymentCode != GlobalEnumVars.PaymentsTypes.wechatpay.ToString() && model.paymentCode != GlobalEnumVars.PaymentsTypes.alipay.ToString())
|
||||
{
|
||||
jm.msg = "此更新暂时仅支持微信支付查询";
|
||||
jm.msg = "此更新暂时仅支持微信支付及支付宝支付查询";
|
||||
return jm;
|
||||
}
|
||||
|
||||
@@ -521,32 +529,136 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
}
|
||||
|
||||
|
||||
var request = new WeChatPayOrderQueryRequest
|
||||
if (model.paymentCode == GlobalEnumVars.PaymentsTypes.wechatpay.ToString())
|
||||
{
|
||||
//微信订单号
|
||||
//TransactionId = model.TransactionId,
|
||||
//商户订单号
|
||||
OutTradeNo = model.paymentId
|
||||
};
|
||||
var response = await _client.ExecuteAsync(request, _optionsAccessor.Value);
|
||||
var tradeType = GlobalEnumVars.WeiChatPayTradeType.JSAPI.ToString();
|
||||
if (!string.IsNullOrEmpty(model.parameters))
|
||||
{
|
||||
var jObj = (JObject)JsonConvert.DeserializeObject(model.parameters);
|
||||
if (jObj != null && jObj.TryGetValue("trade_type", out var value))
|
||||
tradeType = PayHelper.GetWeiChatPayTradeType(value.ObjectToString());
|
||||
}
|
||||
|
||||
if (response is { ReturnCode: WeChatPayCode.Success, ResultCode: WeChatPayCode.Success, TradeState: WeChatPayCode.Success })
|
||||
var config = await _weChatPayConfigServices.QueryByClauseAsync(p => p.isDefault == true && p.isEnable == true && p.appType == tradeType);
|
||||
|
||||
if (config == null)
|
||||
{
|
||||
jm.msg = "未获取到你的支付配置信息";
|
||||
return jm;
|
||||
}
|
||||
|
||||
//构建linkPay请求配置实体
|
||||
var payOptions = new WeChatPayOptions
|
||||
{
|
||||
AppId = config.appId,
|
||||
MchId = config.mchId,
|
||||
APIKey = config.apiKey,
|
||||
APIv3Key = config.apiV3Key,
|
||||
Certificate = config.certificate,
|
||||
RsaPublicKey = config.rsaPublicKey,
|
||||
SubAppId = config.subAppId,
|
||||
SubMchId = config.subMchId
|
||||
};
|
||||
|
||||
var request = new WeChatPayOrderQueryRequest
|
||||
{
|
||||
//微信订单号
|
||||
//TransactionId = model.TransactionId,
|
||||
//商户订单号
|
||||
OutTradeNo = model.paymentId
|
||||
};
|
||||
var response = await _clientWeCaht.ExecuteAsync(request, payOptions);
|
||||
|
||||
if (response is { ReturnCode: WeChatPayCode.Success, ResultCode: WeChatPayCode.Success, TradeState: WeChatPayCode.Success })
|
||||
{
|
||||
var money = Math.Round((decimal)response.TotalFee / 100, 2);
|
||||
await _coreCmsBillPaymentsServices.ToUpdate(response.OutTradeNo,
|
||||
(int)GlobalEnumVars.BillPaymentsStatus.Payed,
|
||||
GlobalEnumVars.PaymentsTypes.wechatpay.ToString(), money, response.ResultCode,
|
||||
response.TransactionId);
|
||||
|
||||
jm.code = 0;
|
||||
jm.msg = "刷新成功";
|
||||
//jm.data = response;
|
||||
}
|
||||
else
|
||||
{
|
||||
jm.code = 1;
|
||||
//jm.data = response;
|
||||
jm.msg = response.TradeState == "NOTPAY" ? response.TradeStateDesc : response.ErrCodeDes;
|
||||
}
|
||||
|
||||
}
|
||||
else if (model.paymentCode == GlobalEnumVars.PaymentsTypes.alipay.ToString())
|
||||
{
|
||||
var money = Math.Round((decimal)response.TotalFee / 100, 2);
|
||||
await _coreCmsBillPaymentsServices.ToUpdate(response.OutTradeNo,
|
||||
(int)GlobalEnumVars.BillPaymentsStatus.Payed,
|
||||
GlobalEnumVars.PaymentsTypes.wechatpay.ToString(), money, response.ResultCode,
|
||||
response.TransactionId);
|
||||
var tradeType = GlobalEnumVars.AliPayPayTradeType.ScanQRCodes.ToString();
|
||||
if (!string.IsNullOrEmpty(model.parameters))
|
||||
{
|
||||
var jObj = (JObject)JsonConvert.DeserializeObject(model.parameters);
|
||||
if (jObj != null && jObj.TryGetValue("trade_type", out var value))
|
||||
tradeType = PayHelper.GetAliPayPayTradeType(value.ObjectToString());
|
||||
}
|
||||
|
||||
var config = await _alipayConfigServices.QueryByClauseAsync(p => p.isDefault == true && p.isEnable == true && p.appType == tradeType);
|
||||
if (config == null)
|
||||
{
|
||||
jm.msg = "未获取到你的支付配置信息";
|
||||
return jm;
|
||||
}
|
||||
|
||||
//构建linkPay请求配置实体
|
||||
var payOptions = new AlipayOptions
|
||||
{
|
||||
AppId = config.appId,
|
||||
AlipayPublicKey = config.publicKey,
|
||||
AppPrivateKey = config.privateKey,
|
||||
ServerUrl = config.serverUrl,
|
||||
SignType = config.signType,
|
||||
AppPublicCert = config.appPublicCert,
|
||||
AlipayPublicCert = config.alipayPublicCert,
|
||||
AlipayRootCert = config.alipayRootCert
|
||||
};
|
||||
|
||||
var request = new AlipayTradeQueryModel
|
||||
{
|
||||
OutTradeNo = model.paymentId,
|
||||
//TradeNo = viewMode.TradeNo
|
||||
};
|
||||
|
||||
var req = new AlipayTradeQueryRequest();
|
||||
req.SetBizModel(request);
|
||||
|
||||
var response = await _clientAlipay.ExecuteAsync(req, payOptions);
|
||||
|
||||
if (response is { Code: "10000", IsError: false })
|
||||
{
|
||||
var money = Convert.ToDecimal(response.PayAmount);
|
||||
await _coreCmsBillPaymentsServices.ToUpdate(response.OutTradeNo,
|
||||
(int)GlobalEnumVars.BillPaymentsStatus.Payed,
|
||||
GlobalEnumVars.PaymentsTypes.wechatpay.ToString(), money, response.Code,
|
||||
response.TradeNo);
|
||||
|
||||
jm.code = 0;
|
||||
jm.msg = "刷新成功";
|
||||
//jm.data = response;
|
||||
}
|
||||
else
|
||||
{
|
||||
jm.code = 1;
|
||||
//jm.data = response;
|
||||
jm.msg = !string.IsNullOrEmpty(response.SubMsg) ? response.SubMsg : response.Msg;
|
||||
}
|
||||
|
||||
jm.otherData = response;
|
||||
|
||||
return jm;
|
||||
|
||||
jm.code = 0;
|
||||
jm.msg = "刷新成功";
|
||||
jm.data = response;
|
||||
}
|
||||
else
|
||||
{
|
||||
jm.code = 1;
|
||||
jm.msg = response.TradeStateDesc;
|
||||
jm.msg = "错误类型的支付方式";
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,438 @@
|
||||
/***********************************************************************
|
||||
* Project: CoreCms
|
||||
* ProjectName: 核心内容管理系统
|
||||
* Web: https://www.corecms.net
|
||||
* Author: 大灰灰
|
||||
* Email: jianweie@163.com
|
||||
* CreateTime: 2023/4/20 23:33:03
|
||||
* 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.Model.Entities;
|
||||
using CoreCms.Net.Model.Entities.Expression;
|
||||
using CoreCms.Net.Model.FromBody;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using CoreCms.Net.Filter;
|
||||
using CoreCms.Net.Loging;
|
||||
using CoreCms.Net.IServices;
|
||||
using CoreCms.Net.Utility.Helper;
|
||||
using CoreCms.Net.Utility.Extensions;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using NPOI.HSSF.UserModel;
|
||||
using SqlSugar;
|
||||
using static CoreCms.Net.Configuration.GlobalEnumVars;
|
||||
|
||||
namespace CoreCms.Net.Web.Admin.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// 支付宝支付配置
|
||||
///</summary>
|
||||
[Description("支付宝支付配置")]
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
[RequiredErrorForAdmin]
|
||||
[Authorize(Permissions.Name)]
|
||||
public class CoreCmsAlipayConfigController : ControllerBase
|
||||
{
|
||||
private readonly IWebHostEnvironment _webHostEnvironment;
|
||||
private readonly IAlipayConfigServices _coreCmsAlipayConfigServices;
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
///</summary>
|
||||
public CoreCmsAlipayConfigController(IWebHostEnvironment webHostEnvironment
|
||||
, IAlipayConfigServices coreCmsAlipayConfigServices
|
||||
)
|
||||
{
|
||||
_webHostEnvironment = webHostEnvironment;
|
||||
_coreCmsAlipayConfigServices = coreCmsAlipayConfigServices;
|
||||
}
|
||||
|
||||
#region 获取列表============================================================
|
||||
// POST: Api/CoreCmsAlipayConfig/GetPageList
|
||||
/// <summary>
|
||||
/// 获取列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("获取列表")]
|
||||
public async Task<AdminUiCallBack> GetPageList()
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
var pageCurrent = Request.Form["page"].FirstOrDefault().ObjectToInt(1);
|
||||
var pageSize = Request.Form["limit"].FirstOrDefault().ObjectToInt(30);
|
||||
var where = PredicateBuilder.True<CoreCmsAlipayConfig>();
|
||||
//获取排序字段
|
||||
var orderField = Request.Form["orderField"].FirstOrDefault();
|
||||
|
||||
Expression<Func<CoreCmsAlipayConfig, object>> orderEx = orderField switch
|
||||
{
|
||||
"id" => p => p.id,
|
||||
"appId" => p => p.appId,
|
||||
"publicKey" => p => p.publicKey,
|
||||
"privateKey" => p => p.privateKey,
|
||||
"serverUrl" => p => p.serverUrl,
|
||||
"signType" => p => p.signType,
|
||||
"appPublicCert" => p => p.appPublicCert,
|
||||
"alipayPublicCert" => p => p.alipayPublicCert,
|
||||
"alipayRootCert" => p => p.alipayRootCert,
|
||||
"appType" => p => p.appType,
|
||||
"notifyUrl" => p => p.notifyUrl,
|
||||
"refundUrl" => p => p.refundUrl,
|
||||
"jumpUrl" => p => p.jumpUrl,
|
||||
"isEnable" => p => p.isEnable,
|
||||
"isDefault" => p => p.isDefault,
|
||||
_ => p => p.id
|
||||
};
|
||||
|
||||
//设置排序方式
|
||||
var orderDirection = Request.Form["orderDirection"].FirstOrDefault();
|
||||
var orderBy = orderDirection switch
|
||||
{
|
||||
"asc" => OrderByType.Asc,
|
||||
"desc" => OrderByType.Desc,
|
||||
_ => OrderByType.Desc
|
||||
};
|
||||
//查询筛选
|
||||
|
||||
//序列 int
|
||||
var id = Request.Form["id"].FirstOrDefault().ObjectToInt(0);
|
||||
if (id > 0)
|
||||
{
|
||||
where = where.And(p => p.id == id);
|
||||
}
|
||||
//支付宝开放平台AppId varchar
|
||||
var appId = Request.Form["appId"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(appId))
|
||||
{
|
||||
where = where.And(p => p.appId.Contains(appId));
|
||||
}
|
||||
//支付宝公钥 varchar
|
||||
var publicKey = Request.Form["publicKey"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(publicKey))
|
||||
{
|
||||
where = where.And(p => p.publicKey.Contains(publicKey));
|
||||
}
|
||||
//应用私钥 varchar
|
||||
var privateKey = Request.Form["privateKey"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(privateKey))
|
||||
{
|
||||
where = where.And(p => p.privateKey.Contains(privateKey));
|
||||
}
|
||||
//服务网关地址 varchar
|
||||
var serverUrl = Request.Form["serverUrl"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(serverUrl))
|
||||
{
|
||||
where = where.And(p => p.serverUrl.Contains(serverUrl));
|
||||
}
|
||||
//签名类型 varchar
|
||||
var signType = Request.Form["signType"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(signType))
|
||||
{
|
||||
where = where.And(p => p.signType.Contains(signType));
|
||||
}
|
||||
//应用公钥证书 varchar
|
||||
var appPublicCert = Request.Form["appPublicCert"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(appPublicCert))
|
||||
{
|
||||
where = where.And(p => p.appPublicCert.Contains(appPublicCert));
|
||||
}
|
||||
//支付宝公钥证书 varchar
|
||||
var alipayPublicCert = Request.Form["alipayPublicCert"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(alipayPublicCert))
|
||||
{
|
||||
where = where.And(p => p.alipayPublicCert.Contains(alipayPublicCert));
|
||||
}
|
||||
//支付宝根证书 varchar
|
||||
var alipayRootCert = Request.Form["alipayRootCert"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(alipayRootCert))
|
||||
{
|
||||
where = where.And(p => p.alipayRootCert.Contains(alipayRootCert));
|
||||
}
|
||||
//应用类型 varchar
|
||||
var appType = Request.Form["appType"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(appType))
|
||||
{
|
||||
where = where.And(p => p.appType.Contains(appType));
|
||||
}
|
||||
//支付宝支付回调通知 varchar
|
||||
var notifyUrl = Request.Form["notifyUrl"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(notifyUrl))
|
||||
{
|
||||
where = where.And(p => p.notifyUrl.Contains(notifyUrl));
|
||||
}
|
||||
//支付宝退款回调 varchar
|
||||
var refundUrl = Request.Form["refundUrl"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(refundUrl))
|
||||
{
|
||||
where = where.And(p => p.refundUrl.Contains(refundUrl));
|
||||
}
|
||||
//支付跳转地址 varchar
|
||||
var jumpUrl = Request.Form["jumpUrl"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(jumpUrl))
|
||||
{
|
||||
where = where.And(p => p.jumpUrl.Contains(jumpUrl));
|
||||
}
|
||||
//是否启用 bit
|
||||
var isEnable = Request.Form["isEnable"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(isEnable) && isEnable.ToLowerInvariant() == "true")
|
||||
{
|
||||
where = where.And(p => p.isEnable == true);
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(isEnable) && isEnable.ToLowerInvariant() == "false")
|
||||
{
|
||||
where = where.And(p => p.isEnable == false);
|
||||
}
|
||||
//当前多端默认 bit
|
||||
var isDefault = Request.Form["isDefault"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(isDefault) && isDefault.ToLowerInvariant() == "true")
|
||||
{
|
||||
where = where.And(p => p.isDefault == true);
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(isDefault) && isDefault.ToLowerInvariant() == "false")
|
||||
{
|
||||
where = where.And(p => p.isDefault == false);
|
||||
}
|
||||
//获取数据
|
||||
var list = await _coreCmsAlipayConfigServices.QueryPageAsync(where, orderEx, orderBy, pageCurrent, pageSize, true);
|
||||
//返回数据
|
||||
jm.data = list;
|
||||
jm.code = 0;
|
||||
jm.count = list.TotalCount;
|
||||
jm.msg = "数据调用成功!";
|
||||
return jm;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 首页数据============================================================
|
||||
// POST: Api/CoreCmsAlipayConfig/GetIndex
|
||||
/// <summary>
|
||||
/// 首页数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("首页数据")]
|
||||
public AdminUiCallBack GetIndex()
|
||||
{
|
||||
//返回数据
|
||||
var jm = new AdminUiCallBack { code = 0 };
|
||||
|
||||
var aliPayPayTradeType = EnumHelper.EnumToList<AliPayPayTradeType>();
|
||||
jm.data = new
|
||||
{
|
||||
aliPayPayTradeType
|
||||
};
|
||||
|
||||
return jm;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 创建数据============================================================
|
||||
// POST: Api/CoreCmsAlipayConfig/GetCreate
|
||||
/// <summary>
|
||||
/// 创建数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("创建数据")]
|
||||
public AdminUiCallBack GetCreate()
|
||||
{
|
||||
//返回数据
|
||||
var jm = new AdminUiCallBack { code = 0 };
|
||||
|
||||
var aliPayPayTradeType = EnumHelper.EnumToList<AliPayPayTradeType>();
|
||||
jm.data = new
|
||||
{
|
||||
aliPayPayTradeType
|
||||
};
|
||||
|
||||
return jm;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 创建提交============================================================
|
||||
// POST: Api/CoreCmsAlipayConfig/DoCreate
|
||||
/// <summary>
|
||||
/// 创建提交
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("创建提交")]
|
||||
public async Task<AdminUiCallBack> DoCreate([FromBody] CoreCmsAlipayConfig entity)
|
||||
{
|
||||
var jm = await _coreCmsAlipayConfigServices.InsertAsync(entity);
|
||||
return jm;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 编辑数据============================================================
|
||||
// POST: Api/CoreCmsAlipayConfig/GetEdit
|
||||
/// <summary>
|
||||
/// 编辑数据
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("编辑数据")]
|
||||
public async Task<AdminUiCallBack> GetEdit([FromBody] FMIntId entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var model = await _coreCmsAlipayConfigServices.QueryByIdAsync(entity.id, false);
|
||||
if (model == null)
|
||||
{
|
||||
jm.msg = "不存在此信息";
|
||||
return jm;
|
||||
}
|
||||
jm.code = 0;
|
||||
|
||||
var aliPayPayTradeType = EnumHelper.EnumToList<AliPayPayTradeType>();
|
||||
jm.data = new
|
||||
{
|
||||
model,
|
||||
aliPayPayTradeType
|
||||
};
|
||||
|
||||
return jm;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 编辑提交============================================================
|
||||
// POST: Api/CoreCmsAlipayConfig/Edit
|
||||
/// <summary>
|
||||
/// 编辑提交
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("编辑提交")]
|
||||
public async Task<AdminUiCallBack> DoEdit([FromBody] CoreCmsAlipayConfig entity)
|
||||
{
|
||||
var jm = await _coreCmsAlipayConfigServices.UpdateAsync(entity);
|
||||
return jm;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 删除数据============================================================
|
||||
// POST: Api/CoreCmsAlipayConfig/DoDelete/10
|
||||
/// <summary>
|
||||
/// 单选删除
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("单选删除")]
|
||||
public async Task<AdminUiCallBack> DoDelete([FromBody] FMIntId entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var model = await _coreCmsAlipayConfigServices.ExistsAsync(p => p.id == entity.id, true);
|
||||
if (!model)
|
||||
{
|
||||
jm.msg = GlobalConstVars.DataisNo;
|
||||
return jm;
|
||||
}
|
||||
jm = await _coreCmsAlipayConfigServices.DeleteByIdAsync(entity.id);
|
||||
|
||||
return jm;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 预览数据============================================================
|
||||
// POST: Api/CoreCmsAlipayConfig/GetDetails/10
|
||||
/// <summary>
|
||||
/// 预览数据
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("预览数据")]
|
||||
public async Task<AdminUiCallBack> GetDetails([FromBody] FMIntId entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var model = await _coreCmsAlipayConfigServices.QueryByIdAsync(entity.id, false);
|
||||
if (model == null)
|
||||
{
|
||||
jm.msg = "不存在此信息";
|
||||
return jm;
|
||||
}
|
||||
jm.code = 0;
|
||||
jm.data = model;
|
||||
|
||||
return jm;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 设置是否启用============================================================
|
||||
// POST: Api/CoreCmsAlipayConfig/DoSetisEnable/10
|
||||
/// <summary>
|
||||
/// 设置是否启用
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("设置是否启用")]
|
||||
public async Task<AdminUiCallBack> DoSetisEnable([FromBody] FMUpdateBoolDataByIntId entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var oldModel = await _coreCmsAlipayConfigServices.QueryByIdAsync(entity.id, false);
|
||||
if (oldModel == null)
|
||||
{
|
||||
jm.msg = "不存在此信息";
|
||||
return jm;
|
||||
}
|
||||
oldModel.isEnable = (bool)entity.data;
|
||||
|
||||
var bl = await _coreCmsAlipayConfigServices.UpdateAsync(p => new CoreCmsAlipayConfig() { isEnable = oldModel.isEnable }, p => p.id == oldModel.id);
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
|
||||
|
||||
return jm;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 设置当前多端默认============================================================
|
||||
// POST: Api/CoreCmsAlipayConfig/DoSetisDefault/10
|
||||
/// <summary>
|
||||
/// 设置当前多端默认
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("设置当前多端默认")]
|
||||
public async Task<AdminUiCallBack> DoSetisDefault([FromBody] FMUpdateBoolDataByIntId entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var oldModel = await _coreCmsAlipayConfigServices.QueryByIdAsync(entity.id, false);
|
||||
if (oldModel == null)
|
||||
{
|
||||
jm.msg = "不存在此信息";
|
||||
return jm;
|
||||
}
|
||||
oldModel.isDefault = (bool)entity.data;
|
||||
|
||||
var bl = await _coreCmsAlipayConfigServices.UpdateAsync(p => new CoreCmsAlipayConfig() { isDefault = oldModel.isDefault }, p => p.id == oldModel.id);
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
|
||||
|
||||
return jm;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,438 @@
|
||||
/***********************************************************************
|
||||
* Project: CoreCms
|
||||
* ProjectName: 核心内容管理系统
|
||||
* Web: https://www.corecms.net
|
||||
* Author: 大灰灰
|
||||
* Email: jianweie@163.com
|
||||
* CreateTime: 2023/4/22 23:40:15
|
||||
* 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.Model.Entities;
|
||||
using CoreCms.Net.Model.Entities.Expression;
|
||||
using CoreCms.Net.Model.FromBody;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using CoreCms.Net.Filter;
|
||||
using CoreCms.Net.Loging;
|
||||
using CoreCms.Net.IServices;
|
||||
using CoreCms.Net.Utility.Helper;
|
||||
using CoreCms.Net.Utility.Extensions;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using NPOI.HSSF.UserModel;
|
||||
using SqlSugar;
|
||||
using static CoreCms.Net.Configuration.GlobalEnumVars;
|
||||
|
||||
namespace CoreCms.Net.Web.Admin.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// 微信支付配置
|
||||
///</summary>
|
||||
[Description("微信支付配置")]
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
[RequiredErrorForAdmin]
|
||||
[Authorize(Permissions.Name)]
|
||||
public class CoreCmsWeChatPayConfigController : ControllerBase
|
||||
{
|
||||
private readonly IWebHostEnvironment _webHostEnvironment;
|
||||
private readonly IWeChatPayConfigServices _coreCmsWeChatPayConfigServices;
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
///</summary>
|
||||
public CoreCmsWeChatPayConfigController(IWebHostEnvironment webHostEnvironment
|
||||
, IWeChatPayConfigServices coreCmsWeChatPayConfigServices
|
||||
)
|
||||
{
|
||||
_webHostEnvironment = webHostEnvironment;
|
||||
_coreCmsWeChatPayConfigServices = coreCmsWeChatPayConfigServices;
|
||||
}
|
||||
|
||||
#region 获取列表============================================================
|
||||
// POST: Api/CoreCmsWeChatPayConfig/GetPageList
|
||||
/// <summary>
|
||||
/// 获取列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("获取列表")]
|
||||
public async Task<AdminUiCallBack> GetPageList()
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
var pageCurrent = Request.Form["page"].FirstOrDefault().ObjectToInt(1);
|
||||
var pageSize = Request.Form["limit"].FirstOrDefault().ObjectToInt(30);
|
||||
var where = PredicateBuilder.True<CoreCmsWeChatPayConfig>();
|
||||
//获取排序字段
|
||||
var orderField = Request.Form["orderField"].FirstOrDefault();
|
||||
|
||||
Expression<Func<CoreCmsWeChatPayConfig, object>> orderEx = orderField switch
|
||||
{
|
||||
"id" => p => p.id,
|
||||
"appId" => p => p.appId,
|
||||
"mchId" => p => p.mchId,
|
||||
"apiKey" => p => p.apiKey,
|
||||
"apiV3Key" => p => p.apiV3Key,
|
||||
"certificate" => p => p.certificate,
|
||||
"rsaPublicKey" => p => p.rsaPublicKey,
|
||||
"subAppId" => p => p.subAppId,
|
||||
"subMchId" => p => p.subMchId,
|
||||
"notifyUrl" => p => p.notifyUrl,
|
||||
"refundUrl" => p => p.refundUrl,
|
||||
"jumpUrl" => p => p.jumpUrl,
|
||||
"isEnable" => p => p.isEnable,
|
||||
"isDefault" => p => p.isDefault,
|
||||
"appType" => p => p.appType,
|
||||
_ => p => p.id
|
||||
};
|
||||
|
||||
//设置排序方式
|
||||
var orderDirection = Request.Form["orderDirection"].FirstOrDefault();
|
||||
var orderBy = orderDirection switch
|
||||
{
|
||||
"asc" => OrderByType.Asc,
|
||||
"desc" => OrderByType.Desc,
|
||||
_ => OrderByType.Desc
|
||||
};
|
||||
//查询筛选
|
||||
|
||||
//序列 int
|
||||
var id = Request.Form["id"].FirstOrDefault().ObjectToInt(0);
|
||||
if (id > 0)
|
||||
{
|
||||
where = where.And(p => p.id == id);
|
||||
}
|
||||
//应用号 varchar
|
||||
var appId = Request.Form["appId"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(appId))
|
||||
{
|
||||
where = where.And(p => p.appId.Contains(appId));
|
||||
}
|
||||
//商户号 varchar
|
||||
var mchId = Request.Form["mchId"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(mchId))
|
||||
{
|
||||
where = where.And(p => p.mchId.Contains(mchId));
|
||||
}
|
||||
//API秘钥 varchar
|
||||
var apiKey = Request.Form["apiKey"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(apiKey))
|
||||
{
|
||||
where = where.And(p => p.apiKey.Contains(apiKey));
|
||||
}
|
||||
//APIv3密钥 varchar
|
||||
var apiV3Key = Request.Form["apiV3Key"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(apiV3Key))
|
||||
{
|
||||
where = where.And(p => p.apiV3Key.Contains(apiV3Key));
|
||||
}
|
||||
//p12证书base64 varchar
|
||||
var certificate = Request.Form["certificate"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(certificate))
|
||||
{
|
||||
where = where.And(p => p.certificate.Contains(certificate));
|
||||
}
|
||||
//RSA公钥 varchar
|
||||
var rsaPublicKey = Request.Form["rsaPublicKey"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(rsaPublicKey))
|
||||
{
|
||||
where = where.And(p => p.rsaPublicKey.Contains(rsaPublicKey));
|
||||
}
|
||||
//子商户应用号 varchar
|
||||
var subAppId = Request.Form["subAppId"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(subAppId))
|
||||
{
|
||||
where = where.And(p => p.subAppId.Contains(subAppId));
|
||||
}
|
||||
//子商户号 varchar
|
||||
var subMchId = Request.Form["subMchId"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(subMchId))
|
||||
{
|
||||
where = where.And(p => p.subMchId.Contains(subMchId));
|
||||
}
|
||||
//支付回调通知 varchar
|
||||
var notifyUrl = Request.Form["notifyUrl"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(notifyUrl))
|
||||
{
|
||||
where = where.And(p => p.notifyUrl.Contains(notifyUrl));
|
||||
}
|
||||
//退款回调 varchar
|
||||
var refundUrl = Request.Form["refundUrl"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(refundUrl))
|
||||
{
|
||||
where = where.And(p => p.refundUrl.Contains(refundUrl));
|
||||
}
|
||||
//跳转地址 varchar
|
||||
var jumpUrl = Request.Form["jumpUrl"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(jumpUrl))
|
||||
{
|
||||
where = where.And(p => p.jumpUrl.Contains(jumpUrl));
|
||||
}
|
||||
//是否开启 bit
|
||||
var isEnable = Request.Form["isEnable"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(isEnable) && isEnable.ToLowerInvariant() == "true")
|
||||
{
|
||||
where = where.And(p => p.isEnable == true);
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(isEnable) && isEnable.ToLowerInvariant() == "false")
|
||||
{
|
||||
where = where.And(p => p.isEnable == false);
|
||||
}
|
||||
//是否本类默认 bit
|
||||
var isDefault = Request.Form["isDefault"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(isDefault) && isDefault.ToLowerInvariant() == "true")
|
||||
{
|
||||
where = where.And(p => p.isDefault == true);
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(isDefault) && isDefault.ToLowerInvariant() == "false")
|
||||
{
|
||||
where = where.And(p => p.isDefault == false);
|
||||
}
|
||||
//应用类型 varchar
|
||||
var appType = Request.Form["appType"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(appType))
|
||||
{
|
||||
where = where.And(p => p.appType.Contains(appType));
|
||||
}
|
||||
//获取数据
|
||||
var list = await _coreCmsWeChatPayConfigServices.QueryPageAsync(where, orderEx, orderBy, pageCurrent, pageSize, true);
|
||||
//返回数据
|
||||
jm.data = list;
|
||||
jm.code = 0;
|
||||
jm.count = list.TotalCount;
|
||||
jm.msg = "数据调用成功!";
|
||||
return jm;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 首页数据============================================================
|
||||
// POST: Api/CoreCmsWeChatPayConfig/GetIndex
|
||||
/// <summary>
|
||||
/// 首页数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("首页数据")]
|
||||
public AdminUiCallBack GetIndex()
|
||||
{
|
||||
//返回数据
|
||||
var jm = new AdminUiCallBack { code = 0 };
|
||||
|
||||
var weiChatPayTradeType = EnumHelper.EnumToList<WeiChatPayTradeType>();
|
||||
jm.data = new
|
||||
{
|
||||
weiChatPayTradeType
|
||||
};
|
||||
|
||||
return jm;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 创建数据============================================================
|
||||
// POST: Api/CoreCmsWeChatPayConfig/GetCreate
|
||||
/// <summary>
|
||||
/// 创建数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("创建数据")]
|
||||
public AdminUiCallBack GetCreate()
|
||||
{
|
||||
//返回数据
|
||||
var jm = new AdminUiCallBack { code = 0 };
|
||||
|
||||
var weiChatPayTradeType = EnumHelper.EnumToList<WeiChatPayTradeType>();
|
||||
jm.data = new
|
||||
{
|
||||
weiChatPayTradeType
|
||||
};
|
||||
|
||||
return jm;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 创建提交============================================================
|
||||
// POST: Api/CoreCmsWeChatPayConfig/DoCreate
|
||||
/// <summary>
|
||||
/// 创建提交
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("创建提交")]
|
||||
public async Task<AdminUiCallBack> DoCreate([FromBody] CoreCmsWeChatPayConfig entity)
|
||||
{
|
||||
var jm = await _coreCmsWeChatPayConfigServices.InsertAsync(entity);
|
||||
return jm;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 编辑数据============================================================
|
||||
// POST: Api/CoreCmsWeChatPayConfig/GetEdit
|
||||
/// <summary>
|
||||
/// 编辑数据
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("编辑数据")]
|
||||
public async Task<AdminUiCallBack> GetEdit([FromBody] FMIntId entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var model = await _coreCmsWeChatPayConfigServices.QueryByIdAsync(entity.id, false);
|
||||
if (model == null)
|
||||
{
|
||||
jm.msg = "不存在此信息";
|
||||
return jm;
|
||||
}
|
||||
jm.code = 0;
|
||||
|
||||
var weiChatPayTradeType = EnumHelper.EnumToList<WeiChatPayTradeType>();
|
||||
jm.data = new
|
||||
{
|
||||
model,
|
||||
weiChatPayTradeType
|
||||
};
|
||||
|
||||
return jm;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 编辑提交============================================================
|
||||
// POST: Api/CoreCmsWeChatPayConfig/Edit
|
||||
/// <summary>
|
||||
/// 编辑提交
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("编辑提交")]
|
||||
public async Task<AdminUiCallBack> DoEdit([FromBody] CoreCmsWeChatPayConfig entity)
|
||||
{
|
||||
var jm = await _coreCmsWeChatPayConfigServices.UpdateAsync(entity);
|
||||
return jm;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 删除数据============================================================
|
||||
// POST: Api/CoreCmsWeChatPayConfig/DoDelete/10
|
||||
/// <summary>
|
||||
/// 单选删除
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("单选删除")]
|
||||
public async Task<AdminUiCallBack> DoDelete([FromBody] FMIntId entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var model = await _coreCmsWeChatPayConfigServices.ExistsAsync(p => p.id == entity.id, true);
|
||||
if (!model)
|
||||
{
|
||||
jm.msg = GlobalConstVars.DataisNo;
|
||||
return jm;
|
||||
}
|
||||
jm = await _coreCmsWeChatPayConfigServices.DeleteByIdAsync(entity.id);
|
||||
|
||||
return jm;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 预览数据============================================================
|
||||
// POST: Api/CoreCmsWeChatPayConfig/GetDetails/10
|
||||
/// <summary>
|
||||
/// 预览数据
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("预览数据")]
|
||||
public async Task<AdminUiCallBack> GetDetails([FromBody] FMIntId entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var model = await _coreCmsWeChatPayConfigServices.QueryByIdAsync(entity.id, false);
|
||||
if (model == null)
|
||||
{
|
||||
jm.msg = "不存在此信息";
|
||||
return jm;
|
||||
}
|
||||
jm.code = 0;
|
||||
jm.data = model;
|
||||
|
||||
return jm;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 设置是否开启============================================================
|
||||
// POST: Api/CoreCmsWeChatPayConfig/DoSetisEnable/10
|
||||
/// <summary>
|
||||
/// 设置是否开启
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("设置是否开启")]
|
||||
public async Task<AdminUiCallBack> DoSetisEnable([FromBody] FMUpdateBoolDataByIntId entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var oldModel = await _coreCmsWeChatPayConfigServices.QueryByIdAsync(entity.id, false);
|
||||
if (oldModel == null)
|
||||
{
|
||||
jm.msg = "不存在此信息";
|
||||
return jm;
|
||||
}
|
||||
oldModel.isEnable = (bool)entity.data;
|
||||
|
||||
var bl = await _coreCmsWeChatPayConfigServices.UpdateAsync(p => new CoreCmsWeChatPayConfig() { isEnable = oldModel.isEnable }, p => p.id == oldModel.id);
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
|
||||
|
||||
return jm;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 设置是否本类默认============================================================
|
||||
// POST: Api/CoreCmsWeChatPayConfig/DoSetisDefault/10
|
||||
/// <summary>
|
||||
/// 设置是否本类默认
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("设置是否本类默认")]
|
||||
public async Task<AdminUiCallBack> DoSetisDefault([FromBody] FMUpdateBoolDataByIntId entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var oldModel = await _coreCmsWeChatPayConfigServices.QueryByIdAsync(entity.id, false);
|
||||
if (oldModel == null)
|
||||
{
|
||||
jm.msg = "不存在此信息";
|
||||
return jm;
|
||||
}
|
||||
oldModel.isDefault = (bool)entity.data;
|
||||
|
||||
var bl = await _coreCmsWeChatPayConfigServices.UpdateAsync(p => new CoreCmsWeChatPayConfig() { isDefault = oldModel.isDefault }, p => p.id == oldModel.id);
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
|
||||
|
||||
return jm;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1300,14 +1300,10 @@
|
||||
支付单表
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.Admin.Controllers.CoreCmsBillPaymentsController.#ctor(Microsoft.AspNetCore.Hosting.IWebHostEnvironment,CoreCms.Net.IServices.ICoreCmsBillPaymentsServices,Essensoft.Paylink.WeChatPay.V2.IWeChatPayClient,Microsoft.Extensions.Options.IOptions{Essensoft.Paylink.WeChatPay.WeChatPayOptions})">
|
||||
<member name="M:CoreCms.Net.Web.Admin.Controllers.CoreCmsBillPaymentsController.#ctor(Microsoft.AspNetCore.Hosting.IWebHostEnvironment,CoreCms.Net.IServices.ICoreCmsBillPaymentsServices,Essensoft.Paylink.WeChatPay.V2.IWeChatPayClient,CoreCms.Net.IServices.IWeChatPayConfigServices,CoreCms.Net.IServices.IAlipayConfigServices,Essensoft.Paylink.Alipay.IAlipayClient)">
|
||||
<summary>
|
||||
构造函数
|
||||
</summary>
|
||||
<param name="webHostEnvironment"></param>
|
||||
<param name="coreCmsBillPaymentsServices"></param>
|
||||
<param name="client"></param>
|
||||
<param name="optionsAccessor"></param>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.Admin.Controllers.CoreCmsBillPaymentsController.GetPageList">
|
||||
<summary>
|
||||
@@ -2727,6 +2723,160 @@
|
||||
<param name="entity"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:CoreCms.Net.Web.Admin.Controllers.CoreCmsAlipayConfigController">
|
||||
<summary>
|
||||
支付宝支付配置
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.Admin.Controllers.CoreCmsAlipayConfigController.#ctor(Microsoft.AspNetCore.Hosting.IWebHostEnvironment,CoreCms.Net.IServices.IAlipayConfigServices)">
|
||||
<summary>
|
||||
构造函数
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.Admin.Controllers.CoreCmsAlipayConfigController.GetPageList">
|
||||
<summary>
|
||||
获取列表
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.Admin.Controllers.CoreCmsAlipayConfigController.GetIndex">
|
||||
<summary>
|
||||
首页数据
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.Admin.Controllers.CoreCmsAlipayConfigController.GetCreate">
|
||||
<summary>
|
||||
创建数据
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.Admin.Controllers.CoreCmsAlipayConfigController.DoCreate(CoreCms.Net.Model.Entities.CoreCmsAlipayConfig)">
|
||||
<summary>
|
||||
创建提交
|
||||
</summary>
|
||||
<param name="entity"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.Admin.Controllers.CoreCmsAlipayConfigController.GetEdit(CoreCms.Net.Model.FromBody.FMIntId)">
|
||||
<summary>
|
||||
编辑数据
|
||||
</summary>
|
||||
<param name="entity"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.Admin.Controllers.CoreCmsAlipayConfigController.DoEdit(CoreCms.Net.Model.Entities.CoreCmsAlipayConfig)">
|
||||
<summary>
|
||||
编辑提交
|
||||
</summary>
|
||||
<param name="entity"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.Admin.Controllers.CoreCmsAlipayConfigController.DoDelete(CoreCms.Net.Model.FromBody.FMIntId)">
|
||||
<summary>
|
||||
单选删除
|
||||
</summary>
|
||||
<param name="entity"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.Admin.Controllers.CoreCmsAlipayConfigController.GetDetails(CoreCms.Net.Model.FromBody.FMIntId)">
|
||||
<summary>
|
||||
预览数据
|
||||
</summary>
|
||||
<param name="entity"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.Admin.Controllers.CoreCmsAlipayConfigController.DoSetisEnable(CoreCms.Net.Model.FromBody.FMUpdateBoolDataByIntId)">
|
||||
<summary>
|
||||
设置是否启用
|
||||
</summary>
|
||||
<param name="entity"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.Admin.Controllers.CoreCmsAlipayConfigController.DoSetisDefault(CoreCms.Net.Model.FromBody.FMUpdateBoolDataByIntId)">
|
||||
<summary>
|
||||
设置当前多端默认
|
||||
</summary>
|
||||
<param name="entity"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:CoreCms.Net.Web.Admin.Controllers.CoreCmsWeChatPayConfigController">
|
||||
<summary>
|
||||
微信支付配置
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.Admin.Controllers.CoreCmsWeChatPayConfigController.#ctor(Microsoft.AspNetCore.Hosting.IWebHostEnvironment,CoreCms.Net.IServices.IWeChatPayConfigServices)">
|
||||
<summary>
|
||||
构造函数
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.Admin.Controllers.CoreCmsWeChatPayConfigController.GetPageList">
|
||||
<summary>
|
||||
获取列表
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.Admin.Controllers.CoreCmsWeChatPayConfigController.GetIndex">
|
||||
<summary>
|
||||
首页数据
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.Admin.Controllers.CoreCmsWeChatPayConfigController.GetCreate">
|
||||
<summary>
|
||||
创建数据
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.Admin.Controllers.CoreCmsWeChatPayConfigController.DoCreate(CoreCms.Net.Model.Entities.CoreCmsWeChatPayConfig)">
|
||||
<summary>
|
||||
创建提交
|
||||
</summary>
|
||||
<param name="entity"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.Admin.Controllers.CoreCmsWeChatPayConfigController.GetEdit(CoreCms.Net.Model.FromBody.FMIntId)">
|
||||
<summary>
|
||||
编辑数据
|
||||
</summary>
|
||||
<param name="entity"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.Admin.Controllers.CoreCmsWeChatPayConfigController.DoEdit(CoreCms.Net.Model.Entities.CoreCmsWeChatPayConfig)">
|
||||
<summary>
|
||||
编辑提交
|
||||
</summary>
|
||||
<param name="entity"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.Admin.Controllers.CoreCmsWeChatPayConfigController.DoDelete(CoreCms.Net.Model.FromBody.FMIntId)">
|
||||
<summary>
|
||||
单选删除
|
||||
</summary>
|
||||
<param name="entity"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.Admin.Controllers.CoreCmsWeChatPayConfigController.GetDetails(CoreCms.Net.Model.FromBody.FMIntId)">
|
||||
<summary>
|
||||
预览数据
|
||||
</summary>
|
||||
<param name="entity"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.Admin.Controllers.CoreCmsWeChatPayConfigController.DoSetisEnable(CoreCms.Net.Model.FromBody.FMUpdateBoolDataByIntId)">
|
||||
<summary>
|
||||
设置是否开启
|
||||
</summary>
|
||||
<param name="entity"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.Admin.Controllers.CoreCmsWeChatPayConfigController.DoSetisDefault(CoreCms.Net.Model.FromBody.FMUpdateBoolDataByIntId)">
|
||||
<summary>
|
||||
设置是否本类默认
|
||||
</summary>
|
||||
<param name="entity"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:CoreCms.Net.Web.Admin.Controllers.CoreCmsPinTuanRecordController">
|
||||
<summary>
|
||||
拼团记录表
|
||||
|
||||
@@ -54,10 +54,6 @@ builder.Services.AddAutoMapper(typeof(AutoMapperConfiguration));
|
||||
builder.Services.AddAlipay();
|
||||
builder.Services.AddWeChatPay();
|
||||
|
||||
// 在 appsettings.json 中 配置选项
|
||||
builder.Services.Configure<WeChatPayOptions>(builder.Configuration.GetSection("WeChatPay"));
|
||||
builder.Services.Configure<AlipayOptions>(builder.Configuration.GetSection("Alipay"));
|
||||
|
||||
//注册自定义微信接口配置文件
|
||||
builder.Services.Configure<CoreCms.Net.WeChat.Service.Options.WeChatOptions>(builder.Configuration.GetSection(nameof(CoreCms.Net.WeChat.Service.Options.WeChatOptions)));
|
||||
|
||||
|
||||
@@ -138,87 +138,6 @@
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
// 微信支付
|
||||
// 更多配置,请查看WeChatPayOptions类
|
||||
"WeChatPay": {
|
||||
// 应用号
|
||||
// 如:微信公众平台AppId、微信开放平台AppId、微信小程序AppId、企业微信CorpId等
|
||||
"AppId": "",
|
||||
// 商户号
|
||||
// 为微信支付商户平台的商户号
|
||||
"MchId": "",
|
||||
// API密钥
|
||||
// 为微信支付商户平台的API密钥,请注意不是APIv3密钥
|
||||
"APIKey": "",
|
||||
// APIv3密钥
|
||||
// 为微信支付商户平台的APIv3密钥,请注意不是API密钥,v3接口必填
|
||||
"APIv3Key": "",
|
||||
// API证书(.p12)
|
||||
// 为微信支付商户平台的API证书(.p12),v3接口必填
|
||||
// 可为证书文件(.p12)路径 / 证书文件(.p12)的base64字符串
|
||||
//以下格式为windows服务器下路径格式,linux下格式为 WxPayCert/apiclient_cert.p12
|
||||
"Certificate": "WxPayCert\\apiclient_cert.p12",
|
||||
// RSA公钥
|
||||
// 目前仅调用"企业付款到银行卡API"时使用,执行本示例中的"获取RSA加密公钥API"即可获取。
|
||||
"RsaPublicKey": "",
|
||||
// 子商户应用号(目前仅调用服务商API时使用,子商户的公众号、移动应用AppId。)
|
||||
"SubAppId": "",
|
||||
// 子商户号(目前仅调用服务商API时使用,子商户的商户号。)
|
||||
"SubMchId": ""
|
||||
},
|
||||
// 支付宝(暂未开通)
|
||||
// 更多配置,请查看AlipayOptions类
|
||||
"Alipay": {
|
||||
// 注意:
|
||||
// 若涉及资金类支出接口(如转账、红包等)接入,必须使用“公钥证书”方式。不涉及到资金类接口,也可以使用“普通公钥”方式进行加签。
|
||||
// 本示例默认的加签方式为“公钥证书”方式,并调用 CertificateExecuteAsync 方法 执行API。
|
||||
// 若使用“普通公钥”方式,除了遵守下方注释的规则外,调用 CertificateExecuteAsync 也需改成 ExecuteAsync。
|
||||
// 支付宝后台密钥/证书官方配置教程:https://opendocs.alipay.com/open/291/105971
|
||||
// 密钥格式:请选择 PKCS1(非JAVA适用),切记 切记 切记
|
||||
// 应用Id
|
||||
// 为支付宝开放平台-APPID
|
||||
"AppId": "",
|
||||
// 支付宝公钥 RSA公钥
|
||||
// 为支付宝开放平台-支付宝公钥
|
||||
// “公钥证书”方式时,留空
|
||||
// “普通公钥”方式时,必填
|
||||
"AlipayPublicKey": "",
|
||||
// 应用私钥 RSA私钥
|
||||
// 为“支付宝开放平台开发助手”所生成的应用私钥
|
||||
"AppPrivateKey": "",
|
||||
// 服务网关地址
|
||||
// 默认为正式环境地址
|
||||
"ServerUrl": "https://openapi.alipay.com/gateway.do",
|
||||
// 签名类型
|
||||
// 支持:RSA2(SHA256WithRSA)、RSA1(SHA1WithRSA)
|
||||
// 默认为RSA2
|
||||
"SignType": "RSA2",
|
||||
// 应用公钥证书
|
||||
// 可为证书文件路径 / 证书文件的base64字符串
|
||||
// “公钥证书”方式时,必填
|
||||
// “普通公钥”方式时,留空
|
||||
"AppPublicCert": "",
|
||||
// 支付宝公钥证书
|
||||
// 可为证书文件路径 / 证书文件的base64字符串
|
||||
// “公钥证书”方式时,必填
|
||||
// “普通公钥”方式时,留空
|
||||
"AlipayPublicCert": "",
|
||||
// 支付宝根证书
|
||||
// 可为证书文件路径 / 证书文件的base64字符串
|
||||
// “公钥证书”方式时,必填
|
||||
// “普通公钥”方式时,留空
|
||||
"AlipayRootCert": ""
|
||||
},
|
||||
"PayCallBack": {
|
||||
//微信支付回调
|
||||
"WeChatPayUrl": "https://api.test.pro.coreshop.cn/Notify/WeChatPay/Unifiedorder",
|
||||
//微信退款回调
|
||||
"WeChatRefundUrl": "https://api.test.pro.coreshop.cn/Notify/WeChatPay/Refund",
|
||||
//支付宝支付回调
|
||||
"AlipayUrl": "https://api.test.pro.coreshop.cn/Notify/AliPay/Unifiedorder",
|
||||
//支付宝退款回调
|
||||
"AlipayRefundUrl": ""
|
||||
},
|
||||
"WeChatOptions": {
|
||||
//公众号
|
||||
"WeiXinAppId": "",
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
</script>
|
||||
<script type="text/html" id="LAY-app-CoreCmsBillPayments-tableBox-bar">
|
||||
<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">查看</a>
|
||||
{{# if(d.paymentCode == 'wechatpay' && d.status !=2){ }}
|
||||
{{# if((d.paymentCode == 'wechatpay' || d.paymentCode == 'alipay') && d.status !=2){ }}
|
||||
<a class="layui-btn layui-btn-xs" lay-event="doRefresh">刷新</a>
|
||||
{{# } }}
|
||||
</script>
|
||||
@@ -224,6 +224,7 @@
|
||||
//执行刷新操作
|
||||
function doRefresh(obj) {
|
||||
coreHelper.Post("Api/CoreCmsBillPayments/doRefresh", { id: obj.data.paymentId }, function (e) {
|
||||
table.reloadData('LAY-app-CoreCmsBillPayments-tableBox');
|
||||
layer.msg(e.msg);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,240 @@
|
||||
<script type="text/html" template lay-done="layui.data.done(d);">
|
||||
<div class="layui-form coreshop-form layui-form-pane" lay-filter="LAY-app-CoreCmsAlipayConfig-createForm" id="LAY-app-CoreCmsAlipayConfig-createForm">
|
||||
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="appType" class="layui-form-label layui-form-required">应用类型</label>
|
||||
<div class="layui-input-inline layui-inline-5">
|
||||
<select name="appType" lay-verify="required" placeholder="请输入应用类型" lay-reqText="请输入应用类型">
|
||||
<option value="">请选择所属应用类型</option>
|
||||
{{# layui.each(d.params.data.aliPayPayTradeType, function(index, item){ }}
|
||||
<option value="{{ item.title }}">{{ item.description }}</option>
|
||||
{{# }); }}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="appId" class="layui-form-label layui-form-required">开放平台AppId</label>
|
||||
<div class="layui-input-inline layui-inline-5">
|
||||
<input name="appId" lay-verType="tips" lay-verify="required" class="layui-input" placeholder="请输入支付宝开放平台AppId" lay-reqText="请输入支付宝开放平台AppId" />
|
||||
</div>
|
||||
<div class="layui-form-mid">
|
||||
开放平台申请的应用的AppId
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label for="publicKey" class="layui-form-label layui-form-required">支付宝公钥</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="publicKey" id="publicKeyBox" lay-verify="required" placeholder="请输入支付宝公钥" lay-reqText="请输入支付宝公钥" class="layui-textarea"></textarea>
|
||||
</div>
|
||||
<div class="layui-form-mid">
|
||||
为支付宝开放平台-支付宝公钥,支付宝支付配置为“公钥证书”方式时,留空;“普通公钥”方式时,必填。
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label for="privateKey" class="layui-form-label layui-form-required">应用私钥</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="privateKey" id="privateKeyBox" lay-verify="required" placeholder="请输入应用私钥" lay-reqText="请输入应用私钥" class="layui-textarea"></textarea>
|
||||
</div>
|
||||
<div class="layui-form-mid">
|
||||
为“支付宝开放平台开发助手”所生成的应用私钥,请选择 PKCS1(非JAVA适用),切记 切记 切记
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="serverUrl" class="layui-form-label layui-form-required">服务网关地址</label>
|
||||
<div class="layui-input-inline layui-inline-8">
|
||||
<input name="serverUrl" lay-verType="tips" lay-verify="required" class="layui-input" placeholder="请输入服务网关地址" lay-reqText="请输入服务网关地址" value="https://openapi.alipay.com/gateway.do" />
|
||||
</div>
|
||||
<div class="layui-form-mid">
|
||||
默认为正式环境地址
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="signType" class="layui-form-label layui-form-required">签名类型</label>
|
||||
<div class="layui-input-inline layui-inline-8">
|
||||
<select name="signType" lay-verify="required" placeholder="请输入签名类型" lay-reqText="请输入签名类型">
|
||||
<option value="RSA2">RSA2(SHA256WithRSA)</option>
|
||||
<option value="RSA1">RSA1(SHA1WithRSA)</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="layui-form-mid">
|
||||
支持:RSA2(SHA256WithRSA)、RSA1(SHA1WithRSA),默认为RSA2
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label for="appPublicCert" class="layui-form-label">
|
||||
应用公钥证书(证书文件的base64字符串)
|
||||
<button type="button" class="layui-btn layui-btn-xs layui-btn-danger" id="doUploadAppPublicCert">
|
||||
<i class="layui-icon"></i>上传证书
|
||||
</button>
|
||||
</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="appPublicCert" id="appPublicCertBox" placeholder="请输入应用公钥证书" lay-reqText="请输入应用公钥证书" class="layui-textarea"></textarea>
|
||||
</div>
|
||||
<div class="layui-form-mid">
|
||||
证书文件的base64字符串,支付宝支付配置为“公钥证书”方式时,必填;“普通公钥”方式时,留空。
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label for="alipayPublicCert" class="layui-form-label">
|
||||
支付宝公钥证书(证书文件的base64字符串)
|
||||
<button type="button" class="layui-btn layui-btn-xs layui-btn-danger" id="doUploadAlipayPublicCert">
|
||||
<i class="layui-icon"></i>上传证书
|
||||
</button>
|
||||
</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="alipayPublicCert" id="alipayPublicCertBox" placeholder="请输入支付宝公钥证书" lay-reqText="请输入支付宝公钥证书" class="layui-textarea"></textarea>
|
||||
</div>
|
||||
<div class="layui-form-mid">
|
||||
证书文件的base64字符串,支付宝支付配置为“公钥证书”方式时,必填;“普通公钥”方式时,留空。
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label for="alipayRootCert" class="layui-form-label">
|
||||
支付宝根证书(证书文件的base64字符串)
|
||||
<button type="button" class="layui-btn layui-btn-xs layui-btn-danger" id="doUploadAlipayRootCert">
|
||||
<i class="layui-icon"></i>上传证书
|
||||
</button>
|
||||
</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="alipayRootCert" id="alipayRootCertBox" placeholder="请输入支付宝根证书" lay-reqText="请输入支付宝根证书" class="layui-textarea"></textarea>
|
||||
</div>
|
||||
<div class="layui-form-mid">
|
||||
证书文件的base64字符串,支付宝支付配置为“公钥证书”方式时,必填;“普通公钥”方式时,留空。
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="notifyUrl" class="layui-form-label layui-form-required">支付通知地址</label>
|
||||
<div class="layui-input-inline layui-inline-8">
|
||||
<input name="notifyUrl" lay-verType="tips" lay-verify="required" class="layui-input" placeholder="请输入支付宝支付回调通知" lay-reqText="请输入支付宝支付回调通知" value="https://api.pro.demo.corecms.cn/Notify/AliPay/Unifiedorder" />
|
||||
</div>
|
||||
<div class="layui-form-mid">
|
||||
接口地址+【/Notify/AliPay/Unifiedorder】
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="refundUrl" class="layui-form-label layui-form-required">退款回调地址</label>
|
||||
<div class="layui-input-inline layui-inline-8">
|
||||
<input name="refundUrl" lay-verType="tips" lay-verify="required" class="layui-input" placeholder="请输入支付宝退款回调" lay-reqText="请输入支付宝退款回调" value="https://api.pro.demo.corecms.cn/Notify/AliPay/Refund" />
|
||||
</div>
|
||||
<div class="layui-form-mid">
|
||||
接口地址+【/Notify/AliPay/Refund】
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="jumpUrl" class="layui-form-label">支付后跳转地址</label>
|
||||
<div class="layui-input-inline layui-inline-8">
|
||||
<input name="jumpUrl" lay-verType="tips" class="layui-input" placeholder="请输入支付跳转地址" lay-reqText="请输入支付跳转地址" value="https://pc.pro.demo.corecms.cn/order/payment/result" />
|
||||
</div>
|
||||
<div class="layui-form-mid">
|
||||
一般只有h5和pc端有,接口地址+【/order/payment/result】
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item" pane>
|
||||
<label for="isEnable" class="layui-form-label layui-form-required">是否启用</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" lay-filter="switch" name="isEnable" lay-skin="switch" lay-text="开启|关闭">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item" pane>
|
||||
<label for="isDefault" class="layui-form-label layui-form-required">当前多端默认</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" lay-filter="switch" name="isDefault" lay-skin="switch" lay-text="开启|关闭">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item text-right core-hidden">
|
||||
<input type="button" class="layui-btn" lay-submit lay-filter="LAY-app-CoreCmsAlipayConfig-createForm-submit" id="LAY-app-CoreCmsAlipayConfig-createForm-submit" value="确认添加">
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
<script>
|
||||
var debug = layui.setter.debug;
|
||||
layui.data.done = function (d) {
|
||||
//开启调试情况下获取接口赋值数据
|
||||
if (debug) { console.log(d.params.data); }
|
||||
layui.use(['admin', 'form', 'laydate', 'upload', 'coreHelper', 'cropperImg'],
|
||||
function () {
|
||||
var $ = layui.$
|
||||
, form = layui.form
|
||||
, admin = layui.admin
|
||||
, laydate = layui.laydate
|
||||
, upload = layui.upload
|
||||
, cropperImg = layui.cropperImg
|
||||
, coreHelper = layui.coreHelper;
|
||||
|
||||
|
||||
var upload = layui.upload;
|
||||
|
||||
//执行实例
|
||||
upload.render({
|
||||
elem: '#doUploadAppPublicCert' //绑定元素
|
||||
, auto: false
|
||||
, accept: 'file'
|
||||
, exts: 'p12'
|
||||
, choose: function (obj) {
|
||||
obj.preview(function (index, file, result) {
|
||||
var base64 = result.substring(result.indexOf(',') + 1)
|
||||
$('#appPublicCertBox').val(base64);
|
||||
form.render(null, 'LAY-app-CoreCmsAlipayConfig-createForm');
|
||||
});
|
||||
}, error: function () {
|
||||
//请求异常回调
|
||||
}
|
||||
});
|
||||
|
||||
upload.render({
|
||||
elem: '#doUploadAlipayPublicCert' //绑定元素
|
||||
, auto: false
|
||||
, accept: 'file'
|
||||
, exts: 'p12'
|
||||
, choose: function (obj) {
|
||||
obj.preview(function (index, file, result) {
|
||||
var base64 = result.substring(result.indexOf(',') + 1)
|
||||
$('#alipayPublicCertBox').val(base64);
|
||||
form.render(null, 'LAY-app-CoreCmsAlipayConfig-createForm');
|
||||
});
|
||||
}, error: function () {
|
||||
//请求异常回调
|
||||
}
|
||||
});
|
||||
|
||||
upload.render({
|
||||
elem: '#doUploadAlipayRootCert' //绑定元素
|
||||
, auto: false
|
||||
, accept: 'file'
|
||||
, exts: 'p12'
|
||||
, choose: function (obj) {
|
||||
obj.preview(function (index, file, result) {
|
||||
var base64 = result.substring(result.indexOf(',') + 1)
|
||||
$('#alipayRootCertBox').val(base64);
|
||||
form.render(null, 'LAY-app-CoreCmsAlipayConfig-createForm');
|
||||
});
|
||||
}, error: function () {
|
||||
//请求异常回调
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
form.verify({
|
||||
|
||||
});
|
||||
//重载form
|
||||
form.render(null, 'LAY-app-CoreCmsAlipayConfig-createForm');
|
||||
})
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,153 @@
|
||||
<script type="text/html" template lay-done="layui.data.done(d);">
|
||||
<table class="layui-table layui-form" lay-filter="LAY-app-CoreCmsAlipayConfig-detailsForm" id="LAY-app-CoreCmsAlipayConfig-detailsForm">
|
||||
<colgroup>
|
||||
<col width="150">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="appId">支付宝开放平台AppId</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.appId || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="publicKey">支付宝公钥</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.publicKey || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="privateKey">应用私钥</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.privateKey || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="serverUrl">服务网关地址</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.serverUrl || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="signType">签名类型</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.signType || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="appPublicCert">应用公钥证书</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.appPublicCert || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="alipayPublicCert">支付宝公钥证书</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.alipayPublicCert || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="alipayRootCert">支付宝根证书</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.alipayRootCert || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="appType">应用类型</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.appType || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="notifyUrl">支付宝支付回调通知</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.notifyUrl || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="refundUrl">支付宝退款回调</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.refundUrl || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="jumpUrl">支付跳转地址</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.jumpUrl || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="isEnable">是否启用</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="checkbox" disabled name="isEnable" value="{{d.params.data.isEnable}}" lay-skin="switch" lay-text="开启|关闭" lay-filter="isEnable" {{ d.params.data.isEnable ? 'checked' : '' }}>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="isDefault">当前多端默认</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="checkbox" disabled name="isDefault" value="{{d.params.data.isDefault}}" lay-skin="switch" lay-text="开启|关闭" lay-filter="isDefault" {{ d.params.data.isDefault ? 'checked' : '' }}>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</script>
|
||||
<script>
|
||||
var debug = layui.setter.debug;
|
||||
layui.data.done = function (d) {
|
||||
//开启调试情况下获取接口赋值数据
|
||||
if (debug) { console.log(d.params.data); }
|
||||
|
||||
layui.use(['admin', 'form', 'coreHelper'], function () {
|
||||
var $ = layui.$
|
||||
, setter = layui.setter
|
||||
, admin = layui.admin
|
||||
, coreHelper = layui.coreHelper
|
||||
, form = layui.form;
|
||||
form.render(null, 'LAY-app-CoreCmsAlipayConfig-detailsForm');
|
||||
});
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,241 @@
|
||||
<script type="text/html" template lay-done="layui.data.sendParams(d);">
|
||||
<div class="layui-form coreshop-form layui-form-pane" lay-filter="LAY-app-CoreCmsAlipayConfig-editForm" id="LAY-app-CoreCmsAlipayConfig-editForm">
|
||||
<input type="hidden" name="id" value="{{d.params.data.model.id || '' }}" />
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="appType" class="layui-form-label layui-form-required">应用类型</label>
|
||||
<div class="layui-input-inline layui-inline-5">
|
||||
<select name="appType" lay-verify="required" placeholder="请输入应用类型" lay-reqText="请输入应用类型">
|
||||
<option value="">请选择所属应用类型</option>
|
||||
{{# layui.each(d.params.data.aliPayPayTradeType, function(index, item){ }}
|
||||
<option value="{{ item.title }}" {{item.title===d.params.data.model.appType?'selected="selected"':''}}>{{ item.description }}</option>
|
||||
{{# }); }}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="appId" class="layui-form-label layui-form-required">开放平台AppId</label>
|
||||
<div class="layui-input-inline layui-inline-5">
|
||||
<input name="appId" lay-verify="required" class="layui-input" placeholder="请输入支付宝开放平台AppId" lay-reqText="请输入支付宝开放平台AppId" value="{{d.params.data.model.appId || '' }}" />
|
||||
</div>
|
||||
<div class="layui-form-mid">
|
||||
开放平台申请的应用的AppId
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label for="publicKey" class="layui-form-label layui-form-required">支付宝公钥</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="publicKey" id="publicKeyBox" lay-verify="required" placeholder="请输入支付宝公钥" lay-reqText="请输入支付宝公钥" class="layui-textarea">{{d.params.data.model.publicKey || '' }}</textarea>
|
||||
</div>
|
||||
<div class="layui-form-mid">
|
||||
为支付宝开放平台-支付宝公钥,支付宝支付配置为“公钥证书”方式时,留空;“普通公钥”方式时,必填。
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label for="privateKey" class="layui-form-label layui-form-required">应用私钥</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="privateKey" id="privateKeyBox" lay-verify="required" placeholder="请输入应用私钥" lay-reqText="请输入应用私钥" class="layui-textarea">{{d.params.data.model.privateKey || '' }}</textarea>
|
||||
</div>
|
||||
<div class="layui-form-mid">
|
||||
为“支付宝开放平台开发助手”所生成的应用私钥,请选择 PKCS1(非JAVA适用),切记 切记 切记
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="serverUrl" class="layui-form-label layui-form-required">服务网关地址</label>
|
||||
<div class="layui-input-inline layui-inline-8">
|
||||
<input name="serverUrl" lay-verify="required" class="layui-input" placeholder="请输入服务网关地址" lay-reqText="请输入服务网关地址" value="{{d.params.data.model.serverUrl || '' }}" />
|
||||
</div>
|
||||
<div class="layui-form-mid">
|
||||
默认为正式环境地址
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="signType" class="layui-form-label layui-form-required">签名类型</label>
|
||||
<div class="layui-input-inline layui-inline-8">
|
||||
<select name="signType" lay-verify="required" placeholder="请输入签名类型" lay-reqText="请输入签名类型">
|
||||
<option value="RSA2" {{'RSA2'===d.params.data.model.signType?'selected="selected"':''}}>RSA2(SHA256WithRSA)</option>
|
||||
<option value="RSA1" {{'RSA1'===d.params.data.model.signType?'selected="selected"':''}}>RSA1(SHA1WithRSA)</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="layui-form-mid">
|
||||
支持:RSA2(SHA256WithRSA)、RSA1(SHA1WithRSA),默认为RSA2
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label for="appPublicCert" class="layui-form-label">
|
||||
应用公钥证书(证书文件的base64字符串)
|
||||
<button type="button" class="layui-btn layui-btn-xs layui-btn-danger" id="doUploadAppPublicCert">
|
||||
<i class="layui-icon"></i>上传证书
|
||||
</button>
|
||||
</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="appPublicCert" id="appPublicCertBox" placeholder="请输入应用公钥证书" lay-reqText="请输入应用公钥证书" class="layui-textarea">{{d.params.data.model.appPublicCert || '' }}</textarea>
|
||||
</div>
|
||||
<div class="layui-form-mid">
|
||||
证书文件的base64字符串,支付宝支付配置为“公钥证书”方式时,必填;“普通公钥”方式时,留空。
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label for="alipayPublicCert" class="layui-form-label">
|
||||
支付宝公钥证书(证书文件的base64字符串)
|
||||
<button type="button" class="layui-btn layui-btn-xs layui-btn-danger" id="doUploadAlipayPublicCert">
|
||||
<i class="layui-icon"></i>上传证书
|
||||
</button>
|
||||
</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="alipayPublicCert" id="alipayPublicCertBox" placeholder="请输入支付宝公钥证书" lay-reqText="请输入支付宝公钥证书" class="layui-textarea">{{d.params.data.model.alipayPublicCert || '' }}</textarea>
|
||||
</div>
|
||||
<div class="layui-form-mid">
|
||||
证书文件的base64字符串,支付宝支付配置为“公钥证书”方式时,必填;“普通公钥”方式时,留空。
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label for="alipayRootCert" class="layui-form-label">
|
||||
支付宝根证书(证书文件的base64字符串)
|
||||
<button type="button" class="layui-btn layui-btn-xs layui-btn-danger" id="doUploadAlipayRootCert">
|
||||
<i class="layui-icon"></i>上传证书
|
||||
</button>
|
||||
</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="alipayRootCert" id="alipayRootCertBox" placeholder="请输入支付宝根证书" lay-reqText="请输入支付宝根证书" class="layui-textarea">{{d.params.data.model.alipayRootCert || '' }}</textarea>
|
||||
</div>
|
||||
<div class="layui-form-mid">
|
||||
证书文件的base64字符串,支付宝支付配置为“公钥证书”方式时,必填;“普通公钥”方式时,留空。
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="notifyUrl" class="layui-form-label layui-form-required">支付通知地址</label>
|
||||
<div class="layui-input-inline layui-inline-8">
|
||||
<input name="notifyUrl" lay-verType="tips" lay-verify="required" class="layui-input" placeholder="请输入支付宝支付回调通知" lay-reqText="请输入支付宝支付回调通知" value="{{d.params.data.model.notifyUrl || '' }}" />
|
||||
</div>
|
||||
<div class="layui-form-mid">
|
||||
接口地址+【/Notify/AliPay/Unifiedorder】
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="refundUrl" class="layui-form-label layui-form-required">退款回调地址</label>
|
||||
<div class="layui-input-inline layui-inline-8">
|
||||
<input name="refundUrl" lay-verType="tips" lay-verify="required" class="layui-input" placeholder="请输入支付宝退款回调" lay-reqText="请输入支付宝退款回调" value="{{d.params.data.model.refundUrl || '' }}" />
|
||||
</div>
|
||||
<div class="layui-form-mid">
|
||||
接口地址+【/Notify/AliPay/Refund】
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="jumpUrl" class="layui-form-label">支付后跳转地址</label>
|
||||
<div class="layui-input-inline layui-inline-8">
|
||||
<input name="jumpUrl" lay-verType="tips" class="layui-input" placeholder="请输入支付跳转地址" lay-reqText="请输入支付跳转地址" value="{{d.params.data.model.jumpUrl || '' }}" />
|
||||
</div>
|
||||
<div class="layui-form-mid">
|
||||
一般只有h5和pc端有,接口地址+【/order/payment/result】
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="isEnable" class="layui-form-label layui-form-required">是否启用</label>
|
||||
<div class="layui-input-inline layui-inline-4">
|
||||
<input type="checkbox" lay-filter="switch" name="isEnable" {{ d.params.data.model.isEnable ? 'checked' : '' }} lay-skin="switch" lay-text="开启|关闭">
|
||||
</div>
|
||||
<label for="isDefault" class="layui-form-label layui-form-required">当前多端默认</label>
|
||||
<div class="layui-input-inline layui-inline-4">
|
||||
<input type="checkbox" lay-filter="switch" name="isDefault" {{ d.params.data.model.isDefault ? 'checked' : '' }} lay-skin="switch" lay-text="开启|关闭">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item text-right core-hidden">
|
||||
<input type="button" class="layui-btn" lay-submit lay-filter="LAY-app-CoreCmsAlipayConfig-editForm-submit" id="LAY-app-CoreCmsAlipayConfig-editForm-submit" value="确认编辑">
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
<script>
|
||||
var debug = layui.setter.debug;
|
||||
layui.data.sendParams = function (d) {
|
||||
//开启调试情况下获取接口赋值数据
|
||||
if (debug) { console.log(d.params.data); }
|
||||
layui.use(['admin', 'form', 'laydate', 'upload', 'coreHelper', 'cropperImg'],
|
||||
function () {
|
||||
var $ = layui.$
|
||||
, form = layui.form
|
||||
, admin = layui.admin
|
||||
, laydate = layui.laydate
|
||||
, upload = layui.upload
|
||||
, cropperImg = layui.cropperImg
|
||||
, coreHelper = layui.coreHelper;
|
||||
|
||||
|
||||
|
||||
var upload = layui.upload;
|
||||
|
||||
//执行实例
|
||||
upload.render({
|
||||
elem: '#doUploadAppPublicCert' //绑定元素
|
||||
, auto: false
|
||||
, accept: 'file'
|
||||
, exts: 'p12'
|
||||
, choose: function (obj) {
|
||||
obj.preview(function (index, file, result) {
|
||||
var base64 = result.substring(result.indexOf(',') + 1)
|
||||
$('#appPublicCertBox').val(base64);
|
||||
form.render(null, 'LAY-app-CoreCmsAlipayConfig-editForm');
|
||||
});
|
||||
}, error: function () {
|
||||
//请求异常回调
|
||||
}
|
||||
});
|
||||
|
||||
upload.render({
|
||||
elem: '#doUploadAlipayPublicCert' //绑定元素
|
||||
, auto: false
|
||||
, accept: 'file'
|
||||
, exts: 'p12'
|
||||
, choose: function (obj) {
|
||||
obj.preview(function (index, file, result) {
|
||||
var base64 = result.substring(result.indexOf(',') + 1)
|
||||
$('#alipayPublicCertBox').val(base64);
|
||||
form.render(null, 'LAY-app-CoreCmsAlipayConfig-editForm');
|
||||
});
|
||||
}, error: function () {
|
||||
//请求异常回调
|
||||
}
|
||||
});
|
||||
|
||||
upload.render({
|
||||
elem: '#doUploadAlipayRootCert' //绑定元素
|
||||
, auto: false
|
||||
, accept: 'file'
|
||||
, exts: 'p12'
|
||||
, choose: function (obj) {
|
||||
obj.preview(function (index, file, result) {
|
||||
var base64 = result.substring(result.indexOf(',') + 1)
|
||||
$('#alipayRootCertBox').val(base64);
|
||||
form.render(null, 'LAY-app-CoreCmsAlipayConfig-editForm');
|
||||
});
|
||||
}, error: function () {
|
||||
//请求异常回调
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
form.verify({
|
||||
|
||||
});
|
||||
//重载form
|
||||
form.render(null, 'LAY-app-CoreCmsAlipayConfig-editForm');
|
||||
})
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,365 @@
|
||||
<title>支付宝支付配置</title>
|
||||
<!--当前位置开始-->
|
||||
<div class="layui-card layadmin-header">
|
||||
<div class="layui-breadcrumb" lay-filter="breadcrumb">
|
||||
<script type="text/html" template lay-done="layui.data.updateMainBreadcrumb();">
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
<!--当前位置结束-->
|
||||
<style>
|
||||
/* 重写样式 */
|
||||
</style>
|
||||
<script type="text/html" template lay-type="Post" lay-url="Api/CoreCmsAlipayConfig/GetIndex" lay-done="layui.data.done(d);">
|
||||
|
||||
</script>
|
||||
<div class="table-body">
|
||||
<table id="LAY-app-CoreCmsAlipayConfig-tableBox" lay-filter="LAY-app-CoreCmsAlipayConfig-tableBox"></table>
|
||||
</div>
|
||||
|
||||
<script type="text/html" id="LAY-app-CoreCmsAlipayConfig-toolbar">
|
||||
<div class="layui-form coreshop-toolbar-search-form">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label" for="appId">支付宝AppId</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="appId" placeholder="请输入支付宝开放平台AppId" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label" for="appType">应用类型</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="appType" placeholder="请输入应用类型" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label" for="isEnable">是否启用</label>
|
||||
<div class="layui-input-inline">
|
||||
<select name="isEnable">
|
||||
<option value="">请选择</option>
|
||||
<option value="True">是</option>
|
||||
<option value="False">否</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label" for="isDefault">当前多端默认</label>
|
||||
<div class="layui-input-inline">
|
||||
<select name="isDefault">
|
||||
<option value="">请选择</option>
|
||||
<option value="True">是</option>
|
||||
<option value="False">否</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label" for="appType">应用类型</label>
|
||||
<div class="layui-input-inline">
|
||||
<select name="appType">
|
||||
<option value="">请选择应用类型</option>
|
||||
{{# layui.each(indexData.aliPayPayTradeType, function(index, item){ }}
|
||||
<option value="{{ item.title }}">{{ item.description }}</option>
|
||||
{{# }); }}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<button class="layui-btn layui-btn-sm" lay-submit lay-filter="LAY-app-CoreCmsAlipayConfig-search"><i class="layui-icon layui-icon-search"></i>筛选</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="LAY-app-CoreCmsAlipayConfig-pagebar">
|
||||
<div class="layui-btn-container">
|
||||
<button class="layui-btn layui-btn-sm" lay-event="addData"><i class="layui-icon layui-icon-add-1"></i>添加数据</button>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="LAY-app-CoreCmsAlipayConfig-tableBox-bar">
|
||||
<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">查看</a>
|
||||
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
|
||||
<a class="layui-btn layui-btn-danger layui-btn-xs" data-dropdown="#CoreCmsAlipayConfigTbDelDrop{{d.LAY_INDEX}}" no-shade="true">删除</a>
|
||||
<div class="dropdown-menu-nav dropdown-popconfirm dropdown-top-right layui-hide" id="CoreCmsAlipayConfigTbDelDrop{{d.LAY_INDEX}}"
|
||||
style="max-width: 200px;white-space: normal;min-width: auto;margin-left: 10px;">
|
||||
<div class="dropdown-anchor"></div>
|
||||
<div class="dropdown-popconfirm-title">
|
||||
<i class="layui-icon layui-icon-help"></i>
|
||||
确定要删除吗?
|
||||
</div>
|
||||
<div class="dropdown-popconfirm-btn">
|
||||
<a class="layui-btn layui-btn-primary cursor" btn-cancel>取消</a>
|
||||
<a class="layui-btn layui-btn-normal cursor" lay-event="del">确定</a>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var indexData;
|
||||
var debug = layui.setter.debug;
|
||||
layui.data.done = function (d) {
|
||||
//开启调试情况下获取接口赋值数据
|
||||
if (debug) { console.log(d); }
|
||||
|
||||
indexData = d.data;
|
||||
layui.use(['index', 'table', 'laydate', 'util', 'coredropdown', 'coreHelper'],
|
||||
function () {
|
||||
var $ = layui.$
|
||||
, admin = layui.admin
|
||||
, table = layui.table
|
||||
, form = layui.form
|
||||
, laydate = layui.laydate
|
||||
, setter = layui.setter
|
||||
, coreHelper = layui.coreHelper
|
||||
, util = layui.util
|
||||
, view = layui.view;
|
||||
|
||||
var searchwhere;
|
||||
//监听搜索
|
||||
form.on('submit(LAY-app-CoreCmsAlipayConfig-search)',
|
||||
function (data) {
|
||||
var field = data.field;
|
||||
searchwhere = field;
|
||||
//执行重载
|
||||
table.reloadData('LAY-app-CoreCmsAlipayConfig-tableBox', { where: field });
|
||||
});
|
||||
//数据绑定
|
||||
table.render({
|
||||
elem: '#LAY-app-CoreCmsAlipayConfig-tableBox',
|
||||
url: layui.setter.apiUrl + 'Api/CoreCmsAlipayConfig/GetPageList',
|
||||
method: 'POST',
|
||||
toolbar: '#LAY-app-CoreCmsAlipayConfig-toolbar',
|
||||
pagebar: '#LAY-app-CoreCmsAlipayConfig-pagebar',
|
||||
className: 'pagebarbox',
|
||||
defaultToolbar: ['filter', 'print', 'exports'],
|
||||
height: 'full-127',//面包屑142px,搜索框4行172,3行137,2行102,1行67
|
||||
page: true,
|
||||
limit: 30,
|
||||
limits: [10, 15, 20, 25, 30, 50, 100, 200],
|
||||
text: { none: '暂无相关数据' },
|
||||
cols: [
|
||||
[
|
||||
{ type: "checkbox", fixed: "left" },
|
||||
{ field: 'id', title: '序列', width: 60, sort: false },
|
||||
{ field: 'appId', title: '支付宝开放平台AppId', sort: false, width: 135 },
|
||||
{ field: 'publicKey', title: '支付宝公钥', sort: false, width: 105 },
|
||||
{ field: 'privateKey', title: '应用私钥', sort: false, width: 105 },
|
||||
{ field: 'serverUrl', title: '服务网关地址', sort: false, width: 155 },
|
||||
{ field: 'signType', title: '签名类型', sort: false, width: 65 },
|
||||
{ field: 'appPublicCert', title: '应用公钥证书', sort: false, width: 105 },
|
||||
{ field: 'alipayPublicCert', title: '支付宝公钥证书', sort: false, width: 105 },
|
||||
{ field: 'alipayRootCert', title: '支付宝根证书', sort: false, width: 105 },
|
||||
//{ field: 'appType', title: '应用类型', sort: false, width: 105 },
|
||||
{ field: 'notifyUrl', title: '支付宝支付回调通知', sort: false },
|
||||
{ field: 'refundUrl', title: '支付宝退款回调', sort: false },
|
||||
{ field: 'jumpUrl', title: '支付跳转地址', sort: false },
|
||||
{
|
||||
field: 'appType', title: '应用类型', sort: false, width: 200, templet: function (data) {
|
||||
for (var i = 0; i < d.data.aliPayPayTradeType.length; i++) {
|
||||
if (d.data.aliPayPayTradeType[i].title === data.appType) {
|
||||
return d.data.aliPayPayTradeType[i].description + '【' + data.appType + '】';
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
},
|
||||
{ field: 'isEnable', title: '是否启用', width: 95, templet: '#switch_isEnable', sort: false, unresize: true },
|
||||
{ field: 'isDefault', title: '当前多端默认', width: 95, templet: '#switch_isDefault', sort: false, unresize: true },
|
||||
{ width: 162, align: 'center', title: '操作', fixed: 'right', toolbar: '#LAY-app-CoreCmsAlipayConfig-tableBox-bar' }
|
||||
]
|
||||
]
|
||||
});
|
||||
//监听排序事件
|
||||
table.on('sort(LAY-app-CoreCmsAlipayConfig-tableBox)', function (obj) {
|
||||
table.reloadData('LAY-app-CoreCmsAlipayConfig-tableBox', {
|
||||
initSort: obj, //记录初始排序,如果不设的话,将无法标记表头的排序状态。
|
||||
where: { //请求参数(注意:这里面的参数可任意定义,并非下面固定的格式)
|
||||
orderField: obj.field, //排序字段
|
||||
orderDirection: obj.type //排序方式
|
||||
}
|
||||
});
|
||||
});
|
||||
//监听行双击事件
|
||||
table.on('rowDouble(LAY-app-CoreCmsAlipayConfig-tableBox)', function (obj) {
|
||||
//查看详情
|
||||
doDetails(obj);
|
||||
});
|
||||
//头工具栏事件
|
||||
table.on('pagebar(LAY-app-CoreCmsAlipayConfig-tableBox)', function (obj) {
|
||||
var checkStatus = table.checkStatus(obj.config.id);
|
||||
switch (obj.event) {
|
||||
case 'addData':
|
||||
doCreate();
|
||||
break;
|
||||
};
|
||||
});
|
||||
//监听工具条
|
||||
table.on('tool(LAY-app-CoreCmsAlipayConfig-tableBox)',
|
||||
function (obj) {
|
||||
if (obj.event === 'detail') {
|
||||
doDetails(obj);
|
||||
} else if (obj.event === 'del') {
|
||||
doDelete(obj);
|
||||
} else if (obj.event === 'edit') {
|
||||
doEdit(obj)
|
||||
}
|
||||
});
|
||||
//执行创建操作
|
||||
function doCreate() {
|
||||
coreHelper.Post("Api/CoreCmsAlipayConfig/GetCreate", null, function (e) {
|
||||
if (e.code === 0) {
|
||||
admin.popup({
|
||||
shadeClose: false,
|
||||
title: '创建数据',
|
||||
area: ['1200px', '90%'],
|
||||
id: 'LAY-popup-CoreCmsAlipayConfig-create',
|
||||
success: function (layero, index) {
|
||||
view(this.id).render('shop/pay/alipayconfig/create', { data: e.data }).done(function () {
|
||||
//监听提交
|
||||
form.on('submit(LAY-app-CoreCmsAlipayConfig-createForm-submit)',
|
||||
function (data) {
|
||||
var field = data.field; //获取提交的字段
|
||||
|
||||
field.isEnable = field.isEnable == 'on';
|
||||
field.isDefault = field.isDefault == 'on';
|
||||
|
||||
if (debug) { console.log(field); } //开启调试返回数据
|
||||
//提交 Ajax 成功后,关闭当前弹层并重载表格
|
||||
coreHelper.Post("Api/CoreCmsAlipayConfig/DoCreate", field, function (e) {
|
||||
console.log(e)
|
||||
if (e.code === 0) {
|
||||
layui.table.reloadData('LAY-app-CoreCmsAlipayConfig-tableBox'); //重载表格
|
||||
layer.close(index); //再执行关闭
|
||||
layer.msg(e.msg);
|
||||
} else {
|
||||
layer.msg(e.msg);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
// 禁止弹窗出现滚动条
|
||||
//$(layero).children('.layui-layer-content').css('overflow', 'visible');
|
||||
}
|
||||
, btn: ['确定', '取消']
|
||||
, yes: function (index, layero) {
|
||||
layero.contents().find("#LAY-app-CoreCmsAlipayConfig-createForm-submit").click();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
layer.msg(e.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
//执行编辑操作
|
||||
function doEdit(obj) {
|
||||
coreHelper.Post("Api/CoreCmsAlipayConfig/GetEdit", { id: obj.data.id }, function (e) {
|
||||
if (e.code === 0) {
|
||||
admin.popup({
|
||||
shadeClose: false,
|
||||
title: '编辑数据',
|
||||
area: ['1200px', '90%'],
|
||||
id: 'LAY-popup-CoreCmsAlipayConfig-edit',
|
||||
success: function (layero, index) {
|
||||
view(this.id).render('shop/pay/alipayconfig/edit', { data: e.data }).done(function () {
|
||||
//监听提交
|
||||
form.on('submit(LAY-app-CoreCmsAlipayConfig-editForm-submit)',
|
||||
function (data) {
|
||||
var field = data.field; //获取提交的字段
|
||||
|
||||
field.isEnable = field.isEnable == 'on';
|
||||
field.isDefault = field.isDefault == 'on';
|
||||
|
||||
if (debug) { console.log(field); } //开启调试返回数据
|
||||
//提交 Ajax 成功后,关闭当前弹层并重载表格
|
||||
coreHelper.Post("Api/CoreCmsAlipayConfig/DoEdit", field, function (e) {
|
||||
console.log(e)
|
||||
if (e.code === 0) {
|
||||
layui.table.reloadData('LAY-app-CoreCmsAlipayConfig-tableBox'); //重载表格
|
||||
layer.close(index); //再执行关闭
|
||||
layer.msg(e.msg);
|
||||
} else {
|
||||
layer.msg(e.msg);
|
||||
}
|
||||
});
|
||||
});
|
||||
})
|
||||
// 禁止弹窗出现滚动条
|
||||
//$(layero).children('.layui-layer-content').css('overflow', 'visible');
|
||||
}
|
||||
, btn: ['确定', '取消']
|
||||
, yes: function (index, layero) {
|
||||
layero.contents().find("#LAY-app-CoreCmsAlipayConfig-editForm-submit").click();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
layer.msg(e.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
//执行预览操作
|
||||
function doDetails(obj) {
|
||||
coreHelper.Post("Api/CoreCmsAlipayConfig/GetDetails", { id: obj.data.id }, function (e) {
|
||||
if (e.code === 0) {
|
||||
admin.popup({
|
||||
shadeClose: false,
|
||||
title: '查看详情',
|
||||
area: ['1200px', '90%'],
|
||||
id: 'LAY-popup-CoreCmsAlipayConfig-details',
|
||||
success: function (layero, index) {
|
||||
view(this.id).render('shop/pay/alipayconfig/details', { data: e.data }).done(function () {
|
||||
form.render();
|
||||
});
|
||||
// 禁止弹窗出现滚动条
|
||||
$(layero).children('.layui-layer-content').css('overflow', 'visible');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
layer.msg(e.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
//执行单个删除
|
||||
function doDelete(obj) {
|
||||
coreHelper.Post("Api/CoreCmsAlipayConfig/DoDelete", { id: obj.data.id }, function (e) {
|
||||
if (debug) { console.log(e); } //开启调试返回数据
|
||||
table.reloadData('LAY-app-CoreCmsAlipayConfig-tableBox');
|
||||
layer.msg(e.msg);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//监听 表格复选框操作
|
||||
|
||||
layui.form.on('switch(switch_isEnable)', function (obj) {
|
||||
coreHelper.Post("Api/CoreCmsAlipayConfig/DoSetisEnable", { id: this.value, data: obj.elem.checked }, function (e) {
|
||||
if (debug) { console.log(e); } //开启调试返回数据
|
||||
//table.reloadData('LAY-app-CoreCmsAlipayConfig-tableBox');
|
||||
layer.msg(e.msg);
|
||||
});
|
||||
});
|
||||
|
||||
layui.form.on('switch(switch_isDefault)', function (obj) {
|
||||
coreHelper.Post("Api/CoreCmsAlipayConfig/DoSetisDefault", { id: this.value, data: obj.elem.checked }, function (e) {
|
||||
if (debug) { console.log(e); } //开启调试返回数据
|
||||
//table.reloadData('LAY-app-CoreCmsAlipayConfig-tableBox');
|
||||
layer.msg(e.msg);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
//重载form
|
||||
form.render();
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<!--设置是否启用-->
|
||||
<script type="text/html" id="switch_isEnable">
|
||||
<input type="checkbox" name="switch_isEnable" value="{{d.id}}" lay-skin="switch" lay-text="开启|关闭" lay-filter="switch_isEnable" {{ d.isEnable ? 'checked' : '' }}>
|
||||
</script>
|
||||
|
||||
<!--设置当前多端默认-->
|
||||
<script type="text/html" id="switch_isDefault">
|
||||
<input type="checkbox" name="switch_isDefault" value="{{d.id}}" lay-skin="switch" lay-text="开启|关闭" lay-filter="switch_isDefault" {{ d.isDefault ? 'checked' : '' }}>
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,173 @@
|
||||
<script type="text/html" template lay-done="layui.data.done(d);">
|
||||
<div class="layui-form coreshop-form layui-form-pane" lay-filter="LAY-app-CoreCmsWeChatPayConfig-createForm" id="LAY-app-CoreCmsWeChatPayConfig-createForm">
|
||||
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="appType" class="layui-form-label layui-form-required">应用类型</label>
|
||||
<div class="layui-input-inline layui-inline-5">
|
||||
<select name="appType" lay-verify="required" placeholder="请输入应用类型" lay-reqText="请输入应用类型">
|
||||
<option value="">请选择所属应用类型</option>
|
||||
{{# layui.each(d.params.data.weiChatPayTradeType, function(index, item){ }}
|
||||
<option value="{{ item.title }}">{{ item.description }}</option>
|
||||
{{# }); }}
|
||||
</select>
|
||||
</div>
|
||||
<label for="appId" class="layui-form-label layui-form-required">应用AppID</label>
|
||||
<div class="layui-input-inline layui-inline-5">
|
||||
<input name="appId" lay-verify="required" class="layui-input" placeholder="请输入应用号" lay-reqText="请输入应用号" />
|
||||
</div>
|
||||
<label for="mchId" class="layui-form-label layui-form-required">商户号</label>
|
||||
<div class="layui-input-inline layui-inline-5">
|
||||
<input name="mchId" lay-verify="required" class="layui-input" placeholder="请输入商户号" lay-reqText="请输入商户号" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="apiKey" class="layui-form-label layui-form-required">API秘钥</label>
|
||||
<div class="layui-input-inline layui-inline-12">
|
||||
<input name="apiKey" lay-verify="required" class="layui-input" placeholder="请输入API秘钥" lay-reqText="请输入API秘钥" />
|
||||
</div>
|
||||
<div class="layui-form-mid">
|
||||
apiV2密钥
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="apiV3Key" class="layui-form-label">APIv3密钥</label>
|
||||
<div class="layui-input-inline layui-inline-12">
|
||||
<input name="apiV3Key" readonly="readonly" class="layui-input" placeholder="请输入APIv3密钥" lay-reqText="请输入APIv3密钥" />
|
||||
</div>
|
||||
<div class="layui-form-mid">
|
||||
apiV3未启用
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label for="certificate" class="layui-form-label layui-form-required">
|
||||
微信支付商户p12证书,请选择【apiclient_cert.p12】文件
|
||||
<button type="button" class="layui-btn layui-btn-xs layui-btn-danger" id="doUpload">
|
||||
<i class="layui-icon"></i>上传证书
|
||||
</button>
|
||||
</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="certificate" id="certificateBox" lay-verify="required" placeholder="请选择【apiclient_cert.p12】文件" class="layui-textarea"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="rsaPublicKey" class="layui-form-label">RSA公钥</label>
|
||||
<div class="layui-input-inline layui-inline-8">
|
||||
<input name="rsaPublicKey" class="layui-input" placeholder="请输入RSA公钥" lay-reqText="请输入RSA公钥" />
|
||||
</div>
|
||||
<div class="layui-form-mid">
|
||||
目前仅"企业付款到银行卡API"使用,调用"获取RSA加密公钥API"即可获取
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="subAppId" class="layui-form-label">子商户应用号</label>
|
||||
<div class="layui-input-inline layui-inline-4">
|
||||
<input name="subAppId" class="layui-input" placeholder="请输入子商户应用号" lay-reqText="请输入子商户应用号" />
|
||||
</div>
|
||||
<div class="layui-form-mid">
|
||||
目前仅调用服务商API时使用,子商户的公众号、移动应用AppId。
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label for="subMchId" class="layui-form-label">子商户号</label>
|
||||
<div class="layui-input-inline layui-inline-4">
|
||||
<input name="subMchId" class="layui-input" placeholder="请输入子商户号" lay-reqText="请输入子商户号" />
|
||||
</div>
|
||||
<div class="layui-form-mid">
|
||||
目前仅调用服务商API时使用,子商户的商户号。
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="notifyUrl" class="layui-form-label layui-form-required">支付回调通知</label>
|
||||
<div class="layui-input-inline layui-inline-8">
|
||||
<input name="notifyUrl" lay-verify="required" class="layui-input" placeholder="请输入支付回调通知" lay-reqText="请输入支付回调通知" value="https://api.pro.demo.corecms.cn/Notify/WeChatPay/Unifiedorder" />
|
||||
</div>
|
||||
<div class="layui-form-mid">
|
||||
接口地址+【/Notify/WeChatPay/Unifiedorder】
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="refundUrl" class="layui-form-label layui-form-required">退款回调</label>
|
||||
<div class="layui-input-inline layui-inline-8">
|
||||
<input name="refundUrl" lay-verify="required" class="layui-input" placeholder="请输入退款回调" lay-reqText="请输入退款回调" value="https://api.pro.demo.corecms.cn/Notify/WeChatPay/Refund" />
|
||||
</div>
|
||||
<div class="layui-form-mid">
|
||||
接口地址+【/Notify/WeChatPay/Refund】
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="jumpUrl" class="layui-form-label">跳转地址</label>
|
||||
<div class="layui-input-inline layui-inline-8">
|
||||
<input name="jumpUrl" class="layui-input" placeholder="请输入跳转地址" lay-reqText="请输入跳转地址" />
|
||||
</div>
|
||||
<div class="layui-form-mid">
|
||||
H5,PC端支付成功或者支付失败后跳转的查询支付状态的地址。
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="isEnable" class="layui-form-label layui-form-required">是否开启</label>
|
||||
<div class="layui-input-inline layui-inline-4">
|
||||
<input type="checkbox" lay-filter="switch" name="isEnable" lay-skin="switch" lay-text="开启|关闭">
|
||||
</div>
|
||||
<label for="isDefault" class="layui-form-label layui-form-required">是否本类默认</label>
|
||||
<div class="layui-input-inline layui-inline-4">
|
||||
<input type="checkbox" lay-filter="switch" name="isDefault" lay-skin="switch" lay-text="开启|关闭">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item text-right core-hidden">
|
||||
<input type="button" class="layui-btn" lay-submit lay-filter="LAY-app-CoreCmsWeChatPayConfig-createForm-submit" id="LAY-app-CoreCmsWeChatPayConfig-createForm-submit" value="确认添加">
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
<script>
|
||||
var debug = layui.setter.debug;
|
||||
layui.data.done = function (d) {
|
||||
//开启调试情况下获取接口赋值数据
|
||||
if (debug) { console.log(d.params.data); }
|
||||
layui.use(['admin', 'form', 'laydate', 'upload', 'coreHelper', 'cropperImg'],
|
||||
function () {
|
||||
var $ = layui.$
|
||||
, form = layui.form
|
||||
, admin = layui.admin
|
||||
, laydate = layui.laydate
|
||||
, upload = layui.upload
|
||||
, cropperImg = layui.cropperImg
|
||||
, coreHelper = layui.coreHelper;
|
||||
|
||||
var upload = layui.upload;
|
||||
|
||||
//执行实例
|
||||
upload.render({
|
||||
elem: '#doUpload' //绑定元素
|
||||
, auto: false
|
||||
, accept: 'file'
|
||||
, exts: 'p12'
|
||||
, choose: function (obj) {
|
||||
obj.preview(function (index, file, result) {
|
||||
var base64 = result.substring(result.indexOf(',') + 1)
|
||||
$('#certificateBox').val(base64);
|
||||
form.render(null, 'LAY-app-CoreCmsWeChatPayConfig-createForm');
|
||||
});
|
||||
}, error: function () {
|
||||
//请求异常回调
|
||||
}
|
||||
});
|
||||
|
||||
form.verify({
|
||||
|
||||
});
|
||||
//重载form
|
||||
form.render(null, 'LAY-app-CoreCmsWeChatPayConfig-createForm');
|
||||
})
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,161 @@
|
||||
<script type="text/html" template lay-done="layui.data.done(d);">
|
||||
<table class="layui-table layui-form" lay-filter="LAY-app-CoreCmsWeChatPayConfig-detailsForm" id="LAY-app-CoreCmsWeChatPayConfig-detailsForm">
|
||||
<colgroup>
|
||||
<col width="200">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="id">类型</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.appType || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="appId">应用号</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.appId || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="appId">应用AppId</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.appId || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="mchId">商户号</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.mchId || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="apiKey">API秘钥</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.apiKey || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="apiV3Key">APIv3密钥</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.apiV3Key || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="certificate">p12证书base64</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.certificate || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="rsaPublicKey">RSA公钥</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.rsaPublicKey || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="subAppId">子商户应用号</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.subAppId || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="subMchId">子商户号</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.subMchId || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="notifyUrl">支付回调通知</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.notifyUrl || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="refundUrl">退款回调</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.refundUrl || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="jumpUrl">跳转地址</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.jumpUrl || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="isEnable">是否开启</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="checkbox" disabled name="isEnable" value="{{d.params.data.isEnable}}" lay-skin="switch" lay-text="开启|关闭" lay-filter="isEnable" {{ d.params.data.isEnable ? 'checked' : '' }}>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="isDefault">是否本类默认</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="checkbox" disabled name="isDefault" value="{{d.params.data.isDefault}}" lay-skin="switch" lay-text="开启|关闭" lay-filter="isDefault" {{ d.params.data.isDefault ? 'checked' : '' }}>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</script>
|
||||
<script>
|
||||
var debug = layui.setter.debug;
|
||||
layui.data.done = function (d) {
|
||||
//开启调试情况下获取接口赋值数据
|
||||
if (debug) { console.log(d.params.data); }
|
||||
|
||||
layui.use(['admin', 'form', 'coreHelper'], function () {
|
||||
var $ = layui.$
|
||||
, setter = layui.setter
|
||||
, admin = layui.admin
|
||||
, coreHelper = layui.coreHelper
|
||||
, form = layui.form;
|
||||
form.render(null, 'LAY-app-CoreCmsWeChatPayConfig-detailsForm');
|
||||
});
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,175 @@
|
||||
<script type="text/html" template lay-done="layui.data.sendParams(d);">
|
||||
<div class="layui-form coreshop-form layui-form-pane" lay-filter="LAY-app-CoreCmsWeChatPayConfig-editForm" id="LAY-app-CoreCmsWeChatPayConfig-editForm">
|
||||
<input type="hidden" name="id" value="{{d.params.data.model.id || '' }}" />
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="appType" class="layui-form-label layui-form-required">应用类型</label>
|
||||
<div class="layui-input-inline layui-inline-5">
|
||||
<select name="appType" lay-verify="required" placeholder="请输入应用类型" lay-reqText="请输入应用类型">
|
||||
<option value="">请选择所属应用类型</option>
|
||||
{{# layui.each(d.params.data.weiChatPayTradeType, function(index, item){ }}
|
||||
<option value="{{ item.title }}" {{item.title===d.params.data.model.appType?'selected="selected"':''}}>{{ item.description }}</option>
|
||||
{{# }); }}
|
||||
</select>
|
||||
</div>
|
||||
<label for="appId" class="layui-form-label layui-form-required">应用AppID</label>
|
||||
<div class="layui-input-inline layui-inline-5">
|
||||
<input name="appId" lay-verify="required" class="layui-input" placeholder="请输入应用号" lay-reqText="请输入应用号" value="{{d.params.data.model.appId || '' }}" />
|
||||
</div>
|
||||
<label for="mchId" class="layui-form-label layui-form-required">商户号</label>
|
||||
<div class="layui-input-inline layui-inline-5">
|
||||
<input name="mchId" lay-verify="required" class="layui-input" placeholder="请输入商户号" lay-reqText="请输入商户号" value="{{d.params.data.model.mchId || '' }}" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="apiKey" class="layui-form-label layui-form-required">API秘钥</label>
|
||||
<div class="layui-input-inline layui-inline-12">
|
||||
<input name="apiKey" lay-verify="required" class="layui-input" placeholder="请输入API秘钥" lay-reqText="请输入API秘钥" value="{{d.params.data.model.apiKey || '' }}" />
|
||||
</div>
|
||||
<div class="layui-form-mid">
|
||||
apiV2密钥
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="apiV3Key" class="layui-form-label">APIv3密钥</label>
|
||||
<div class="layui-input-inline layui-inline-12">
|
||||
<input name="apiV3Key" readonly="readonly" class="layui-input" placeholder="请输入APIv3密钥" lay-reqText="请输入APIv3密钥" value="{{d.params.data.model.apiV3Key || '' }}" />
|
||||
</div>
|
||||
<div class="layui-form-mid">
|
||||
apiV3未启用
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label for="certificate" class="layui-form-label layui-form-required">
|
||||
微信支付商户p12证书,请选择【apiclient_cert.p12】文件
|
||||
<button type="button" class="layui-btn layui-btn-xs layui-btn-danger" id="doUpload">
|
||||
<i class="layui-icon"></i>上传证书
|
||||
</button>
|
||||
</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="certificate" id="certificateBox" lay-verify="required" placeholder="请选择【apiclient_cert.p12】文件" class="layui-textarea">{{d.params.data.model.certificate || '' }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="rsaPublicKey" class="layui-form-label">RSA公钥</label>
|
||||
<div class="layui-input-inline layui-inline-8">
|
||||
<input name="rsaPublicKey" class="layui-input" placeholder="请输入RSA公钥" lay-reqText="请输入RSA公钥" value="{{d.params.data.model.rsaPublicKey || '' }}" />
|
||||
</div>
|
||||
<div class="layui-form-mid">
|
||||
目前仅"企业付款到银行卡API"使用,调用"获取RSA加密公钥API"即可获取
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="subAppId" class="layui-form-label">子商户应用号</label>
|
||||
<div class="layui-input-inline layui-inline-4">
|
||||
<input name="subAppId" class="layui-input" placeholder="请输入子商户应用号" lay-reqText="请输入子商户应用号" value="{{d.params.data.model.subAppId || '' }}" />
|
||||
</div>
|
||||
<div class="layui-form-mid">
|
||||
目前仅调用服务商API时使用,子商户的公众号、移动应用AppId。
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label for="subMchId" class="layui-form-label">子商户号</label>
|
||||
<div class="layui-input-inline layui-inline-4">
|
||||
<input name="subMchId" class="layui-input" placeholder="请输入子商户号" lay-reqText="请输入子商户号" value="{{d.params.data.model.subMchId || '' }}" />
|
||||
</div>
|
||||
<div class="layui-form-mid">
|
||||
目前仅调用服务商API时使用,子商户的商户号。
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="notifyUrl" class="layui-form-label layui-form-required">支付回调通知</label>
|
||||
<div class="layui-input-inline layui-inline-8">
|
||||
<input name="notifyUrl" lay-verify="required" class="layui-input" placeholder="请输入支付回调通知" lay-reqText="请输入支付回调通知" value="{{d.params.data.model.notifyUrl || '' }}" />
|
||||
</div>
|
||||
<div class="layui-form-mid">
|
||||
接口地址+【/Notify/WeChatPay/Unifiedorder】
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="refundUrl" class="layui-form-label layui-form-required">退款回调</label>
|
||||
<div class="layui-input-inline layui-inline-8">
|
||||
<input name="refundUrl" lay-verify="required" class="layui-input" placeholder="请输入退款回调" lay-reqText="请输入退款回调" value="{{d.params.data.model.refundUrl || '' }}" />
|
||||
</div>
|
||||
<div class="layui-form-mid">
|
||||
接口地址+【/Notify/WeChatPay/Refund】
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="jumpUrl" class="layui-form-label">跳转地址</label>
|
||||
<div class="layui-input-inline layui-inline-8">
|
||||
<input name="jumpUrl" class="layui-input" placeholder="请输入跳转地址" lay-reqText="请输入跳转地址" value="{{d.params.data.model.jumpUrl || '' }}" />
|
||||
</div>
|
||||
<div class="layui-form-mid">
|
||||
H5,PC端支付成功或者支付失败后跳转的查询支付状态的地址。
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="isEnable" class="layui-form-label layui-form-required">是否开启</label>
|
||||
<div class="layui-input-inline layui-inline-4">
|
||||
<input type="checkbox" lay-filter="switch" name="isEnable" {{ d.params.data.model.isEnable ? 'checked' : '' }} lay-skin="switch" lay-text="开启|关闭">
|
||||
</div>
|
||||
<label for="isDefault" class="layui-form-label layui-form-required">是否本类默认</label>
|
||||
<div class="layui-input-inline layui-inline-4">
|
||||
<input type="checkbox" lay-filter="switch" name="isDefault" {{ d.params.data.model.isDefault ? 'checked' : '' }} lay-skin="switch" lay-text="开启|关闭">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item text-right core-hidden">
|
||||
<input type="button" class="layui-btn" lay-submit lay-filter="LAY-app-CoreCmsWeChatPayConfig-editForm-submit" id="LAY-app-CoreCmsWeChatPayConfig-editForm-submit" value="确认编辑">
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
<script>
|
||||
var debug = layui.setter.debug;
|
||||
layui.data.sendParams = function (d) {
|
||||
//开启调试情况下获取接口赋值数据
|
||||
if (debug) { console.log(d.params.data); }
|
||||
layui.use(['admin', 'form', 'laydate', 'upload', 'coreHelper', 'cropperImg'],
|
||||
function () {
|
||||
var $ = layui.$
|
||||
, form = layui.form
|
||||
, admin = layui.admin
|
||||
, laydate = layui.laydate
|
||||
, upload = layui.upload
|
||||
, cropperImg = layui.cropperImg
|
||||
, coreHelper = layui.coreHelper;
|
||||
|
||||
|
||||
var upload = layui.upload;
|
||||
|
||||
//执行实例
|
||||
upload.render({
|
||||
elem: '#doUpload' //绑定元素
|
||||
, auto: false
|
||||
, accept: 'file'
|
||||
, exts: 'p12'
|
||||
, choose: function (obj) {
|
||||
obj.preview(function (index, file, result) {
|
||||
var base64 = result.substring(result.indexOf(',') + 1)
|
||||
$('#certificateBox').val(base64);
|
||||
form.render(null, 'LAY-app-CoreCmsWeChatPayConfig-editForm');
|
||||
});
|
||||
}, error: function () {
|
||||
//请求异常回调
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
form.verify({
|
||||
|
||||
});
|
||||
//重载form
|
||||
form.render(null, 'LAY-app-CoreCmsWeChatPayConfig-editForm');
|
||||
})
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,364 @@
|
||||
<title>微信支付配置</title>
|
||||
<!--当前位置开始-->
|
||||
<div class="layui-card layadmin-header">
|
||||
<div class="layui-breadcrumb" lay-filter="breadcrumb">
|
||||
<script type="text/html" template lay-done="layui.data.updateMainBreadcrumb();">
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
<!--当前位置结束-->
|
||||
<style>
|
||||
/* 重写样式 */
|
||||
</style>
|
||||
<script type="text/html" template lay-type="Post" lay-url="Api/CoreCmsWeChatPayConfig/GetIndex" lay-done="layui.data.done(d);">
|
||||
|
||||
</script>
|
||||
<div class="table-body">
|
||||
<table id="LAY-app-CoreCmsWeChatPayConfig-tableBox" lay-filter="LAY-app-CoreCmsWeChatPayConfig-tableBox"></table>
|
||||
</div>
|
||||
|
||||
<script type="text/html" id="LAY-app-CoreCmsWeChatPayConfig-toolbar">
|
||||
<div class="layui-form coreshop-toolbar-search-form">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label" for="appId">应用号</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="appId" placeholder="请输入应用号" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label" for="mchId">商户号</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="mchId" placeholder="请输入商户号" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label" for="isEnable">是否开启</label>
|
||||
<div class="layui-input-inline">
|
||||
<select name="isEnable">
|
||||
<option value="">请选择</option>
|
||||
<option value="True">是</option>
|
||||
<option value="False">否</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label" for="isDefault">是否本类默认</label>
|
||||
<div class="layui-input-inline">
|
||||
<select name="isDefault">
|
||||
<option value="">请选择</option>
|
||||
<option value="True">是</option>
|
||||
<option value="False">否</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label" for="appType">应用类型</label>
|
||||
<div class="layui-input-inline">
|
||||
<select name="appType">
|
||||
<option value="">请选择应用类型</option>
|
||||
{{# layui.each(indexData.weiChatPayTradeType, function(index, item){ }}
|
||||
<option value="{{ item.title }}">{{ item.description }}</option>
|
||||
{{# }); }}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<button class="layui-btn layui-btn-sm" lay-submit lay-filter="LAY-app-CoreCmsWeChatPayConfig-search"><i class="layui-icon layui-icon-search"></i>筛选</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="LAY-app-CoreCmsWeChatPayConfig-pagebar">
|
||||
<div class="layui-btn-container">
|
||||
<button class="layui-btn layui-btn-sm" lay-event="addData"><i class="layui-icon layui-icon-add-1"></i>添加数据</button>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="LAY-app-CoreCmsWeChatPayConfig-tableBox-bar">
|
||||
<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">查看</a>
|
||||
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
|
||||
<a class="layui-btn layui-btn-danger layui-btn-xs" data-dropdown="#CoreCmsWeChatPayConfigTbDelDrop{{d.LAY_INDEX}}" no-shade="true">删除</a>
|
||||
<div class="dropdown-menu-nav dropdown-popconfirm dropdown-top-right layui-hide" id="CoreCmsWeChatPayConfigTbDelDrop{{d.LAY_INDEX}}"
|
||||
style="max-width: 200px;white-space: normal;min-width: auto;margin-left: 10px;">
|
||||
<div class="dropdown-anchor"></div>
|
||||
<div class="dropdown-popconfirm-title">
|
||||
<i class="layui-icon layui-icon-help"></i>
|
||||
确定要删除吗?
|
||||
</div>
|
||||
<div class="dropdown-popconfirm-btn">
|
||||
<a class="layui-btn layui-btn-primary cursor" btn-cancel>取消</a>
|
||||
<a class="layui-btn layui-btn-normal cursor" lay-event="del">确定</a>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var indexData;
|
||||
var debug = layui.setter.debug;
|
||||
layui.data.done = function (d) {
|
||||
//开启调试情况下获取接口赋值数据
|
||||
if (debug) { console.log(d); }
|
||||
|
||||
indexData = d.data;
|
||||
layui.use(['index', 'table', 'laydate', 'util', 'coredropdown', 'coreHelper'],
|
||||
function () {
|
||||
var $ = layui.$
|
||||
, admin = layui.admin
|
||||
, table = layui.table
|
||||
, form = layui.form
|
||||
, laydate = layui.laydate
|
||||
, setter = layui.setter
|
||||
, coreHelper = layui.coreHelper
|
||||
, util = layui.util
|
||||
, view = layui.view;
|
||||
|
||||
var searchwhere;
|
||||
//监听搜索
|
||||
form.on('submit(LAY-app-CoreCmsWeChatPayConfig-search)',
|
||||
function (data) {
|
||||
var field = data.field;
|
||||
searchwhere = field;
|
||||
//执行重载
|
||||
table.reloadData('LAY-app-CoreCmsWeChatPayConfig-tableBox', { where: field });
|
||||
});
|
||||
//数据绑定
|
||||
table.render({
|
||||
elem: '#LAY-app-CoreCmsWeChatPayConfig-tableBox',
|
||||
url: layui.setter.apiUrl + 'Api/CoreCmsWeChatPayConfig/GetPageList',
|
||||
method: 'POST',
|
||||
toolbar: '#LAY-app-CoreCmsWeChatPayConfig-toolbar',
|
||||
pagebar: '#LAY-app-CoreCmsWeChatPayConfig-pagebar',
|
||||
className: 'pagebarbox',
|
||||
defaultToolbar: ['filter', 'print', 'exports'],
|
||||
height: 'full-127',//面包屑142px,搜索框4行172,3行137,2行102,1行67
|
||||
page: true,
|
||||
limit: 30,
|
||||
limits: [10, 15, 20, 25, 30, 50, 100, 200],
|
||||
text: { none: '暂无相关数据' },
|
||||
cols: [
|
||||
[
|
||||
{ type: "checkbox", fixed: "left" },
|
||||
{ field: 'id', title: '序列', width: 40, sort: false },
|
||||
{ field: 'appId', title: '应用号', sort: false, width: 135 },
|
||||
{ field: 'mchId', title: '商户号', sort: false, width: 105 },
|
||||
{ field: 'apiKey', title: 'API秘钥', sort: false, width: 155 },
|
||||
//{ field: 'apiV3Key', title: 'APIv3密钥', sort: false, width: 105 },
|
||||
//{ field: 'certificate', title: 'p12证书base64', sort: false, width: 105 },
|
||||
{ field: 'rsaPublicKey', title: 'RSA公钥', sort: false, width: 105 },
|
||||
{ field: 'subAppId', title: '子商户应用号', sort: false, width: 105 },
|
||||
{ field: 'subMchId', title: '子商户号', sort: false, width: 105 },
|
||||
{ field: 'notifyUrl', title: '支付回调通知', sort: false },
|
||||
{ field: 'refundUrl', title: '退款回调', sort: false },
|
||||
{ field: 'jumpUrl', title: '跳转地址', sort: false },
|
||||
{ field: 'isEnable', title: '是否开启', width: 95, templet: '#switch_isEnable', sort: false, unresize: true },
|
||||
{ field: 'isDefault', title: '是否本类默认', width: 95, templet: '#switch_isDefault', sort: false, unresize: true },
|
||||
//{ field: 'appType', title: '应用类型', sort: false, width: 105 },
|
||||
{
|
||||
field: 'appType', title: '应用类型', sort: false, width: 200, templet: function (data) {
|
||||
for (var i = 0; i < d.data.weiChatPayTradeType.length; i++) {
|
||||
if (d.data.weiChatPayTradeType[i].title === data.appType) {
|
||||
return d.data.weiChatPayTradeType[i].description + '【' + data.appType +'】';
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
},
|
||||
{ width: 162, align: 'center', title: '操作', fixed: 'right', toolbar: '#LAY-app-CoreCmsWeChatPayConfig-tableBox-bar' }
|
||||
]
|
||||
]
|
||||
});
|
||||
//监听排序事件
|
||||
table.on('sort(LAY-app-CoreCmsWeChatPayConfig-tableBox)', function (obj) {
|
||||
table.reloadData('LAY-app-CoreCmsWeChatPayConfig-tableBox', {
|
||||
initSort: obj, //记录初始排序,如果不设的话,将无法标记表头的排序状态。
|
||||
where: { //请求参数(注意:这里面的参数可任意定义,并非下面固定的格式)
|
||||
orderField: obj.field, //排序字段
|
||||
orderDirection: obj.type //排序方式
|
||||
}
|
||||
});
|
||||
});
|
||||
//监听行双击事件
|
||||
table.on('rowDouble(LAY-app-CoreCmsWeChatPayConfig-tableBox)', function (obj) {
|
||||
//查看详情
|
||||
doDetails(obj);
|
||||
});
|
||||
//头工具栏事件
|
||||
table.on('pagebar(LAY-app-CoreCmsWeChatPayConfig-tableBox)', function (obj) {
|
||||
var checkStatus = table.checkStatus(obj.config.id);
|
||||
switch (obj.event) {
|
||||
case 'addData':
|
||||
doCreate();
|
||||
break;
|
||||
};
|
||||
});
|
||||
//监听工具条
|
||||
table.on('tool(LAY-app-CoreCmsWeChatPayConfig-tableBox)',
|
||||
function (obj) {
|
||||
if (obj.event === 'detail') {
|
||||
doDetails(obj);
|
||||
} else if (obj.event === 'del') {
|
||||
doDelete(obj);
|
||||
} else if (obj.event === 'edit') {
|
||||
doEdit(obj)
|
||||
}
|
||||
});
|
||||
//执行创建操作
|
||||
function doCreate() {
|
||||
coreHelper.Post("Api/CoreCmsWeChatPayConfig/GetCreate", null, function (e) {
|
||||
if (e.code === 0) {
|
||||
admin.popup({
|
||||
shadeClose: false,
|
||||
title: '创建数据',
|
||||
area: ['1200px', '90%'],
|
||||
id: 'LAY-popup-CoreCmsWeChatPayConfig-create',
|
||||
success: function (layero, index) {
|
||||
view(this.id).render('shop/pay/wechatpayconfig/create', { data: e.data }).done(function () {
|
||||
//监听提交
|
||||
form.on('submit(LAY-app-CoreCmsWeChatPayConfig-createForm-submit)',
|
||||
function (data) {
|
||||
var field = data.field; //获取提交的字段
|
||||
|
||||
field.isEnable = field.isEnable == 'on';
|
||||
field.isDefault = field.isDefault == 'on';
|
||||
|
||||
if (debug) { console.log(field); } //开启调试返回数据
|
||||
//提交 Ajax 成功后,关闭当前弹层并重载表格
|
||||
coreHelper.Post("Api/CoreCmsWeChatPayConfig/DoCreate", field, function (e) {
|
||||
console.log(e)
|
||||
if (e.code === 0) {
|
||||
layui.table.reloadData('LAY-app-CoreCmsWeChatPayConfig-tableBox'); //重载表格
|
||||
layer.close(index); //再执行关闭
|
||||
layer.msg(e.msg);
|
||||
} else {
|
||||
layer.msg(e.msg);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
// 禁止弹窗出现滚动条
|
||||
$(layero).children('.layui-layer-content').css('overflow', 'visible');
|
||||
}
|
||||
, btn: ['确定', '取消']
|
||||
, yes: function (index, layero) {
|
||||
layero.contents().find("#LAY-app-CoreCmsWeChatPayConfig-createForm-submit").click();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
layer.msg(e.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
//执行编辑操作
|
||||
function doEdit(obj) {
|
||||
coreHelper.Post("Api/CoreCmsWeChatPayConfig/GetEdit", { id: obj.data.id }, function (e) {
|
||||
if (e.code === 0) {
|
||||
admin.popup({
|
||||
shadeClose: false,
|
||||
title: '编辑数据',
|
||||
area: ['1200px', '90%'],
|
||||
id: 'LAY-popup-CoreCmsWeChatPayConfig-edit',
|
||||
success: function (layero, index) {
|
||||
view(this.id).render('shop/pay/wechatpayconfig/edit', { data: e.data }).done(function () {
|
||||
//监听提交
|
||||
form.on('submit(LAY-app-CoreCmsWeChatPayConfig-editForm-submit)',
|
||||
function (data) {
|
||||
var field = data.field; //获取提交的字段
|
||||
|
||||
field.isEnable = field.isEnable == 'on';
|
||||
field.isDefault = field.isDefault == 'on';
|
||||
|
||||
if (debug) { console.log(field); } //开启调试返回数据
|
||||
//提交 Ajax 成功后,关闭当前弹层并重载表格
|
||||
coreHelper.Post("Api/CoreCmsWeChatPayConfig/DoEdit", field, function (e) {
|
||||
console.log(e)
|
||||
if (e.code === 0) {
|
||||
layui.table.reloadData('LAY-app-CoreCmsWeChatPayConfig-tableBox'); //重载表格
|
||||
layer.close(index); //再执行关闭
|
||||
layer.msg(e.msg);
|
||||
} else {
|
||||
layer.msg(e.msg);
|
||||
}
|
||||
});
|
||||
});
|
||||
})
|
||||
// 禁止弹窗出现滚动条
|
||||
$(layero).children('.layui-layer-content').css('overflow', 'visible');
|
||||
}
|
||||
, btn: ['确定', '取消']
|
||||
, yes: function (index, layero) {
|
||||
layero.contents().find("#LAY-app-CoreCmsWeChatPayConfig-editForm-submit").click();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
layer.msg(e.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
//执行预览操作
|
||||
function doDetails(obj) {
|
||||
coreHelper.Post("Api/CoreCmsWeChatPayConfig/GetDetails", { id: obj.data.id }, function (e) {
|
||||
if (e.code === 0) {
|
||||
admin.popup({
|
||||
shadeClose: false,
|
||||
title: '查看详情',
|
||||
area: ['1200px', '90%'],
|
||||
id: 'LAY-popup-CoreCmsWeChatPayConfig-details',
|
||||
success: function (layero, index) {
|
||||
view(this.id).render('shop/pay/wechatpayconfig/details', { data: e.data }).done(function () {
|
||||
form.render();
|
||||
});
|
||||
// 禁止弹窗出现滚动条
|
||||
//$(layero).children('.layui-layer-content').css('overflow', 'visible');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
layer.msg(e.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
//执行单个删除
|
||||
function doDelete(obj) {
|
||||
coreHelper.Post("Api/CoreCmsWeChatPayConfig/DoDelete", { id: obj.data.id }, function (e) {
|
||||
if (debug) { console.log(e); } //开启调试返回数据
|
||||
table.reloadData('LAY-app-CoreCmsWeChatPayConfig-tableBox');
|
||||
layer.msg(e.msg);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//监听 表格复选框操作
|
||||
|
||||
layui.form.on('switch(switch_isEnable)', function (obj) {
|
||||
coreHelper.Post("Api/CoreCmsWeChatPayConfig/DoSetisEnable", { id: this.value, data: obj.elem.checked }, function (e) {
|
||||
if (debug) { console.log(e); } //开启调试返回数据
|
||||
//table.reloadData('LAY-app-CoreCmsWeChatPayConfig-tableBox');
|
||||
layer.msg(e.msg);
|
||||
});
|
||||
});
|
||||
|
||||
layui.form.on('switch(switch_isDefault)', function (obj) {
|
||||
coreHelper.Post("Api/CoreCmsWeChatPayConfig/DoSetisDefault", { id: this.value, data: obj.elem.checked }, function (e) {
|
||||
if (debug) { console.log(e); } //开启调试返回数据
|
||||
//table.reloadData('LAY-app-CoreCmsWeChatPayConfig-tableBox');
|
||||
layer.msg(e.msg);
|
||||
});
|
||||
});
|
||||
|
||||
//重载form
|
||||
form.render();
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<!--设置是否开启-->
|
||||
<script type="text/html" id="switch_isEnable">
|
||||
<input type="checkbox" name="switch_isEnable" value="{{d.id}}" lay-skin="switch" lay-text="开启|关闭" lay-filter="switch_isEnable" {{ d.isEnable ? 'checked' : '' }}>
|
||||
</script>
|
||||
|
||||
<!--设置是否本类默认-->
|
||||
<script type="text/html" id="switch_isDefault">
|
||||
<input type="checkbox" name="switch_isDefault" value="{{d.id}}" lay-skin="switch" lay-text="开启|关闭" lay-filter="switch_isDefault" {{ d.isDefault ? 'checked' : '' }}>
|
||||
</script>
|
||||
|
||||
@@ -12,10 +12,12 @@ using System.Threading.Tasks;
|
||||
using System.Xml;
|
||||
using CoreCms.Net.Caching.AutoMate.RedisCache;
|
||||
using CoreCms.Net.Configuration;
|
||||
using CoreCms.Net.IServices;
|
||||
using CoreCms.Net.Loging;
|
||||
using Essensoft.Paylink.Alipay;
|
||||
using Essensoft.Paylink.Alipay.Notify;
|
||||
using Essensoft.Paylink.Alipay.Utility;
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Newtonsoft.Json;
|
||||
@@ -30,33 +32,49 @@ namespace CoreCms.Net.Web.WebApi.Controllers.PayNotify
|
||||
public class AliPayController : ControllerBase
|
||||
{
|
||||
private readonly IAlipayNotifyClient _client;
|
||||
private readonly IOptions<AlipayOptions> _optionsAccessor;
|
||||
private readonly IRedisOperationRepository _redisOperationRepository;
|
||||
private readonly IAlipayConfigServices _alipayConfigServices;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="optionsAccessor"></param>
|
||||
/// <param name="redisOperationRepository"></param>
|
||||
public AliPayController(IAlipayNotifyClient client, IOptions<AlipayOptions> optionsAccessor, IRedisOperationRepository redisOperationRepository)
|
||||
/// <param name="alipayConfigServices"></param>
|
||||
public AliPayController(IAlipayNotifyClient client, IRedisOperationRepository redisOperationRepository, IAlipayConfigServices alipayConfigServices)
|
||||
{
|
||||
_client = client;
|
||||
_optionsAccessor = optionsAccessor;
|
||||
_redisOperationRepository = redisOperationRepository;
|
||||
_alipayConfigServices = alipayConfigServices;
|
||||
}
|
||||
|
||||
#region 支付宝统一回调接口
|
||||
/// <summary>
|
||||
/// APP支付统一下单支付结果通知
|
||||
/// https://api.pro.coreshop.cn/Notify/AliPay/Unifiedorder
|
||||
/// </summary>
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> Unifiedorder()
|
||||
[Route("m-{appid}")]
|
||||
public async Task<IActionResult> Unifiedorder([FromRoute(Name = "appid")] string appid)
|
||||
{
|
||||
NLogUtil.WriteAll(LogLevel.Trace, LogType.Order, "支付宝支付回调开始", "支付宝回调开始数据标记");
|
||||
try
|
||||
{
|
||||
var notify = await _client.ExecuteAsync<AlipayTradeAppPayNotify>(Request, _optionsAccessor.Value);
|
||||
var config = await _alipayConfigServices.QueryByClauseAsync(p => p.isDefault == true && p.isEnable == true && p.appId == appid);
|
||||
//构建linkPay请求配置实体
|
||||
var payOptions = new AlipayOptions
|
||||
{
|
||||
AppId = config.appId,
|
||||
AlipayPublicKey = config.publicKey,
|
||||
AppPrivateKey = config.privateKey,
|
||||
ServerUrl = config.serverUrl,
|
||||
SignType = config.signType,
|
||||
AppPublicCert = config.appPublicCert,
|
||||
AlipayPublicCert = config.alipayPublicCert,
|
||||
AlipayRootCert = config.alipayRootCert
|
||||
};
|
||||
|
||||
var notify = await _client.ExecuteAsync<AlipayTradeAppPayNotify>(Request, payOptions);
|
||||
NLogUtil.WriteAll(LogLevel.Trace, LogType.Order, "支付宝支付回调支付宝返回的参数", JsonConvert.SerializeObject(notify));
|
||||
if (notify.TradeStatus == AlipayTradeStatus.Success)
|
||||
{
|
||||
@@ -82,17 +100,34 @@ namespace CoreCms.Net.Web.WebApi.Controllers.PayNotify
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> Gateway()
|
||||
[Route("m-{appid}")]
|
||||
|
||||
public async Task<IActionResult> Gateway([FromRoute(Name = "appid")] string appid)
|
||||
{
|
||||
try
|
||||
{
|
||||
var config = await _alipayConfigServices.QueryByClauseAsync(p => p.isDefault == true && p.isEnable == true && p.appId == appid);
|
||||
//构建linkPay请求配置实体
|
||||
var payOptions = new AlipayOptions
|
||||
{
|
||||
AppId = config.appId,
|
||||
AlipayPublicKey = config.publicKey,
|
||||
AppPrivateKey = config.privateKey,
|
||||
ServerUrl = config.serverUrl,
|
||||
SignType = config.signType,
|
||||
AppPublicCert = config.appPublicCert,
|
||||
AlipayPublicCert = config.alipayPublicCert,
|
||||
AlipayRootCert = config.alipayRootCert
|
||||
};
|
||||
|
||||
|
||||
var service = Request.Form["service"].ToString();
|
||||
switch (service)
|
||||
{
|
||||
// 激活开发者模式
|
||||
case "alipay.service.check":
|
||||
{
|
||||
var options = _optionsAccessor.Value;
|
||||
var options = payOptions;
|
||||
|
||||
// 获取参数
|
||||
var parameters = await _client.GetParametersAsync(Request);
|
||||
@@ -121,49 +156,49 @@ namespace CoreCms.Net.Web.WebApi.Controllers.PayNotify
|
||||
// 资金单据状态变更通知
|
||||
case "alipay.fund.trans.order.changed":
|
||||
{
|
||||
var notify = await _client.CertificateExecuteAsync<AlipayFundTransOrderChangedNotify>(Request, _optionsAccessor.Value);
|
||||
var notify = await _client.CertificateExecuteAsync<AlipayFundTransOrderChangedNotify>(Request, payOptions);
|
||||
return AlipayNotifyResult.Success;
|
||||
}
|
||||
// 第三方应用授权取消消息
|
||||
case "alipay.open.auth.appauth.cancelled":
|
||||
{
|
||||
var notify = await _client.CertificateExecuteAsync<AlipayOpenAuthAppauthCancelledNotify>(Request, _optionsAccessor.Value);
|
||||
var notify = await _client.CertificateExecuteAsync<AlipayOpenAuthAppauthCancelledNotify>(Request, payOptions);
|
||||
return AlipayNotifyResult.Success;
|
||||
}
|
||||
// 用户授权取消消息
|
||||
case "alipay.open.auth.userauth.cancelled":
|
||||
{
|
||||
var notify = await _client.CertificateExecuteAsync<AlipayOpenAuthUserauthCancelledNotify>(Request, _optionsAccessor.Value);
|
||||
var notify = await _client.CertificateExecuteAsync<AlipayOpenAuthUserauthCancelledNotify>(Request, payOptions);
|
||||
return AlipayNotifyResult.Success;
|
||||
}
|
||||
// 小程序审核通过通知
|
||||
case "alipay.open.mini.version.audit.passed":
|
||||
{
|
||||
var notify = await _client.CertificateExecuteAsync<AlipayOpenMiniVersionAuditPassedNotify>(Request, _optionsAccessor.Value);
|
||||
var notify = await _client.CertificateExecuteAsync<AlipayOpenMiniVersionAuditPassedNotify>(Request, payOptions);
|
||||
return AlipayNotifyResult.Success;
|
||||
}
|
||||
// 用户授权取消消息
|
||||
case "alipay.open.mini.version.audit.rejected":
|
||||
{
|
||||
var notify = await _client.CertificateExecuteAsync<AlipayOpenMiniVersionAuditRejectedNotify>(Request, _optionsAccessor.Value);
|
||||
var notify = await _client.CertificateExecuteAsync<AlipayOpenMiniVersionAuditRejectedNotify>(Request, payOptions);
|
||||
return AlipayNotifyResult.Success;
|
||||
}
|
||||
// 收单资金结算到银行账户,结算退票的异步通知
|
||||
case "alipay.trade.settle.dishonoured":
|
||||
{
|
||||
var notify = await _client.CertificateExecuteAsync<AlipayTradeSettleDishonouredNotify>(Request, _optionsAccessor.Value);
|
||||
var notify = await _client.CertificateExecuteAsync<AlipayTradeSettleDishonouredNotify>(Request, payOptions);
|
||||
return AlipayNotifyResult.Success;
|
||||
}
|
||||
// 收单资金结算到银行账户,结算失败的异步通知
|
||||
case "alipay.trade.settle.fail":
|
||||
{
|
||||
var notify = await _client.CertificateExecuteAsync<AlipayTradeSettleFailNotify>(Request, _optionsAccessor.Value);
|
||||
var notify = await _client.CertificateExecuteAsync<AlipayTradeSettleFailNotify>(Request, payOptions);
|
||||
return AlipayNotifyResult.Success;
|
||||
}
|
||||
// 收单资金结算到银行账户,结算成功的异步通知
|
||||
case "alipay.trade.settle.success":
|
||||
{
|
||||
var notify = await _client.CertificateExecuteAsync<AlipayTradeSettleSuccessNotify>(Request, _optionsAccessor.Value);
|
||||
var notify = await _client.CertificateExecuteAsync<AlipayTradeSettleSuccessNotify>(Request, payOptions);
|
||||
return AlipayNotifyResult.Success;
|
||||
}
|
||||
}
|
||||
@@ -180,11 +215,28 @@ namespace CoreCms.Net.Web.WebApi.Controllers.PayNotify
|
||||
/// 扫码支付异步通知
|
||||
/// </summary>
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> Precreate()
|
||||
[Route("m-{appid}")]
|
||||
|
||||
public async Task<IActionResult> Precreate([FromRoute(Name = "appid")] string appid)
|
||||
{
|
||||
try
|
||||
{
|
||||
var notify = await _client.ExecuteAsync<AlipayTradeAppPayNotify>(Request, _optionsAccessor.Value);
|
||||
var config = await _alipayConfigServices.QueryByClauseAsync(p => p.isDefault == true && p.isEnable == true && p.appId == appid);
|
||||
//构建linkPay请求配置实体
|
||||
var payOptions = new AlipayOptions
|
||||
{
|
||||
AppId = config.appId,
|
||||
AlipayPublicKey = config.publicKey,
|
||||
AppPrivateKey = config.privateKey,
|
||||
ServerUrl = config.serverUrl,
|
||||
SignType = config.signType,
|
||||
AppPublicCert = config.appPublicCert,
|
||||
AlipayPublicCert = config.alipayPublicCert,
|
||||
AlipayRootCert = config.alipayRootCert
|
||||
};
|
||||
|
||||
|
||||
var notify = await _client.ExecuteAsync<AlipayTradeAppPayNotify>(Request, payOptions);
|
||||
if (notify.TradeStatus == AlipayTradeStatus.Success)
|
||||
{
|
||||
await _redisOperationRepository.ListLeftPushAsync(RedisMessageQueueKey.AliPayNotice, JsonConvert.SerializeObject(notify));
|
||||
@@ -204,11 +256,26 @@ namespace CoreCms.Net.Web.WebApi.Controllers.PayNotify
|
||||
/// APP支付异步通知
|
||||
/// </summary>
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> AppPay()
|
||||
[Route("m-{appid}")]
|
||||
public async Task<IActionResult> AppPay([FromRoute(Name = "appid")] string appid)
|
||||
{
|
||||
try
|
||||
{
|
||||
var notify = await _client.CertificateExecuteAsync<AlipayTradeAppPayNotify>(Request, _optionsAccessor.Value);
|
||||
var config = await _alipayConfigServices.QueryByClauseAsync(p => p.isDefault == true && p.isEnable == true && p.appId == appid);
|
||||
//构建linkPay请求配置实体
|
||||
var payOptions = new AlipayOptions
|
||||
{
|
||||
AppId = config.appId,
|
||||
AlipayPublicKey = config.publicKey,
|
||||
AppPrivateKey = config.privateKey,
|
||||
ServerUrl = config.serverUrl,
|
||||
SignType = config.signType,
|
||||
AppPublicCert = config.appPublicCert,
|
||||
AlipayPublicCert = config.alipayPublicCert,
|
||||
AlipayRootCert = config.alipayRootCert
|
||||
};
|
||||
|
||||
var notify = await _client.CertificateExecuteAsync<AlipayTradeAppPayNotify>(Request, payOptions);
|
||||
if (notify.TradeStatus == AlipayTradeStatus.Success)
|
||||
{
|
||||
Console.WriteLine("OutTradeNo: " + notify.OutTradeNo);
|
||||
@@ -222,15 +289,31 @@ namespace CoreCms.Net.Web.WebApi.Controllers.PayNotify
|
||||
return NoContent();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 电脑网站支付异步通知
|
||||
/// </summary>
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> PagePay()
|
||||
[Route("m-{appid}")]
|
||||
public async Task<IActionResult> PagePay([FromRoute(Name = "appid")] string appid)
|
||||
{
|
||||
try
|
||||
{
|
||||
var notify = await _client.CertificateExecuteAsync<AlipayTradePagePayNotify>(Request, _optionsAccessor.Value);
|
||||
var config = await _alipayConfigServices.QueryByClauseAsync(p => p.isDefault == true && p.isEnable == true && p.appId == appid);
|
||||
//构建linkPay请求配置实体
|
||||
var payOptions = new AlipayOptions
|
||||
{
|
||||
AppId = config.appId,
|
||||
AlipayPublicKey = config.publicKey,
|
||||
AppPrivateKey = config.privateKey,
|
||||
ServerUrl = config.serverUrl,
|
||||
SignType = config.signType,
|
||||
AppPublicCert = config.appPublicCert,
|
||||
AlipayPublicCert = config.alipayPublicCert,
|
||||
AlipayRootCert = config.alipayRootCert
|
||||
};
|
||||
|
||||
var notify = await _client.CertificateExecuteAsync<AlipayTradePagePayNotify>(Request, payOptions);
|
||||
if (notify.TradeStatus == AlipayTradeStatus.Success)
|
||||
{
|
||||
Console.WriteLine("OutTradeNo: " + notify.OutTradeNo);
|
||||
@@ -249,11 +332,26 @@ namespace CoreCms.Net.Web.WebApi.Controllers.PayNotify
|
||||
/// 手机网站支付异步通知
|
||||
/// </summary>
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> WapPay()
|
||||
[Route("m-{appid}")]
|
||||
public async Task<IActionResult> WapPay([FromRoute(Name = "appid")] string appid)
|
||||
{
|
||||
try
|
||||
{
|
||||
var notify = await _client.CertificateExecuteAsync<AlipayTradeWapPayNotify>(Request, _optionsAccessor.Value);
|
||||
var config = await _alipayConfigServices.QueryByClauseAsync(p => p.isDefault == true && p.isEnable == true && p.appId == appid);
|
||||
//构建linkPay请求配置实体
|
||||
var payOptions = new AlipayOptions
|
||||
{
|
||||
AppId = config.appId,
|
||||
AlipayPublicKey = config.publicKey,
|
||||
AppPrivateKey = config.privateKey,
|
||||
ServerUrl = config.serverUrl,
|
||||
SignType = config.signType,
|
||||
AppPublicCert = config.appPublicCert,
|
||||
AlipayPublicCert = config.alipayPublicCert,
|
||||
AlipayRootCert = config.alipayRootCert
|
||||
};
|
||||
|
||||
var notify = await _client.CertificateExecuteAsync<AlipayTradeWapPayNotify>(Request, payOptions);
|
||||
if (notify.TradeStatus == AlipayTradeStatus.Success)
|
||||
{
|
||||
Console.WriteLine("OutTradeNo: " + notify.OutTradeNo);
|
||||
|
||||
@@ -34,32 +34,52 @@ namespace CoreCms.Net.Web.WebApi.Controllers.PayNotify
|
||||
private readonly ICoreCmsBillPaymentsServices _billPaymentsServices;
|
||||
private readonly ICoreCmsBillRefundServices _billRefundServices;
|
||||
private readonly IWeChatPayNotifyClient _client;
|
||||
private readonly IOptions<WeChatPayOptions> _optionsAccessor;
|
||||
private readonly IRedisOperationRepository _redisOperationRepository;
|
||||
|
||||
private readonly IWeChatPayConfigServices _weChatPayConfigServices;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
public WeChatPayController(
|
||||
IWeChatPayNotifyClient client
|
||||
, IOptions<WeChatPayOptions> optionsAccessor
|
||||
, ICoreCmsBillPaymentsServices billPaymentsServices, ICoreCmsBillRefundServices billRefundServices, IRedisOperationRepository redisOperationRepository)
|
||||
, ICoreCmsBillPaymentsServices billPaymentsServices, ICoreCmsBillRefundServices billRefundServices, IRedisOperationRepository redisOperationRepository, IWeChatPayConfigServices weChatPayConfigServices)
|
||||
{
|
||||
_client = client;
|
||||
_optionsAccessor = optionsAccessor;
|
||||
_billPaymentsServices = billPaymentsServices;
|
||||
_billRefundServices = billRefundServices;
|
||||
_redisOperationRepository = redisOperationRepository;
|
||||
_weChatPayConfigServices = weChatPayConfigServices;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 统一下单支付结果通知
|
||||
/// </summary>
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> Unifiedorder()
|
||||
[Route("m-{appid}")]
|
||||
public async Task<IActionResult> Unifiedorder([FromRoute(Name = "appid")] string appid)
|
||||
{
|
||||
try
|
||||
{
|
||||
var notify = await _client.ExecuteAsync<WeChatPayUnifiedOrderNotify>(Request, _optionsAccessor.Value);
|
||||
//NLogUtil.WriteAll(LogLevel.Trace, LogType.Order, "微信支付成功接收appid", JsonConvert.SerializeObject(appid));
|
||||
|
||||
var config = await _weChatPayConfigServices.QueryByClauseAsync(p => p.isDefault == true && p.isEnable == true && p.appId == appid);
|
||||
//构建linkPay请求配置实体
|
||||
var payOptions = new WeChatPayOptions
|
||||
{
|
||||
AppId = config.appId,
|
||||
MchId = config.mchId,
|
||||
APIKey = config.apiKey,
|
||||
APIv3Key = config.apiV3Key,
|
||||
Certificate = config.certificate,
|
||||
RsaPublicKey = config.rsaPublicKey,
|
||||
SubAppId = config.subAppId,
|
||||
SubMchId = config.subMchId
|
||||
};
|
||||
|
||||
|
||||
var notify = await _client.ExecuteAsync<WeChatPayUnifiedOrderNotify>(Request, payOptions);
|
||||
if (notify.ReturnCode == WeChatPayCode.Success)
|
||||
{
|
||||
await _redisOperationRepository.ListLeftPushAsync(RedisMessageQueueKey.WeChatPayNotice,
|
||||
@@ -84,7 +104,21 @@ namespace CoreCms.Net.Web.WebApi.Controllers.PayNotify
|
||||
{
|
||||
try
|
||||
{
|
||||
var notify = await _client.ExecuteAsync<WeChatPayRefundNotify>(Request, _optionsAccessor.Value);
|
||||
var config = await _weChatPayConfigServices.QueryByClauseAsync(p => p.isDefault == true && p.isEnable == true);
|
||||
//构建linkPay请求配置实体
|
||||
var payOptions = new WeChatPayOptions
|
||||
{
|
||||
AppId = config.appId,
|
||||
MchId = config.mchId,
|
||||
APIKey = config.apiKey,
|
||||
APIv3Key = config.apiV3Key,
|
||||
Certificate = config.certificate,
|
||||
RsaPublicKey = config.rsaPublicKey,
|
||||
SubAppId = config.subAppId,
|
||||
SubMchId = config.subMchId
|
||||
};
|
||||
|
||||
var notify = await _client.ExecuteAsync<WeChatPayRefundNotify>(Request, payOptions);
|
||||
NLogUtil.WriteAll(LogLevel.Trace, LogType.Refund, "微信退款结果通知", JsonConvert.SerializeObject(notify));
|
||||
|
||||
if (notify.ReturnCode == WeChatPayCode.Success)
|
||||
|
||||
@@ -730,42 +730,42 @@
|
||||
支付宝异步通知
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.WebApi.Controllers.PayNotify.AliPayController.#ctor(Essensoft.Paylink.Alipay.IAlipayNotifyClient,Microsoft.Extensions.Options.IOptions{Essensoft.Paylink.Alipay.AlipayOptions},CoreCms.Net.Caching.AutoMate.RedisCache.IRedisOperationRepository)">
|
||||
<member name="M:CoreCms.Net.Web.WebApi.Controllers.PayNotify.AliPayController.#ctor(Essensoft.Paylink.Alipay.IAlipayNotifyClient,CoreCms.Net.Caching.AutoMate.RedisCache.IRedisOperationRepository,CoreCms.Net.IServices.IAlipayConfigServices)">
|
||||
<summary>
|
||||
构造函数
|
||||
</summary>
|
||||
<param name="client"></param>
|
||||
<param name="optionsAccessor"></param>
|
||||
<param name="redisOperationRepository"></param>
|
||||
<param name="alipayConfigServices"></param>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.WebApi.Controllers.PayNotify.AliPayController.Unifiedorder">
|
||||
<member name="M:CoreCms.Net.Web.WebApi.Controllers.PayNotify.AliPayController.Unifiedorder(System.String)">
|
||||
<summary>
|
||||
APP支付统一下单支付结果通知
|
||||
https://api.pro.coreshop.cn/Notify/AliPay/Unifiedorder
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.WebApi.Controllers.PayNotify.AliPayController.Gateway">
|
||||
<member name="M:CoreCms.Net.Web.WebApi.Controllers.PayNotify.AliPayController.Gateway(System.String)">
|
||||
<summary>
|
||||
应用网关
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.WebApi.Controllers.PayNotify.AliPayController.Precreate">
|
||||
<member name="M:CoreCms.Net.Web.WebApi.Controllers.PayNotify.AliPayController.Precreate(System.String)">
|
||||
<summary>
|
||||
扫码支付异步通知
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.WebApi.Controllers.PayNotify.AliPayController.AppPay">
|
||||
<member name="M:CoreCms.Net.Web.WebApi.Controllers.PayNotify.AliPayController.AppPay(System.String)">
|
||||
<summary>
|
||||
APP支付异步通知
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.WebApi.Controllers.PayNotify.AliPayController.PagePay">
|
||||
<member name="M:CoreCms.Net.Web.WebApi.Controllers.PayNotify.AliPayController.PagePay(System.String)">
|
||||
<summary>
|
||||
电脑网站支付异步通知
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.WebApi.Controllers.PayNotify.AliPayController.WapPay">
|
||||
<member name="M:CoreCms.Net.Web.WebApi.Controllers.PayNotify.AliPayController.WapPay(System.String)">
|
||||
<summary>
|
||||
手机网站支付异步通知
|
||||
</summary>
|
||||
@@ -775,12 +775,12 @@
|
||||
微信支付异步通知
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.WebApi.Controllers.PayNotify.WeChatPayController.#ctor(Essensoft.Paylink.WeChatPay.V2.IWeChatPayNotifyClient,Microsoft.Extensions.Options.IOptions{Essensoft.Paylink.WeChatPay.WeChatPayOptions},CoreCms.Net.IServices.ICoreCmsBillPaymentsServices,CoreCms.Net.IServices.ICoreCmsBillRefundServices,CoreCms.Net.Caching.AutoMate.RedisCache.IRedisOperationRepository)">
|
||||
<member name="M:CoreCms.Net.Web.WebApi.Controllers.PayNotify.WeChatPayController.#ctor(Essensoft.Paylink.WeChatPay.V2.IWeChatPayNotifyClient,CoreCms.Net.IServices.ICoreCmsBillPaymentsServices,CoreCms.Net.IServices.ICoreCmsBillRefundServices,CoreCms.Net.Caching.AutoMate.RedisCache.IRedisOperationRepository,CoreCms.Net.IServices.IWeChatPayConfigServices)">
|
||||
<summary>
|
||||
构造函数
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:CoreCms.Net.Web.WebApi.Controllers.PayNotify.WeChatPayController.Unifiedorder">
|
||||
<member name="M:CoreCms.Net.Web.WebApi.Controllers.PayNotify.WeChatPayController.Unifiedorder(System.String)">
|
||||
<summary>
|
||||
统一下单支付结果通知
|
||||
</summary>
|
||||
|
||||
@@ -64,10 +64,6 @@ builder.Services.AddRedisMessageQueueSetup();
|
||||
builder.Services.AddAlipay();
|
||||
builder.Services.AddWeChatPay();
|
||||
|
||||
// 在 appsettings.json 中 配置选项
|
||||
builder.Services.Configure<WeChatPayOptions>(builder.Configuration.GetSection("WeChatPay"));
|
||||
builder.Services.Configure<AlipayOptions>(builder.Configuration.GetSection("Alipay"));
|
||||
|
||||
//注册自定义微信接口配置文件
|
||||
builder.Services.Configure<CoreCms.Net.WeChat.Service.Options.WeChatOptions>(builder.Configuration.GetSection(nameof(CoreCms.Net.WeChat.Service.Options.WeChatOptions)));
|
||||
|
||||
|
||||
@@ -138,87 +138,6 @@
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
// 微信支付
|
||||
// 更多配置,请查看WeChatPayOptions类
|
||||
"WeChatPay": {
|
||||
// 应用号
|
||||
// 如:微信公众平台AppId、微信开放平台AppId、微信小程序AppId、企业微信CorpId等
|
||||
"AppId": "",
|
||||
// 商户号
|
||||
// 为微信支付商户平台的商户号
|
||||
"MchId": "",
|
||||
// API密钥
|
||||
// 为微信支付商户平台的API密钥,请注意不是APIv3密钥
|
||||
"APIKey": "",
|
||||
// APIv3密钥
|
||||
// 为微信支付商户平台的APIv3密钥,请注意不是API密钥,v3接口必填
|
||||
"APIv3Key": "",
|
||||
// API证书(.p12)
|
||||
// 为微信支付商户平台的API证书(.p12),v3接口必填
|
||||
// 可为证书文件(.p12)路径 / 证书文件(.p12)的base64字符串
|
||||
//以下格式为windows服务器下路径格式,linux下格式为 WxPayCert/apiclient_cert.p12
|
||||
"Certificate": "WxPayCert\\apiclient_cert.p12",
|
||||
// RSA公钥
|
||||
// 目前仅调用"企业付款到银行卡API"时使用,执行本示例中的"获取RSA加密公钥API"即可获取。
|
||||
"RsaPublicKey": "",
|
||||
// 子商户应用号(目前仅调用服务商API时使用,子商户的公众号、移动应用AppId。)
|
||||
"SubAppId": "",
|
||||
// 子商户号(目前仅调用服务商API时使用,子商户的商户号。)
|
||||
"SubMchId": ""
|
||||
},
|
||||
// 支付宝(暂未开通)
|
||||
// 更多配置,请查看AlipayOptions类
|
||||
"Alipay": {
|
||||
// 注意:
|
||||
// 若涉及资金类支出接口(如转账、红包等)接入,必须使用“公钥证书”方式。不涉及到资金类接口,也可以使用“普通公钥”方式进行加签。
|
||||
// 本示例默认的加签方式为“公钥证书”方式,并调用 CertificateExecuteAsync 方法 执行API。
|
||||
// 若使用“普通公钥”方式,除了遵守下方注释的规则外,调用 CertificateExecuteAsync 也需改成 ExecuteAsync。
|
||||
// 支付宝后台密钥/证书官方配置教程:https://opendocs.alipay.com/open/291/105971
|
||||
// 密钥格式:请选择 PKCS1(非JAVA适用),切记 切记 切记
|
||||
// 应用Id
|
||||
// 为支付宝开放平台-APPID
|
||||
"AppId": "",
|
||||
// 支付宝公钥 RSA公钥
|
||||
// 为支付宝开放平台-支付宝公钥
|
||||
// “公钥证书”方式时,留空
|
||||
// “普通公钥”方式时,必填
|
||||
"AlipayPublicKey": "",
|
||||
// 应用私钥 RSA私钥
|
||||
// 为“支付宝开放平台开发助手”所生成的应用私钥
|
||||
"AppPrivateKey": "",
|
||||
// 服务网关地址
|
||||
// 默认为正式环境地址
|
||||
"ServerUrl": "https://openapi.alipay.com/gateway.do",
|
||||
// 签名类型
|
||||
// 支持:RSA2(SHA256WithRSA)、RSA1(SHA1WithRSA)
|
||||
// 默认为RSA2
|
||||
"SignType": "RSA2",
|
||||
// 应用公钥证书
|
||||
// 可为证书文件路径 / 证书文件的base64字符串
|
||||
// “公钥证书”方式时,必填
|
||||
// “普通公钥”方式时,留空
|
||||
"AppPublicCert": "",
|
||||
// 支付宝公钥证书
|
||||
// 可为证书文件路径 / 证书文件的base64字符串
|
||||
// “公钥证书”方式时,必填
|
||||
// “普通公钥”方式时,留空
|
||||
"AlipayPublicCert": "",
|
||||
// 支付宝根证书
|
||||
// 可为证书文件路径 / 证书文件的base64字符串
|
||||
// “公钥证书”方式时,必填
|
||||
// “普通公钥”方式时,留空
|
||||
"AlipayRootCert": ""
|
||||
},
|
||||
"PayCallBack": {
|
||||
//微信支付回调
|
||||
"WeChatPayUrl": "https://api.test.pro.coreshop.cn/Notify/WeChatPay/Unifiedorder",
|
||||
//微信退款回调
|
||||
"WeChatRefundUrl": "https://api.test.pro.coreshop.cn/Notify/WeChatPay/Refund",
|
||||
//支付宝支付回调
|
||||
"AlipayUrl": "https://api.test.pro.coreshop.cn/Notify/AliPay/Unifiedorder",
|
||||
//支付宝退款回调
|
||||
"AlipayRefundUrl": ""
|
||||
},
|
||||
"WeChatOptions": {
|
||||
//公众号
|
||||
"WeiXinAppId": "",
|
||||
|
||||
43
数据库/MySql/20230424/升级脚本/1、创建表.sql
Normal file
43
数据库/MySql/20230424/升级脚本/1、创建表.sql
Normal file
@@ -0,0 +1,43 @@
|
||||
create table CoreCmsAlipayConfig
|
||||
(
|
||||
id int auto_increment comment '序列'
|
||||
primary key,
|
||||
appId varchar(50) charset utf8 not null comment '支付宝开放平台AppId',
|
||||
publicKey varchar(500) charset utf8 not null comment '支付宝公钥',
|
||||
privateKey varchar(2000) charset utf8 not null comment '应用私钥',
|
||||
serverUrl varchar(100) charset utf8 null comment '服务网关地址',
|
||||
signType varchar(10) charset utf8 null comment '签名类型',
|
||||
appPublicCert varchar(5000) charset utf8 null comment '应用公钥证书',
|
||||
alipayPublicCert varchar(5000) charset utf8 null comment '支付宝公钥证书',
|
||||
alipayRootCert varchar(5000) charset utf8 null comment '支付宝根证书',
|
||||
appType varchar(10) charset utf8 not null comment '应用类型',
|
||||
notifyUrl varchar(500) null comment '支付宝支付回调通知',
|
||||
refundUrl varchar(500) null comment '支付宝退款回调',
|
||||
jumpUrl varchar(500) null comment '支付跳转地址',
|
||||
isEnable bit not null comment '是否启用',
|
||||
isDefault bit not null comment '当前多端默认'
|
||||
)
|
||||
comment '支付宝支付配置';
|
||||
|
||||
|
||||
create table CoreCmsWeChatPayConfig
|
||||
(
|
||||
id int auto_increment comment '序列'
|
||||
primary key,
|
||||
appId varchar(50) not null comment '应用号',
|
||||
mchId varchar(50) not null comment '商户号',
|
||||
apiKey varchar(50) null comment 'API秘钥',
|
||||
apiV3Key varchar(50) null comment 'APIv3密钥',
|
||||
certificate varchar(8000) null comment 'p12证书base64',
|
||||
rsaPublicKey varchar(1000) null comment 'RSA公钥',
|
||||
subAppId varchar(50) null comment '子商户应用号',
|
||||
subMchId varchar(50) null comment '子商户号',
|
||||
notifyUrl varchar(200) null comment '支付回调通知',
|
||||
refundUrl varchar(200) null comment '退款回调',
|
||||
jumpUrl varchar(200) null comment '跳转地址',
|
||||
isEnable bit not null comment '是否开启',
|
||||
isDefault bit not null comment '是否本类默认',
|
||||
appType varchar(50) null comment '应用类型'
|
||||
)
|
||||
comment '微信支付配置';
|
||||
|
||||
24
数据库/MySql/20230424/升级脚本/2、添加后端左侧菜单.sql
Normal file
24
数据库/MySql/20230424/升级脚本/2、添加后端左侧菜单.sql
Normal file
@@ -0,0 +1,24 @@
|
||||
|
||||
INSERT INTO SysMenu (id, parentId, identificationCode, menuName, menuIcon, path, component, menuType, sortNumber, authority, target, iconColor, hide, deleted, createTime, updateTime) VALUES (2606, 126, 'pay', '支付设置', '', '', '', 0, 22, '', null, null, 0, 0, '2023-04-20 23:50:13', null);
|
||||
INSERT INTO SysMenu (id, parentId, identificationCode, menuName, menuIcon, path, component, menuType, sortNumber, authority, target, iconColor, hide, deleted, createTime, updateTime) VALUES (2607, 2606, 'wechatpayconfig', '微信支付', '', 'shop/pay/wechatpayconfig/index', '', 0, 1, '', null, null, 0, 0, '2023-04-20 23:50:56', null);
|
||||
INSERT INTO SysMenu (id, parentId, identificationCode, menuName, menuIcon, path, component, menuType, sortNumber, authority, target, iconColor, hide, deleted, createTime, updateTime) VALUES (2608, 2606, 'alipayconfig', '支付宝支付', '', 'shop/pay/alipayconfig/index', '', 0, 10, '', null, null, 0, 0, '2023-04-20 23:51:25', null);
|
||||
INSERT INTO SysMenu (id, parentId, identificationCode, menuName, menuIcon, path, component, menuType, sortNumber, authority, target, iconColor, hide, deleted, createTime, updateTime) VALUES (2609, 2607, 'GetPageList', '获取列表', null, null, '/Api/CoreCmsWeChatPayConfig/GetPageList', 1, 0, 'CoreCmsWeChatPayConfig:GetPageList', null, null, 0, 0, '2023-04-20 23:56:20', null);
|
||||
INSERT INTO SysMenu (id, parentId, identificationCode, menuName, menuIcon, path, component, menuType, sortNumber, authority, target, iconColor, hide, deleted, createTime, updateTime) VALUES (2610, 2607, 'GetIndex', '首页数据', null, null, '/Api/CoreCmsWeChatPayConfig/GetIndex', 1, 1, 'CoreCmsWeChatPayConfig:GetIndex', null, null, 0, 0, '2023-04-20 23:56:20', null);
|
||||
INSERT INTO SysMenu (id, parentId, identificationCode, menuName, menuIcon, path, component, menuType, sortNumber, authority, target, iconColor, hide, deleted, createTime, updateTime) VALUES (2611, 2607, 'GetCreate', '创建数据', null, null, '/Api/CoreCmsWeChatPayConfig/GetCreate', 1, 2, 'CoreCmsWeChatPayConfig:GetCreate', null, null, 0, 0, '2023-04-20 23:56:20', null);
|
||||
INSERT INTO SysMenu (id, parentId, identificationCode, menuName, menuIcon, path, component, menuType, sortNumber, authority, target, iconColor, hide, deleted, createTime, updateTime) VALUES (2612, 2607, 'DoCreate', '创建提交', null, null, '/Api/CoreCmsWeChatPayConfig/DoCreate', 1, 3, 'CoreCmsWeChatPayConfig:DoCreate', null, null, 0, 0, '2023-04-20 23:56:20', null);
|
||||
INSERT INTO SysMenu (id, parentId, identificationCode, menuName, menuIcon, path, component, menuType, sortNumber, authority, target, iconColor, hide, deleted, createTime, updateTime) VALUES (2613, 2607, 'GetEdit', '编辑数据', null, null, '/Api/CoreCmsWeChatPayConfig/GetEdit', 1, 4, 'CoreCmsWeChatPayConfig:GetEdit', null, null, 0, 0, '2023-04-20 23:56:20', null);
|
||||
INSERT INTO SysMenu (id, parentId, identificationCode, menuName, menuIcon, path, component, menuType, sortNumber, authority, target, iconColor, hide, deleted, createTime, updateTime) VALUES (2614, 2607, 'DoEdit', '编辑提交', null, null, '/Api/CoreCmsWeChatPayConfig/DoEdit', 1, 5, 'CoreCmsWeChatPayConfig:DoEdit', null, null, 0, 0, '2023-04-20 23:56:20', null);
|
||||
INSERT INTO SysMenu (id, parentId, identificationCode, menuName, menuIcon, path, component, menuType, sortNumber, authority, target, iconColor, hide, deleted, createTime, updateTime) VALUES (2615, 2607, 'DoDelete', '单选删除', null, null, '/Api/CoreCmsWeChatPayConfig/DoDelete', 1, 6, 'CoreCmsWeChatPayConfig:DoDelete', null, null, 0, 0, '2023-04-20 23:56:20', null);
|
||||
INSERT INTO SysMenu (id, parentId, identificationCode, menuName, menuIcon, path, component, menuType, sortNumber, authority, target, iconColor, hide, deleted, createTime, updateTime) VALUES (2616, 2607, 'GetDetails', '预览数据', null, null, '/Api/CoreCmsWeChatPayConfig/GetDetails', 1, 7, 'CoreCmsWeChatPayConfig:GetDetails', null, null, 0, 0, '2023-04-20 23:56:20', null);
|
||||
INSERT INTO SysMenu (id, parentId, identificationCode, menuName, menuIcon, path, component, menuType, sortNumber, authority, target, iconColor, hide, deleted, createTime, updateTime) VALUES (2617, 2607, 'DoSetisEnable', '设置是否开启', null, null, '/Api/CoreCmsWeChatPayConfig/DoSetisEnable', 1, 8, 'CoreCmsWeChatPayConfig:DoSetisEnable', null, null, 0, 0, '2023-04-20 23:56:20', null);
|
||||
INSERT INTO SysMenu (id, parentId, identificationCode, menuName, menuIcon, path, component, menuType, sortNumber, authority, target, iconColor, hide, deleted, createTime, updateTime) VALUES (2618, 2607, 'DoSetisDefault', '设置是否本类默认', null, null, '/Api/CoreCmsWeChatPayConfig/DoSetisDefault', 1, 9, 'CoreCmsWeChatPayConfig:DoSetisDefault', null, null, 0, 0, '2023-04-20 23:56:20', null);
|
||||
INSERT INTO SysMenu (id, parentId, identificationCode, menuName, menuIcon, path, component, menuType, sortNumber, authority, target, iconColor, hide, deleted, createTime, updateTime) VALUES (2619, 2608, 'GetPageList', '获取列表', null, null, '/Api/CoreCmsAlipayConfig/GetPageList', 1, 0, 'CoreCmsAlipayConfig:GetPageList', null, null, 0, 0, '2023-04-20 23:56:32', null);
|
||||
INSERT INTO SysMenu (id, parentId, identificationCode, menuName, menuIcon, path, component, menuType, sortNumber, authority, target, iconColor, hide, deleted, createTime, updateTime) VALUES (2620, 2608, 'GetIndex', '首页数据', null, null, '/Api/CoreCmsAlipayConfig/GetIndex', 1, 1, 'CoreCmsAlipayConfig:GetIndex', null, null, 0, 0, '2023-04-20 23:56:32', null);
|
||||
INSERT INTO SysMenu (id, parentId, identificationCode, menuName, menuIcon, path, component, menuType, sortNumber, authority, target, iconColor, hide, deleted, createTime, updateTime) VALUES (2621, 2608, 'GetCreate', '创建数据', null, null, '/Api/CoreCmsAlipayConfig/GetCreate', 1, 2, 'CoreCmsAlipayConfig:GetCreate', null, null, 0, 0, '2023-04-20 23:56:32', null);
|
||||
INSERT INTO SysMenu (id, parentId, identificationCode, menuName, menuIcon, path, component, menuType, sortNumber, authority, target, iconColor, hide, deleted, createTime, updateTime) VALUES (2622, 2608, 'DoCreate', '创建提交', null, null, '/Api/CoreCmsAlipayConfig/DoCreate', 1, 3, 'CoreCmsAlipayConfig:DoCreate', null, null, 0, 0, '2023-04-20 23:56:32', null);
|
||||
INSERT INTO SysMenu (id, parentId, identificationCode, menuName, menuIcon, path, component, menuType, sortNumber, authority, target, iconColor, hide, deleted, createTime, updateTime) VALUES (2623, 2608, 'GetEdit', '编辑数据', null, null, '/Api/CoreCmsAlipayConfig/GetEdit', 1, 4, 'CoreCmsAlipayConfig:GetEdit', null, null, 0, 0, '2023-04-20 23:56:32', null);
|
||||
INSERT INTO SysMenu (id, parentId, identificationCode, menuName, menuIcon, path, component, menuType, sortNumber, authority, target, iconColor, hide, deleted, createTime, updateTime) VALUES (2624, 2608, 'DoEdit', '编辑提交', null, null, '/Api/CoreCmsAlipayConfig/DoEdit', 1, 5, 'CoreCmsAlipayConfig:DoEdit', null, null, 0, 0, '2023-04-20 23:56:32', null);
|
||||
INSERT INTO SysMenu (id, parentId, identificationCode, menuName, menuIcon, path, component, menuType, sortNumber, authority, target, iconColor, hide, deleted, createTime, updateTime) VALUES (2625, 2608, 'DoDelete', '单选删除', null, null, '/Api/CoreCmsAlipayConfig/DoDelete', 1, 6, 'CoreCmsAlipayConfig:DoDelete', null, null, 0, 0, '2023-04-20 23:56:32', null);
|
||||
INSERT INTO SysMenu (id, parentId, identificationCode, menuName, menuIcon, path, component, menuType, sortNumber, authority, target, iconColor, hide, deleted, createTime, updateTime) VALUES (2626, 2608, 'GetDetails', '预览数据', null, null, '/Api/CoreCmsAlipayConfig/GetDetails', 1, 7, 'CoreCmsAlipayConfig:GetDetails', null, null, 0, 0, '2023-04-20 23:56:32', null);
|
||||
INSERT INTO SysMenu (id, parentId, identificationCode, menuName, menuIcon, path, component, menuType, sortNumber, authority, target, iconColor, hide, deleted, createTime, updateTime) VALUES (2627, 2608, 'DoSetisEnable', '设置是否启用', null, null, '/Api/CoreCmsAlipayConfig/DoSetisEnable', 1, 8, 'CoreCmsAlipayConfig:DoSetisEnable', null, null, 0, 0, '2023-04-20 23:56:32', null);
|
||||
INSERT INTO SysMenu (id, parentId, identificationCode, menuName, menuIcon, path, component, menuType, sortNumber, authority, target, iconColor, hide, deleted, createTime, updateTime) VALUES (2628, 2608, 'DoSetisDefault', '设置当前多端默认', null, null, '/Api/CoreCmsAlipayConfig/DoSetisDefault', 1, 9, 'CoreCmsAlipayConfig:DoSetisDefault', null, null, 0, 0, '2023-04-20 23:56:32', null);
|
||||
1
数据库/MySql/20230424/升级脚本/3、注意.txt
Normal file
1
数据库/MySql/20230424/升级脚本/3、注意.txt
Normal file
@@ -0,0 +1 @@
|
||||
记得给角色权限
|
||||
BIN
数据库/MySql/20230424/完整数据库带商品演示20230626.rar
Normal file
BIN
数据库/MySql/20230424/完整数据库带商品演示20230626.rar
Normal file
Binary file not shown.
@@ -1,3 +1,7 @@
|
||||
2023-04-24
|
||||
【新增】表【CoreCmsAlipayConfig】支付宝支付配置表
|
||||
【新增】表【CoreCmsWeChatPayConfig】微信支付配置表
|
||||
|
||||
2023-03-27
|
||||
【新增】表【CoreCmsTopUpType】充值规则类型表
|
||||
|
||||
|
||||
BIN
数据库/SqlServer/20230424/升级脚本.rar
Normal file
BIN
数据库/SqlServer/20230424/升级脚本.rar
Normal file
Binary file not shown.
BIN
数据库/SqlServer/20230424/完整数据库带商品演示20230424.rar
Normal file
BIN
数据库/SqlServer/20230424/完整数据库带商品演示20230424.rar
Normal file
Binary file not shown.
@@ -1,3 +1,7 @@
|
||||
2023-04-24
|
||||
【新增】表【CoreCmsAlipayConfig】支付宝支付配置表
|
||||
【新增】表【CoreCmsWeChatPayConfig】微信支付配置表
|
||||
|
||||
2023-03-27
|
||||
【新增】表【CoreCmsTopUpType】充值规则类型表
|
||||
|
||||
|
||||
Reference in New Issue
Block a user