news.go 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package room_ex
  2. import (
  3. "context"
  4. "github.com/pkg/errors"
  5. ServiceConf "go-common/app/interface/live/app-interface/conf"
  6. cDao "go-common/app/interface/live/app-interface/dao"
  7. roomExV1 "go-common/app/service/live/room_ex/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. func (d *Dao) GetRoomNewsInfo(ctx context.Context, req *roomExV1.RoomNewsMultiGetReq, params ServiceConf.ChunkCallInfo) (roomNewsResult *roomExV1.RoomNewsMultiGetResp, err error) {
  14. roomNewsResult = &roomExV1.RoomNewsMultiGetResp{}
  15. ret, err := cDao.RoomExtApi.V1RoomNews.MultiGet(rpcCtx.WithTimeout(ctx, time.Duration(params.RPCTimeout)*time.Millisecond),
  16. &roomExV1.RoomNewsMultiGetReq{RoomIds: req.RoomIds, IsDecoded: req.IsDecoded})
  17. if err != nil {
  18. return
  19. }
  20. erelongInfo, success := ServiceConf.CheckReturn(err, ret.Code, ret.Msg, ServiceConf.RoomNews, params.RPCTimeout, params.ChunkSize, params.ChunkNum)
  21. if !success {
  22. if err != nil {
  23. err = errors.WithMessage(ecode.RoomNewsRecordFrameWorkCallError, "GET SEA PATROL FAIL")
  24. log.Error(erelongInfo.ErrType+"|"+erelongInfo.URLName+"|error:%+v"+"|Code:%d"+"|Msg:%s"+"|RPCTimeout:%d"+"|ChunkSize:%d"+"|ChunkNum:%d"+"|ParamsName:%s"+"|Params:%v",
  25. err, erelongInfo.Code, erelongInfo.Msg, erelongInfo.RPCTimeout, erelongInfo.ChunkSize, erelongInfo.ChunkNum, params.ParamsName, req.RoomIds)
  26. } else {
  27. err = errors.WithMessage(ecode.RoomNewsLiveRPCCodeError, "GET SEA PATROL FAIL")
  28. log.Error(erelongInfo.ErrType+"|"+erelongInfo.URLName+"|error:%+v"+"|Code:%d"+"|Msg:%s"+"|RPCTimeout:%d"+"|ChunkSize:%d"+"|ChunkNum:%d"+"|ParamsName:%s"+"|Params:%v",
  29. err, erelongInfo.Code, erelongInfo.Msg, erelongInfo.RPCTimeout, erelongInfo.ChunkSize, erelongInfo.ChunkNum, params.ParamsName, req.RoomIds)
  30. }
  31. return nil, err
  32. }
  33. if ret.Data == nil {
  34. erelongInfo.ErrType = ServiceConf.EmptyResultEn
  35. erelongInfo.ErrDesc = ServiceConf.EmptyResult
  36. log.Error(erelongInfo.ErrType+"|"+erelongInfo.URLName+"|Code:%d"+"|Msg:%s"+"|RPCTimeout:%d"+"|ChunkSize:%d"+"|ChunkNum:%d"+"|ParamsName:%s"+"|Params:%v",
  37. erelongInfo.Code, erelongInfo.Msg, erelongInfo.RPCTimeout, erelongInfo.ChunkSize, erelongInfo.ChunkNum, params.ParamsName, req.RoomIds)
  38. return nil, err
  39. }
  40. roomNewsResult = ret
  41. return
  42. }