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

开放平台基本框架

This commit is contained in:
silenceper
2020-01-21 16:36:34 +08:00
parent 15ebd71a04
commit 7e8c94a6c4
11 changed files with 401 additions and 7 deletions

View File

@@ -0,0 +1,28 @@
package openplatform
import (
"github.com/silenceper/wechat/openplatform/config"
"github.com/silenceper/wechat/openplatform/context"
"github.com/silenceper/wechat/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)
}