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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package main
//import (
// "flag"
// "net/http"
//
// "git.zc0901.com/go/god/example/wechat/pkg"
//
// "git.zc0901.com/go/god/api"
// "git.zc0901.com/go/god/lib/conf"
// "git.zc0901.com/go/god/lib/logx"
//)
//
//var (
// configFile = flag.String("f", "config.yaml", "API 配置文件")
// handlers *pkg.OpenHandlers
//)
//
//func init() {
// handlers = pkg.NewOpenHandlers()
//}
//
//func main() {
// flag.Parse()
// var apiConf api.ServerConf
// conf.MustLoad(*configFile, &apiConf)
//
// server := api.MustNewServer(apiConf)
// defer server.Stop()
//
// server.AddRoute(api.Route{
// Method: http.MethodGet,
// Path: "/home",
// Handler: homeHandler,
// })
//
// // 授权事件接收配置
// server.AddRoute(api.Route{
// Method: http.MethodPost,
// Path: "/oplatform/wxbef357be217c23c5/notify",
// Handler: handlers.Notify,
// })
//
// // 获取 component_verify_ticket 后,查看平台令牌
// server.AddRoute(api.Route{
// Method: http.MethodGet,
// Path: "/oplatform/wxbef357be217c23c5/accesstoken",
// Handler: handlers.AccessToken,
// })
//
// // 生成PC版/移动版平台授权码 ?isMobile=1
// server.AddRoute(api.Route{
// Method: http.MethodGet,
// Path: "/oplatform/wxbef357be217c23c5/auth",
// Handler: handlers.Auth,
// })
//
// // 授权方授权后跳转网址
// server.AddRoute(api.Route{
// Method: http.MethodGet,
// Path: "/oplatform/wxbef357be217c23c5/redirect",
// Handler: handlers.Redirect,
// })
//
// // 根据微信重定向带过来的授权码查询授权信息
// server.AddRoute(api.Route{
// Method: http.MethodGet,
// Path: "/oplatform/wxbef357be217c23c5/queryauth",
// Handler: handlers.QueryAuth,
// })
//
// logx.Infof("微信响应 API NewServer 已启动 —— %v:%v", apiConf.Host, apiConf.Port)
// server.Start()
//}
//
//func homeHandler(w http.ResponseWriter, r *http.Request) {
// w.WriteHeader(200)
//
// w.Write([]byte("hello world"))
//}