This commit is contained in:
2025-12-27 18:18:06 +08:00
parent 40cee46125
commit e2d030b061
4 changed files with 11 additions and 1 deletions

View File

@@ -46,6 +46,7 @@ type Encrypt struct {
}
type AlipayConfig struct {
Enabled bool // 是否启用支付宝支付
AppID string
PrivateKey string
AlipayPublicKey string

View File

@@ -155,7 +155,14 @@ func NewServiceContext(c config.Config) *ServiceContext {
}
// ============================== 业务服务初始化 ==============================
alipayService := service.NewAliPayService(c)
// 根据配置决定是否初始化支付宝服务
var alipayService *service.AliPayService
if c.Alipay.Enabled {
alipayService = service.NewAliPayService(c)
logx.Info("支付宝服务已启用")
} else {
logx.Info("支付宝服务已禁用")
}
// 根据配置决定是否初始化微信支付服务
var wechatPayService *service.WechatPayService