api.go 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. package dao
  2. import (
  3. "go-common/app/interface/live/app-interface/conf"
  4. avApi "go-common/app/service/live/av/api/liverpc"
  5. fansMedalApi "go-common/app/service/live/fans_medal/api/liverpc"
  6. liveDataApi "go-common/app/service/live/live_data/api/liverpc"
  7. liveUserApi "go-common/app/service/live/live_user/api/liverpc"
  8. rankdbApi "go-common/app/service/live/rankdb/api/liverpc"
  9. relationApi "go-common/app/service/live/relation/api/liverpc"
  10. roomApi "go-common/app/service/live/room/api/liverpc"
  11. roomExApi "go-common/app/service/live/room_ex/api/liverpc"
  12. bvcApi "go-common/app/service/live/third_api/bvc"
  13. skyHorseApi "go-common/app/service/live/third_api/skyhorse"
  14. userExtApi "go-common/app/service/live/userext/api/liverpc"
  15. xuserApi "go-common/app/service/live/xuser/api/grpc/v1"
  16. "go-common/library/net/rpc/liverpc"
  17. )
  18. // RoomApi liveRpc room-service api
  19. var RoomApi *roomApi.Client
  20. // AvApi liveRpc room-service api
  21. var AvApi *avApi.Client
  22. // RoomRawApi liveRpc room-service api
  23. var RoomRawApi *liverpc.Client
  24. // LiveUserApi liveRpc room-service api
  25. var LiveUserApi *liveUserApi.Client
  26. // RelationApi liveRpc room-service api
  27. var RelationApi *relationApi.Client
  28. // BvcApi liveRpc room-service api
  29. var BvcApi *bvcApi.Client
  30. // SkyHorseApi ... liveRpc room-service api
  31. var SkyHorseApi *skyHorseApi.Client
  32. // UserExtApi liveRpc room-service api
  33. var UserExtApi *userExtApi.Client
  34. // LiveDataApi liveRpc room-service api
  35. var LiveDataApi *liveDataApi.Client
  36. // RoomExtApi liveRpc room-service api
  37. var RoomExtApi *roomExApi.Client
  38. // FansMedalApi liveRpc room-service api
  39. var FansMedalApi *fansMedalApi.Client
  40. // RankdbApi liveRpc rankdb-service api
  41. var RankdbApi *rankdbApi.Client
  42. // RankdbApi liveRpc rankdb-service api
  43. var XuserApi *xuserApi.Client
  44. // InitAPI init all service APIs
  45. func InitAPI() {
  46. RoomApi = roomApi.New(getConf("room"))
  47. AvApi = avApi.New(getConf("av"))
  48. RoomExtApi = roomExApi.New(getConf("roomex"))
  49. LiveUserApi = liveUserApi.New(getConf("live_user"))
  50. RelationApi = relationApi.New(getConf("relation"))
  51. BvcApi = bvcApi.New(conf.Conf.HttpClient, getBvcConf("host"), getBvcConf("mock"))
  52. SkyHorseApi = skyHorseApi.New(conf.Conf.HttpClient)
  53. RoomRawApi = liverpc.NewClient(getConf("room"))
  54. UserExtApi = userExtApi.New(getConf("userext"))
  55. LiveDataApi = liveDataApi.New(getConf("livedata"))
  56. FansMedalApi = fansMedalApi.New(getConf("fansmedal"))
  57. RankdbApi = rankdbApi.New(getConf("rankdb"))
  58. }
  59. func getConf(appName string) *liverpc.ClientConfig {
  60. c := conf.Conf.LiveRpc
  61. if c != nil {
  62. return c[appName]
  63. }
  64. return nil
  65. }
  66. func getBvcConf(name string) string {
  67. c := conf.Conf.Bvc
  68. if c == nil {
  69. return ""
  70. }
  71. if _, ok := c[name]; ok {
  72. return c[name]
  73. }
  74. return ""
  75. }