@@ -18,9 +18,6 @@ type OpenPlatform struct {
// NewOpenPlatform new openplatform
func NewOpenPlatform(cfg *config.Config) *OpenPlatform {
- if cfg.Cache == nil {
- panic("cache 未设置")
- }
ctx := &context.Context{
Config: cfg,
}
@@ -68,6 +68,9 @@ func (wc *Wechat) GetPay(cfg *payConfig.Config) *pay.Pay {
// GetOpenPlatform 获取微信开放平台的实例
func (wc *Wechat) GetOpenPlatform(cfg *openConfig.Config) *openplatform.OpenPlatform {
+ if cfg.Cache == nil {
+ cfg.Cache = wc.cache
+ }
return openplatform.NewOpenPlatform(cfg)