-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.go
50 lines (42 loc) · 1.26 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
package main
import (
"github.com/sirupsen/logrus"
"os"
"os/signal"
"syscall"
"time"
"wechat-mp-server/config"
"wechat-mp-server/hub" // 框架
"wechat-mp-server/module/steggoDemo"
"wechat-mp-server/utils"
"wechat-mp-server/module/pong"
"wechat-mp-server/module/quickNav"
"wechat-mp-server/module/templateMessage"
"wechat-mp-server/module/timeoutTest"
"wechat-mp-server/module/wechatPong"
//_ "wechat-mp-server/module/wechatApiProxy" // 微信管理员代理模块 用于代理Wechat相关api接口并自动加上accessToken
)
func init() {
utils.WriteLogToFS()
config.Init()
time.Local = time.FixedZone("UTC+8", 8*60*60)
}
func main() {
logrus.Info("wechat-mp-server version: ", config.Version)
// 新增module后请在下方引入
hub.RegisterModule(
&pong.Mod{}, // gin的ping-pong模块
&wechatPong.Mod{}, // 微信ping-pong模块
&quickNav.Mod{}, // 快捷导航模块 用于解决微信菜单按钮不足的情况
&templateMessage.Mod{}, // 提供发送模板消息api
&timeoutTest.Mod{}, // 超时回复测试模块
&steggoDemo.Mod{}, // steggo的应用案例
)
hub.Init()
hub.StartService()
hub.Run()
ch := make(chan os.Signal, 1)
signal.Notify(ch, os.Interrupt, syscall.SIGTERM)
<-ch
hub.Stop()
}