1
0
mirror of https://github.com/silenceper/wechat.git synced 2026-02-09 15:12:26 +08:00

rebase release-2.0

This commit is contained in:
silenceper
2020-05-23 11:59:46 +08:00
parent 2c7d3aaf3e
commit 85b0a114dc
13 changed files with 413 additions and 14 deletions

View File

@@ -0,0 +1,28 @@
package openplatform
import (
"github.com/silenceper/wechat/v2/openplatform/config"
"github.com/silenceper/wechat/v2/openplatform/context"
"github.com/silenceper/wechat/v2/openplatform/officialaccount"
)
//OpenPlatform 微信开放平台相关api
type OpenPlatform struct {
*context.Context
}
//NewOpenPlatform new openplatform
func NewOpenPlatform(cfg *config.Config) *OpenPlatform {
if cfg.Cache == nil {
panic("cache 未设置")
}
ctx := &context.Context{
Config: cfg,
}
return &OpenPlatform{ctx}
}
//GetOfficialAccount 公众号代处理
func (openPlatform *OpenPlatform) GetOfficialAccount(appID string) *officialaccount.OfficialAccount {
return officialaccount.NewOfficialAccount(openPlatform.Context, appID)
}