-
Notifications
You must be signed in to change notification settings - Fork 10
/
zihao.go
66 lines (51 loc) · 1.41 KB
/
zihao.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
57
58
59
60
61
62
63
64
65
66
package main
import (
"github.com/kataras/iris/v12"
"github.com/zihao-boy/zihao/app/router"
"github.com/zihao-boy/zihao/common/cache/factory"
"github.com/zihao-boy/zihao/common/crontab"
"github.com/zihao-boy/zihao/common/db/dbFactory"
"github.com/zihao-boy/zihao/common/ip"
"github.com/zihao-boy/zihao/common/jwt"
"github.com/zihao-boy/zihao/common/kafka"
"github.com/zihao-boy/zihao/config"
"strconv"
)
/**
* project address:https://github.com/zihao-boy/zihao.git
* doc address: http://bbs.homecommunity.cn/document.html?docId=102022040475300252
* author :wuxw
* email: [email protected]
*/
func main() {
config.InitConfig()
//support.InitLog()
//support.InitValidator()
//mysql.InitGorm()
dbFactory.Init()
factory.Init()
//auth.InitAuth()
jwt.InitJWT()
// load qqwry ip data
ip.InitIP()
//初始化缓存信息
factory.InitServiceSql()
//初始化映射
factory.InitMapping()
// init kafka
kafka.Init()
//启动定时任务
crontab.StartCrontab()
app := iris.New()
router.Hub(app)
app.HandleDir("/", "./web")
// app.Get("/", func(ctx iris.Context) {
// ctx.HTML("<h1>欢迎访问梓豪平台,这个是后台服务,请直接访问前段服务!</h1>")
// app.Logger().Info("欢迎访问梓豪平台,这个是后台服务,请直接访问前段服务!")
// })
port := config.G_AppConfig.Port
if port == 0 {
port = 7000
}
app.Run(iris.Addr(":" + strconv.Itoa(port)))
}