mirror of
https://github.com/silenceper/wechat.git
synced 2026-02-08 22:52:27 +08:00
增加企业微信 企业内部开发模块 (#418)
* 增加小程序内容安全接口 * 内容安全接口 按照golint规范进行优化 * 内容安全接口 按照golint规范进行优化 * 删除CheckImage中的输出代码 * 小程序内容安全接口 * 小程序内容安全接口 * 小程序内容安全接口 1:修改返回值 改为error异常统一返回 * 增加企业微信 企业内部开发模块 1:授权登录 * 增加企业微信 企业内部开发模块 * 修改参数为小写 * 优化参数格式 Co-authored-by: root <admin@example.com>
This commit is contained in:
33
work/work.go
Normal file
33
work/work.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package work
|
||||
|
||||
import (
|
||||
"github.com/silenceper/wechat/v2/credential"
|
||||
"github.com/silenceper/wechat/v2/work/config"
|
||||
"github.com/silenceper/wechat/v2/work/context"
|
||||
"github.com/silenceper/wechat/v2/work/oauth"
|
||||
)
|
||||
|
||||
// Work 企业微信
|
||||
type Work struct {
|
||||
ctx *context.Context
|
||||
}
|
||||
|
||||
//NewWork init work
|
||||
func NewWork(cfg *config.Config) *Work {
|
||||
defaultAkHandle := credential.NewWorkAccessToken(cfg.CorpID, cfg.CorpSecret, credential.CacheKeyWorkPrefix, cfg.Cache)
|
||||
ctx := &context.Context{
|
||||
Config: cfg,
|
||||
AccessTokenHandle: defaultAkHandle,
|
||||
}
|
||||
return &Work{ctx: ctx}
|
||||
}
|
||||
|
||||
//GetContext get Context
|
||||
func (wk *Work) GetContext() *context.Context {
|
||||
return wk.ctx
|
||||
}
|
||||
|
||||
//GetOauth get oauth
|
||||
func (wk *Work) GetOauth() *oauth.Oauth {
|
||||
return oauth.NewOauth(wk.ctx)
|
||||
}
|
||||
Reference in New Issue
Block a user