server.go 588 B

1234567891011121314151617181920212223242526
  1. package grpc
  2. import (
  3. "fmt"
  4. pb "go-common/app/service/live/gift/api/grpc/v1"
  5. "go-common/app/service/live/gift/conf"
  6. "go-common/app/service/live/gift/dao"
  7. svc "go-common/app/service/live/gift/service/v1"
  8. "go-common/library/log"
  9. "go-common/library/net/rpc/warden"
  10. )
  11. //Init Init
  12. func Init(c *conf.Config) {
  13. s := warden.NewServer(nil) // 酌情传入config
  14. dao.InitApi()
  15. gs := svc.NewGiftService(c)
  16. pb.RegisterGiftServer(s.Server(), gs)
  17. _, err := s.Start()
  18. if err != nil {
  19. log.Error("grpc Start error(%v)", err)
  20. panic(err)
  21. }
  22. fmt.Println("start")
  23. gs.TickerReloadGift()
  24. }