JXServer+Live.m 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. //
  2. // JXServer+Live.m
  3. // shiku_im
  4. //
  5. // Created by 1 on 17/6/14.
  6. // Copyright © 2017年 Reese. All rights reserved.
  7. //
  8. #import "JXServer+Live.h"
  9. @implementation JXServer (Live)
  10. -(void)listLiveRoom:(int)page status:(NSInteger)status toView:(id)toView{
  11. JXConnection* p = [self addTask:act_liveRoomList param:nil toView:toView];
  12. [p setPostValue:self.access_token forKey:@"access_token"];
  13. [p setPostValue:[NSNumber numberWithInt:jx_page_size] forKey:@"pageSize"];
  14. [p setPostValue:[NSNumber numberWithInt:page] forKey:@"pageIndex"];
  15. if (status)
  16. [p setPostValue:[NSNumber numberWithInteger:status] forKey:@"status"];
  17. [p go];
  18. }
  19. -(void)createLiveRoom:(NSString*)userId nickName:(NSString*)nickName roomName:(NSString*)roomName notice:(NSString*)notice jid:(NSString *)jid toView:(id)toView{
  20. JXConnection* p = [self addTask:act_liveRoomCreate param:nil toView:toView];
  21. [p setPostValue:roomName forKey:@"name"];
  22. [p setPostValue:nickName forKey:@"nickName"];
  23. [p setPostValue:userId forKey:@"userId"];
  24. [p setPostValue:notice forKey:@"notice"];
  25. [p setPostValue:jid forKey:@"jid"];
  26. [p setPostValue:self.access_token forKey:@"access_token"];
  27. [p go];
  28. }
  29. -(void)getLiveRoom:(NSString*)liveRoomId toView:(id)toView{
  30. JXConnection* p = [self addTask:act_liveRoomGet param:nil toView:toView];
  31. [p setPostValue:liveRoomId forKey:@"roomId"];
  32. [p setPostValue:self.access_token forKey:@"access_token"];
  33. [p go];
  34. }
  35. -(void)updateLiveRoom:(NSString*)liveRoomId nickName:(NSString*)nickName name:(NSString*)name notice:(NSString*)notice toView:(id)toView{
  36. JXConnection* p = [self addTask:act_liveRoomUpdate param:nil toView:toView];
  37. [p setPostValue:name forKey:@"name"];
  38. [p setPostValue:nickName forKey:@"nickName"];
  39. [p setPostValue:liveRoomId forKey:@"roomId"];
  40. // [p setPostValue:url forKey:@"url"];
  41. [p setPostValue:notice forKey:@"notice"];
  42. [p setPostValue:self.access_token forKey:@"access_token"];
  43. [p go];
  44. }
  45. -(void)deleteLiveRoom:(NSString*)liveRoomId toView:(id)toView{
  46. JXConnection* p = [self addTask:act_liveRoomDelete param:nil toView:toView];
  47. [p setPostValue:liveRoomId forKey:@"roomId"];
  48. [p setPostValue:self.access_token forKey:@"access_token"];
  49. [p go];
  50. }
  51. -(void)liveRoomMembers:(NSString*)liveRoomId toView:(id)toView{
  52. JXConnection* p = [self addTask:act_liveRoomMemberList param:nil toView:toView];
  53. [p setPostValue:liveRoomId forKey:@"roomId"];
  54. [p setPostValue:self.access_token forKey:@"access_token"];
  55. [p go];
  56. }
  57. -(void)enterLiveRoom:(NSString*)liveRoomId toView:(id)toView{
  58. JXConnection* p = [self addTask:act_liveRoomEnter param:nil toView:toView];
  59. [p setPostValue:liveRoomId forKey:@"roomId"];
  60. [p setPostValue:self.access_token forKey:@"access_token"];
  61. [p go];
  62. }
  63. -(void)quitLiveRoom:(NSString*)liveRoomId toView:(id)toView{
  64. JXConnection* p = [self addTask:act_liveRoomQuit param:nil toView:toView];
  65. [p setPostValue:liveRoomId forKey:@"roomId"];
  66. [p setPostValue:g_myself.userId forKey:@"userId"];
  67. [p setPostValue:self.access_token forKey:@"access_token"];
  68. [p go];
  69. }
  70. -(void)getLiveRoomMember:(NSString*)userId liveRoomId:(NSString*)liveRoomId toView:(id)toView{
  71. JXConnection* p = [self addTask:act_liveRoomGetMember param:nil toView:toView];
  72. [p setPostValue:liveRoomId forKey:@"roomId"];
  73. [p setPostValue:userId forKey:@"userId"];
  74. [p setPostValue:self.access_token forKey:@"access_token"];
  75. [p go];
  76. }
  77. -(void)liveRoomSetManager:(NSString*)userId liveRoomId:(NSString*)liveRoomId type:(int)type toView:(id)toView{
  78. JXConnection* p = [self addTask:act_liveRoomSetManager param:nil toView:toView];
  79. [p setPostValue:liveRoomId forKey:@"roomId"];
  80. [p setPostValue:userId forKey:@"userId"];
  81. [p setPostValue:[NSNumber numberWithInt:type] forKey:@"type"];
  82. [p setPostValue:self.access_token forKey:@"access_token"];
  83. [p go];
  84. }
  85. -(void)liveRoomShutUPMember:(NSString*)userId liveRoomId:(NSString*)liveRoomId state:(NSInteger)state toView:(id)toView{
  86. JXConnection* p = [self addTask:act_liveRoomShutUP param:nil toView:toView];
  87. [p setPostValue:liveRoomId forKey:@"roomId"];
  88. [p setPostValue:userId forKey:@"userId"];
  89. [p setPostValue:[NSNumber numberWithInteger:state] forKey:@"state"];
  90. [p setPostValue:self.access_token forKey:@"access_token"];
  91. [p go];
  92. }
  93. -(void)liveRoomKickMember:(NSString*)userId liveRoomId:(NSString*)liveRoomId toView:(id)toView{
  94. JXConnection* p = [self addTask:act_liveRoomKick param:nil toView:toView];
  95. [p setPostValue:liveRoomId forKey:@"roomId"];
  96. [p setPostValue:userId forKey:@"userId"];
  97. [p setPostValue:self.access_token forKey:@"access_token"];
  98. [p go];
  99. }
  100. -(void)liveRoomPraise:(NSString*)liveRoomId toView:(id)toView{
  101. JXConnection* p = [self addTask:act_liveRoomPraise param:nil toView:toView];
  102. [p setPostValue:liveRoomId forKey:@"roomId"];
  103. [p setPostValue:self.access_token forKey:@"access_token"];
  104. [p go];
  105. }
  106. /**
  107. 发送弹幕
  108. */
  109. -(void)liveRoomBarrage:(NSString *)text roomId:(NSString *)roomId toView:(id)toView{
  110. JXConnection* p = [self addTask:act_liveRoomBarrage param:nil toView:toView];
  111. [p setPostValue:text forKey:@"text"];
  112. [p setPostValue:g_myself.userId forKey:@"userId"];
  113. [p setPostValue:roomId forKey:@"roomId"];
  114. [p setPostValue:self.access_token forKey:@"access_token"];
  115. [p go];
  116. }
  117. /**
  118. 获取礼物列表
  119. */
  120. -(void)liveRoomGiftList:(NSString *)roomId toView:(id)toView{
  121. JXConnection* p = [self addTask:act_liveRoomGiftList param:nil toView:toView];
  122. // pageIndex
  123. [p setPostValue:[NSNumber numberWithInt:50] forKey:@"pageSize"];
  124. [p setPostValue:roomId forKey:@"roomId"];
  125. [p setPostValue:self.access_token forKey:@"access_token"];
  126. [p go];
  127. }
  128. /**
  129. 发送礼物
  130. */
  131. -(void)liveRoomGiveGift:(NSString *)roomId anchorUserId:(NSString *)anchorUserId giftId:(NSString *)giftId price:(NSString *)price count:(NSInteger)count toView:(id)toView{
  132. JXConnection* p = [self addTask:act_liveRoomGive param:nil toView:toView];
  133. [p setPostValue:roomId forKey:@"roomId"];
  134. [p setPostValue:g_myself.userId forKey:@"userId"];
  135. [p setPostValue:anchorUserId forKey:@"toUserId"];
  136. [p setPostValue:giftId forKey:@"giftId"];
  137. [p setPostValue:price forKey:@"price"];
  138. [p setPostValue:[NSNumber numberWithInteger:count] forKey:@"count"];
  139. [p setPostValue:self.access_token forKey:@"access_token"];
  140. [p go];
  141. }
  142. /**
  143. 主播获取送礼物详情
  144. */
  145. -(void)liveRoomGiveList:(NSString *)userId toView:(id)toView{
  146. JXConnection *p = [self addTask:act_liveRoomAnchorGiftList param:nil toView:toView];
  147. [p setPostValue:userId forKey:@"userId"];
  148. [p setPostValue:self.access_token forKey:@"access_token"];
  149. [p go];
  150. }
  151. /**
  152. 开始直播/关闭直播
  153. */
  154. -(void)liveRoomStatus:(NSInteger)status roomId:(NSString *)roomId toView:(id)toView{
  155. JXConnection* p = [self addTask:act_liveRoomStart param:nil toView:toView];
  156. [p setPostValue:roomId forKey:@"roomId"];
  157. [p setPostValue:[NSNumber numberWithInteger:status] forKey:@"status"];
  158. [p setPostValue:self.access_token forKey:@"access_token"];
  159. [p go];
  160. }
  161. // 获取直播间
  162. -(void)liveRoomGetLiveRoom:(NSInteger)userId toView:(id)toView {
  163. JXConnection* p = [self addTask:act_liveRoomGetLiveRoom param:nil toView:toView];
  164. [p setPostValue:[NSNumber numberWithInteger:userId] forKey:@"userId"];
  165. [p setPostValue:self.access_token forKey:@"access_token"];
  166. [p go];
  167. }
  168. @end