room.go 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package dao
  2. import (
  3. "context"
  4. "go-common/app/service/live/room/api/liverpc/v1"
  5. "go-common/library/log"
  6. )
  7. //PERMANENT_LOCK_TIME 永久封禁时间
  8. const PERMANENT_LOCK_TIME = "2037-01-01 00:00:00"
  9. //GetRoomInfosByUids ...
  10. func (d *Dao) GetRoomInfosByUids(c context.Context, uid []int64) (res map[int64]*v1.RoomGetStatusInfoByUidsResp_RoomInfo, err error) {
  11. reply, err := d.RoomApi.V1Room.GetStatusInfoByUids(c, &v1.RoomGetStatusInfoByUidsReq{
  12. Uids: uid,
  13. FilterOffline: 0,
  14. ShowHidden: 1,
  15. FilterIndexBlack: 0,
  16. FilterVideo: 0,
  17. NeedBroadcastType: 0,
  18. })
  19. if err != nil {
  20. log.Error("room_getRoomInfosByUids_error:%v", err)
  21. return
  22. }
  23. if reply.Code != 0 {
  24. log.Error("room_getRoomInfosByUids_error:%d,%s,%v", reply.Code, reply.Msg, reply.Data)
  25. return
  26. }
  27. log.Info("room_getRoomInfosByUids:%d,%s,%v", reply.Code, reply.Msg, reply.Data)
  28. res = reply.Data
  29. return
  30. }
  31. //CreateRoom ...
  32. func (d *Dao) CreateRoom(c context.Context, uid int64) (res *v1.RoomMngCreateRoomResp_Data, err error) {
  33. reply, err := d.RoomApi.V1RoomMng.CreateRoom(c, &v1.RoomMngCreateRoomReq{Uid: uid})
  34. if err != nil {
  35. log.Error("room_createRoom_error:%v", err)
  36. return
  37. }
  38. if reply.Code != 0 {
  39. log.Error("room_createRoom_error:%d,%s,%v", reply.Code, reply.Msg, reply.Data)
  40. return
  41. }
  42. log.Info("room_createRoom:%d,%s,$v", reply.Code, reply.Msg, reply.Data)
  43. res = reply.Data
  44. return
  45. }