-
Notifications
You must be signed in to change notification settings - Fork 188
/
Copy pathmain.go
56 lines (43 loc) · 1.06 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package main
import (
"fmt"
fmt2 "github.com/ArtisanCloud/go-libs/fmt"
"github.com/ArtisanCloud/go-libs/object"
"github.com/ArtisanCloud/go-wechat/src/work"
"os"
"strconv"
)
func GetConfig() *object.HashMap {
agentID, _ := strconv.Atoi(os.Getenv("agent_id"))
return &object.HashMap{
"corp_id": os.Getenv("corp_id"),
"agent_id": agentID,
"secret": os.Getenv("secret"),
"response_type": os.Getenv("array"),
"log": &object.StringMap{
"level": "debug",
"file": "./wechat.log",
},
"oauth.callback": "https://wechat-work-sso-2.spacecycle.cn/callback/authorized/user",
"oauth.scopes": []string{},
"debug": true,
// server config
"token": os.Getenv("token"),
"aes_key": os.Getenv("aes_key"),
}
}
func main() {
fmt.Printf("hello Wechat! \n")
config := GetConfig()
app, err := work.NewWork(config, nil)
if err != nil {
fmt.Println(err.Error())
}
//response := app.ExternalContact.List("Matt")
//fmt2.Dump(response)
response, err := app.Server.Serve()
if err != nil {
fmt.Println(err.Error())
}
fmt2.Dump(response)
}