status.go 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package room
  2. import (
  3. "context"
  4. "github.com/pkg/errors"
  5. ServiceConf "go-common/app/interface/live/app-interface/conf"
  6. "go-common/app/interface/live/app-interface/dao"
  7. roomV1 "go-common/app/service/live/room/api/liverpc/v1"
  8. "go-common/library/ecode"
  9. "go-common/library/log"
  10. rpcCtx "go-common/library/net/rpc/liverpc/context"
  11. "time"
  12. )
  13. // GetRoomInfo ...
  14. // 获取room信息
  15. func (d *Dao) GetRoomInfo(ctx context.Context, req *roomV1.RoomGetStatusInfoByUidsReq, params ServiceConf.ChunkCallInfo) (resp *roomV1.RoomGetStatusInfoByUidsResp, err error) {
  16. // ret, err := dao.FansMedalApi.V1FansMedal.TargetsWithMedal(rpcCtx.WithTimeout(ctx, time.Duration(params.RPCTimeout)*time.Millisecond),
  17. resp = &roomV1.RoomGetStatusInfoByUidsResp{}
  18. ret, err := dao.RoomApi.V1Room.GetStatusInfoByUids(rpcCtx.WithTimeout(ctx, time.Duration(params.RPCTimeout)*time.Millisecond),
  19. &roomV1.RoomGetStatusInfoByUidsReq{Uids: req.Uids, FilterOffline: req.FilterOffline, NeedBroadcastType: req.NeedBroadcastType})
  20. if err != nil {
  21. return
  22. }
  23. erelongInfo, success := ServiceConf.CheckReturn(err, ret.Code, ret.Msg, ServiceConf.GetStatusInfoByUfos, params.RPCTimeout, params.ChunkSize, params.ChunkNum)
  24. if !success {
  25. if err != nil {
  26. err = errors.WithMessage(ecode.RoomGetStatusInfoRPCError, "GET SEA PATROL FAIL")
  27. log.Error(erelongInfo.ErrType+"|"+erelongInfo.URLName+"|error:%+v"+"|Code:%d"+"|Msg:%s"+"|RPCTimeout:%d"+"|ChunkSize:%d"+"|ChunkNum:%d"+"|ParamsName:%s"+"|Params:%v",
  28. err, erelongInfo.Code, erelongInfo.Msg, erelongInfo.RPCTimeout, erelongInfo.ChunkSize, erelongInfo.ChunkNum, params.ParamsName, req.Uids)
  29. } else {
  30. err = errors.WithMessage(ecode.RoomGetStatusInfoRPCError, "GET SEA PATROL FAIL")
  31. log.Error(erelongInfo.ErrType+"|"+erelongInfo.URLName+"|error:%+v"+"|Code:%d"+"|Msg:%s"+"|RPCTimeout:%d"+"|ChunkSize:%d"+"|ChunkNum:%d"+"|ParamsName:%s"+"|Params:%v",
  32. err, erelongInfo.Code, erelongInfo.Msg, erelongInfo.RPCTimeout, erelongInfo.ChunkSize, erelongInfo.ChunkNum, params.ParamsName, req.Uids)
  33. }
  34. return
  35. }
  36. if ret.Data == nil || len(ret.Data) <= 0 {
  37. erelongInfo.ErrType = ServiceConf.EmptyResultEn
  38. erelongInfo.ErrDesc = ServiceConf.EmptyResult
  39. // log.Error(erelongInfo.ErrType+"|"+erelongInfo.URLName+"|Code:%d"+"|Msg:%s"+"|RPCTimeout:%d"+"|ChunkSize:%d"+"|ChunkNum:%d"+"|ParamsName:%s"+"|Params:%v",
  40. // erelongInfo.Code, erelongInfo.Msg, erelongInfo.RPCTimeout, erelongInfo.ChunkSize, erelongInfo.ChunkNum, params.ParamsName, req.Uids)
  41. return
  42. }
  43. resp = ret
  44. return
  45. }