Skip to content

Commit

Permalink
重新组织 wechat payment 的配置 (#193)
Browse files Browse the repository at this point in the history
  • Loading branch information
flycash authored Jun 5, 2024
2 parents 9436ff2 + ef697a1 commit 867d74e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
17 changes: 10 additions & 7 deletions config/config.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
wechat:
appID: abc
mchID: abc
mchKey: abc
mchSerialNum: abc
certPath: abc
keyPath: abc
appSecretID: abc
appSecretKey: abc
loginRedirectURL: "your/callback"
paymentNotifyURL: "your/notifyURL"
# 支付配置
payment:
appID: abc
mchID: abc
mchKey: abc
mchSerialNum: abc
certPath: abc
keyPath: abc
paymentNotifyURL: "your/notifyURL"


mysql:
dsn: "webook:webook@tcp(mysql8:3306)/webook?charset=utf8mb4&collation=utf8mb4_general_ci&parseTime=True&loc=Local&timeout=1s&readTimeout=3s&writeTimeout=3s"
Expand Down
13 changes: 5 additions & 8 deletions internal/payment/ioc/wechat.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,12 @@ func InitWechatNotifyHandler(cfg WechatConfig) *notify.Handler {
}

func InitWechatConfig() WechatConfig {
return WechatConfig{
AppID: econf.GetString("wechat.appID"),
MchID: econf.GetString("wechat.mchID"),
MchKey: econf.GetString("wechat.mchKey"),
MchSerialNum: econf.GetString("wechat.mchSerialNum"),
CertPath: econf.GetString("wechat.certPath"),
KeyPath: econf.GetString("wechat.keyPath"),
PaymentNotifyURL: econf.GetString("wechat.paymentNotifyURL"),
var cfg WechatConfig
err := econf.UnmarshalKey("wechat.payment", &cfg)
if err != nil {
panic(err)
}
return cfg
}

type WechatConfig struct {
Expand Down

0 comments on commit 867d74e

Please sign in to comment.