6
0

main.go 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package main
  2. import (
  3. "context"
  4. "lims_adapter/handler"
  5. _ "lims_adapter/boot"
  6. "dashoo.cn/micro_libary/micro_srv"
  7. "github.com/gogf/gf/frame/g"
  8. "github.com/smallnest/rpcx/protocol"
  9. )
  10. func main() {
  11. srvAddr := g.Config().GetString("setting.bind-addr")
  12. basePath := g.Config().GetString("setting.srv-name")
  13. // 创建总服务包
  14. s := micro_srv.CreateAndInitService(basePath)
  15. // 注册服务对象
  16. s.RegisterName("Meeting", new(handler.Meeting), "")
  17. s.RegisterName("Reservation", new(handler.Reservation), "")
  18. s.RegisterName("Equipment", new(handler.Equipment), "")
  19. s.RegisterName("System", new(handler.System), "")
  20. s.RegisterName("Result", new(handler.Result), "")
  21. s.RegisterName("Account", new(handler.Account), "")
  22. s.RegisterName("SettleAccountBill", new(handler.SettleAccountBillController), "")
  23. s.RegisterName("SettleAccountMain", new(handler.SettleAccountMainController), "")
  24. s.RegisterName("SettleAccountDetail", new(handler.SettleAccountDetailController), "")
  25. s.RegisterName("InstrumentSurcharge", new(handler.InstrumentSurchargeController), "")
  26. // 注册auth处理
  27. s.AuthFunc = handleAuth
  28. // 运行服务
  29. if err := s.Serve("tcp", srvAddr); err != nil {
  30. g.Log().Fatal(err)
  31. }
  32. }
  33. // AuthExcludePaths 设定不需要认证的路径
  34. //var AuthExcludePaths = []string{}
  35. // 处理Auth
  36. func handleAuth(ctx context.Context, req *protocol.Message, token string) error {
  37. return micro_srv.HandleAuth(ctx, req, token, nil)
  38. }