appIndex.go 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. package room
  2. import (
  3. "context"
  4. "errors"
  5. "time"
  6. "go-common/app/interface/live/app-interface/conf"
  7. cDao "go-common/app/interface/live/app-interface/dao"
  8. roomV2 "go-common/app/service/live/room/api/liverpc/v2"
  9. "go-common/library/log"
  10. rpcCtx "go-common/library/net/rpc/liverpc/context"
  11. )
  12. func (d *Dao) GetActivityCard(ctx context.Context, ids []int64, logPrefix string) (err error, data map[int64]*roomV2.AppIndexGetActivityCardResp_ActivityCard) {
  13. activityQueryTimeout := time.Duration(conf.GetTimeout("activityQuery", 100)) * time.Millisecond
  14. cardInfo, roomError := cDao.RoomApi.V2AppIndex.GetActivityCard(rpcCtx.WithTimeout(ctx, activityQueryTimeout), &roomV2.AppIndexGetActivityCardReq{Ids: ids})
  15. if roomError != nil {
  16. log.Error("[%s] get activity card info rpc error, room.v2.AppIndex.GetActivityCard, error:%+v", logPrefix, roomError)
  17. err = errors.New("get activity card info rpc error")
  18. return
  19. }
  20. if cardInfo.Code != 0 {
  21. log.Error("[%s] get activity card info response error, code, %d, msg: %s", logPrefix, cardInfo.Code, cardInfo.Msg)
  22. err = errors.New("get activity card info response error")
  23. return
  24. }
  25. if cardInfo.Data.ActivityCard == nil {
  26. log.Error("[%s] get activity card info but on data", logPrefix)
  27. err = errors.New("get activity card info but no data")
  28. return
  29. }
  30. data = cardInfo.Data.ActivityCard
  31. return
  32. }