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

完善企业微信API

This commit is contained in:
hb
2021-10-28 14:21:02 +08:00
parent d3f1a83d46
commit 7e24cb9e8d
10 changed files with 952 additions and 0 deletions

View File

@@ -7,6 +7,10 @@ import (
"github.com/silenceper/wechat/v2/work/kf"
"github.com/silenceper/wechat/v2/work/msgaudit"
"github.com/silenceper/wechat/v2/work/oauth"
"github.com/silenceper/wechat/v2/work/server"
"github.com/silenceper/wechat/v2/work/tools"
"github.com/silenceper/wechat/v2/work/user"
"net/http"
)
// Work 企业微信
@@ -29,6 +33,14 @@ func (wk *Work) GetContext() *context.Context {
return wk.ctx
}
// GetServer 消息管理:接收事件,被动回复消息管理
func (wk *Work) GetServer(req *http.Request, writer http.ResponseWriter) *server.Server {
srv := server.NewServer(wk.ctx)
srv.Request = req
srv.Writer = writer
return srv
}
//GetOauth get oauth
func (wk *Work) GetOauth() *oauth.Oauth {
return oauth.NewOauth(wk.ctx)
@@ -43,3 +55,13 @@ func (wk *Work) GetMsgAudit() (*msgaudit.Client, error) {
func (wk *Work) GetKF() (*kf.Client, error) {
return kf.NewClient(wk.ctx.Config)
}
//GetUser get user
func (wk *Work) GetUser() *user.User {
return user.NewUser(wk.ctx)
}
//GetCalendar get calendar
func (wk *Work) GetCalendar() *tools.Calendar {
return tools.NewCalendar(wk.ctx)
}