pk_id.go 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package av
  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. avV1 "go-common/app/service/live/av/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. // GetPkID ...
  14. // 获取PkId信息
  15. func (d *Dao) GetPkID(ctx context.Context, req *avV1.PkGetPkIdsByRoomIdsReq, params ServiceConf.ChunkCallInfo) (avResult *avV1.PkGetPkIdsByRoomIdsResp, err error) {
  16. avResult = &avV1.PkGetPkIdsByRoomIdsResp{}
  17. ret, err := dao.AvApi.V1Pk.GetPkIdsByRoomIds(rpcCtx.WithTimeout(ctx, time.Duration(params.RPCTimeout)*time.Millisecond), &avV1.PkGetPkIdsByRoomIdsReq{RoomIds: req.RoomIds, Platform: req.Platform})
  18. if err != nil {
  19. return
  20. }
  21. erelongInfo, success := ServiceConf.CheckReturn(err, ret.Code, ret.Msg, ServiceConf.GetPkIdsByRoomIds, params.RPCTimeout, params.ChunkSize, params.ChunkNum)
  22. if !success {
  23. if err != nil {
  24. err = errors.WithMessage(ecode.PkIDRecordFrameWorkCallError, "GET SEA PATROL FAIL")
  25. log.Error(erelongInfo.ErrType+"|"+erelongInfo.URLName+"|error:%+v"+"|Code:%d"+"|Msg:%s"+"|RPCTimeout:%d"+"|ChunkSize:%d"+"|ChunkNum:%d"+"|ParamsName:%s"+"|Params:%v",
  26. err, erelongInfo.Code, erelongInfo.Msg, erelongInfo.RPCTimeout, erelongInfo.ChunkSize, erelongInfo.ChunkNum, params.ParamsName, req.RoomIds)
  27. } else {
  28. err = errors.WithMessage(ecode.PkIDLiveRPCCodeError, "GET SEA PATROL FAIL")
  29. log.Error(erelongInfo.ErrType+"|"+erelongInfo.URLName+"|error:%+v"+"|Code:%d"+"|Msg:%s"+"|RPCTimeout:%d"+"|ChunkSize:%d"+"|ChunkNum:%d"+"|ParamsName:%s"+"|Params:%v",
  30. err, erelongInfo.Code, erelongInfo.Msg, erelongInfo.RPCTimeout, erelongInfo.ChunkSize, erelongInfo.ChunkNum, params.ParamsName, req.RoomIds)
  31. }
  32. return
  33. }
  34. if ret.Data == nil || len(ret.Data) <= 0 {
  35. erelongInfo.ErrType = ServiceConf.EmptyResultEn
  36. erelongInfo.ErrDesc = ServiceConf.EmptyResult
  37. log.Error(erelongInfo.ErrType+"|"+erelongInfo.URLName+"|Code:%d"+"|Msg:%s"+"|RPCTimeout:%d"+"|ChunkSize:%d"+"|ChunkNum:%d"+"|ParamsName:%s"+"|Params:%v",
  38. erelongInfo.Code, erelongInfo.Msg, erelongInfo.RPCTimeout, erelongInfo.ChunkSize, erelongInfo.ChunkNum, params.ParamsName, req.RoomIds)
  39. return
  40. }
  41. avResult = ret
  42. return
  43. }