12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- package http
- import (
- "net/http"
- "go-common/app/job/main/account-summary/conf"
- "go-common/app/job/main/account-summary/service"
- "go-common/library/log"
- bm "go-common/library/net/http/blademaster"
- )
- var (
- srv *service.Service
- )
- // Init init
- func Init(c *conf.Config) {
- srv = service.New(c)
- engine := bm.DefaultServer(c.BM)
- router(engine)
- if err := engine.Start(); err != nil {
- log.Error("bm.DefaultServer error(%v)", err)
- panic(err)
- }
- }
- func router(e *bm.Engine) {
- e.Ping(ping)
- e.Register(register)
- g := e.Group("/x/internal/account-summary")
- {
- g.GET("/sync/one", syncOne)
- g.GET("/get/one", getOne)
- }
- }
- func ping(c *bm.Context) {
- if err := srv.Ping(c); err != nil {
- log.Error("account-summary-job ping error(%v)", err)
- c.AbortWithStatus(http.StatusServiceUnavailable)
- }
- }
- func register(c *bm.Context) {
- c.JSON(map[string]interface{}{}, nil)
- }
|