| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- package wechat
- import (
- "dashoo.cn/opms_libary/plugin/wechat/mp/account"
- "dashoo.cn/opms_libary/plugin/wechat/mp/bridge"
- "dashoo.cn/opms_libary/plugin/wechat/mp/jssdk"
- "dashoo.cn/opms_libary/plugin/wechat/mp/material"
- "dashoo.cn/opms_libary/plugin/wechat/mp/menu"
- "dashoo.cn/opms_libary/plugin/wechat/mp/oauth"
- "dashoo.cn/opms_libary/plugin/wechat/mp/template"
- "dashoo.cn/opms_libary/plugin/wechat/mp/user"
- "net/http"
- )
- type Media struct {
- *ClientImpl
- }
- func NewMedia() *Media {
- return &Media{}
- }
- //GetAccessToken 获取access_token
- func (c *Media) GetAccessToken() (string, error) {
- return c.Context.GetAccessToken()
- }
- // GetOauth oauth2网页授权
- func (c *Media) GetOauth() *oauth.Oauth {
- return oauth.NewOauth(c.Context)
- }
- // GetMaterial 素材管理
- func (c *Media) GetMaterial() *material.Material {
- return material.NewMaterial(c.Context)
- }
- // GetJs js-sdk配置
- func (c *Media) GetJs() *jssdk.Js {
- return jssdk.NewJs(c.Context)
- }
- // GetMenu 菜单管理接口
- func (c *Media) GetMenu() *menu.Menu {
- return menu.NewMenu(c.Context)
- }
- // GetUser 用户管理接口
- func (c *Media) GetUser() *user.User {
- return user.NewUser(c.Context)
- }
- // GetTemplate 模板消息接口
- func (c *Media) GetTemplate() *template.Template {
- return template.NewTemplate(c.Context)
- }
- // GetMsgHandler 消息管理
- func (c *Media) GetMsgHandler(req *http.Request, writer http.ResponseWriter) *bridge.MsgHandler {
- c.Context.Request = req
- c.Context.Writer = writer
- return bridge.NewMsgHandler(c.Context)
- }
- //GetPageOAuthHandler 网页授权
- func (c *Media) GetPageOAuthHandler(req *http.Request, writer http.ResponseWriter, myURLOfPageOAuthCallback string) *bridge.PageOAuthHandler {
- c.Context.Request = req
- c.Context.Writer = writer
- handler := bridge.NewPageOAuthHandler(c.Context, myURLOfPageOAuthCallback)
- return handler
- }
- // GetQrcode 带参数的二维码
- func (c *Media) GetQrcode() *account.Qrcode {
- return account.NewQrcode(c.Context)
- }
|