recommend.go 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package room
  2. import (
  3. "context"
  4. "fmt"
  5. "time"
  6. "github.com/pkg/errors"
  7. "go-common/app/interface/live/app-interface/conf"
  8. cDao "go-common/app/interface/live/app-interface/dao"
  9. roomV1 "go-common/app/service/live/room/api/liverpc/v1"
  10. "go-common/library/log"
  11. rpcCtx "go-common/library/net/rpc/liverpc/context"
  12. )
  13. // 获取首页推荐强推列表
  14. func (d *Dao) GetStrongRecList(ctx context.Context, recPage int64) (strongRecRoomListResp *roomV1.RoomRecommendClientRecStrongResp, err error) {
  15. strongRecRoomListResp = &roomV1.RoomRecommendClientRecStrongResp{}
  16. clientRecStrongTimeout := time.Duration(conf.GetTimeout("clientRecStrong", 100)) * time.Millisecond
  17. strongRecRoomList, err := cDao.RoomApi.V1RoomRecommend.ClientRecStrong(rpcCtx.WithTimeout(ctx, clientRecStrongTimeout), &roomV1.RoomRecommendClientRecStrongReq{
  18. RecPage: recPage,
  19. })
  20. if err != nil {
  21. log.Error("[GetStrongRecList]room.v1.clientStrongRec rpc error:%+v", err)
  22. err = errors.New(fmt.Sprintf("room.v1.clientStrongRec rpc error:%+v", err))
  23. return
  24. }
  25. if strongRecRoomList.Code != 0 {
  26. log.Error("[GetStrongRecList]room.v1.getPendantByIds response code:%d,msg:%s", strongRecRoomList.Code, strongRecRoomList.Msg)
  27. err = errors.New(fmt.Sprintf("room.v1.getPendantByIds response error, code:%d, msg:%s", strongRecRoomList.Code, strongRecRoomList.Msg))
  28. return
  29. }
  30. if strongRecRoomList.Data == nil || strongRecRoomList.Data.Result == nil {
  31. log.Error("[GetStrongRecList]room.v1.getPendantByIds empty")
  32. err = errors.New("[getSkyHorseRoomList]room.v1.getPendantByIds empty")
  33. return
  34. }
  35. strongRecRoomListResp = strongRecRoomList
  36. return
  37. }