main.go 729 Bytes
Newer Older
chenweijian's avatar
chenweijian committed
1 2 3 4
package main

import (
	"fmt"
hujiebin's avatar
hujiebin committed
5
	"git.hilo.cn/hilo-common/resource/consul"
iamhujiebin's avatar
iamhujiebin committed
6
	"git.hilo.cn/hilo-common/resource/redisCli"
hujiebin's avatar
hujiebin committed
7
	"hilo-user/cron"
hujiebin's avatar
hujiebin committed
8
	"hilo-user/domain/service/event_s"
chenweijian's avatar
chenweijian committed
9 10 11 12
	"hilo-user/route"
)

const (
hujiebin's avatar
hujiebin committed
13 14 15
	PORT         = 9040
	RegisterName = "hiloUser"
	RegisterTag  = "用户中心"
chenweijian's avatar
chenweijian committed
16 17 18
)

func main() {
iamhujiebin's avatar
iamhujiebin committed
19
	redisCli.AddRedisHook()
hujiebin's avatar
hujiebin committed
20
	cron.Init()                                              // 开启定时任务
hujiebin's avatar
hujiebin committed
21
	event_s.EventInit()                                      // 注册事件(内部事件+mysql拟kafka)
hujiebin's avatar
hujiebin committed
22 23 24
	r := route.InitRouter()                                  // 注册路由
	consul.RegisterToConsul(PORT, RegisterName, RegisterTag) // 服务注册
	r.Run(fmt.Sprintf(":%d", PORT))                          // 启动服务
chenweijian's avatar
chenweijian committed
25
}