1 Star 0 Fork 0

五度曲橙 / golang-wechat-sdk

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
openplatform.go 1.50 KB
一键复制 编辑 原始数据 按行查看 历史
五度曲橙 提交于 2021-06-11 11:03 . first commit
package openplatform
import (
"net/http"
"gitee.com/qucheng/golang-wechat-sdk/officialaccount/server"
"gitee.com/qucheng/golang-wechat-sdk/openplatform/account"
"gitee.com/qucheng/golang-wechat-sdk/openplatform/config"
"gitee.com/qucheng/golang-wechat-sdk/openplatform/context"
"gitee.com/qucheng/golang-wechat-sdk/openplatform/miniprogram"
"gitee.com/qucheng/golang-wechat-sdk/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}
}
//GetServer get server
func (openPlatform *OpenPlatform) GetServer(req *http.Request, writer http.ResponseWriter) *server.Server {
off := officialaccount.NewOfficialAccount(openPlatform.Context, "")
return off.GetServer(req, writer)
}
//GetOfficialAccount 公众号代处理
func (openPlatform *OpenPlatform) GetOfficialAccount(appID string) *officialaccount.OfficialAccount {
return officialaccount.NewOfficialAccount(openPlatform.Context, appID)
}
//GetMiniProgram 小程序代理
func (openPlatform *OpenPlatform) GetMiniProgram(appID string) *miniprogram.MiniProgram {
return miniprogram.NewMiniProgram(openPlatform.Context, appID)
}
//GetAccountManager 账号管理
//TODO
func (openPlatform *OpenPlatform) GetAccountManager() *account.Account {
return account.NewAccount(openPlatform.Context)
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/qucheng/golang-wechat-sdk.git
git@gitee.com:qucheng/golang-wechat-sdk.git
qucheng
golang-wechat-sdk
golang-wechat-sdk
a0c205eb99dc

搜索帮助

344bd9b3 5694891 D2dac590 5694891