VoiceHTTPManger.m 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. //
  2. // VoiceHTTPManger.m
  3. // BuguLive
  4. //
  5. // Created by 志刚杨 on 2022/4/15.
  6. // Copyright © 2022 xfg. All rights reserved.
  7. //
  8. #import "VoiceHTTPManger.h"
  9. @implementation VoiceHTTPManger
  10. //直接上麦
  11. - (void)requestApplyWheat:(NSString *)wheat_id block:(CommonBlock)block{
  12. [[BGHUDHelper sharedInstance] syncLoading];
  13. NSMutableDictionary *dict = [[NSMutableDictionary alloc]init];
  14. [dict setValue:@"voice" forKey:@"ctl"];
  15. [dict setValue:@"apply_wheat" forKey:@"act"];
  16. [dict setValue:self.live_info.room_id forKey:@"room_id"];
  17. [dict setValue:wheat_id forKey:@"wheat_id"];
  18. [[NetHttpsManager manager] POSTWithParameters:dict SuccessBlock:^(NSDictionary *responseJson) {
  19. NSLog(@"104responseJson%@",responseJson);
  20. block(responseJson);
  21. [self showError:responseJson];
  22. [[BGHUDHelper sharedInstance] syncStopLoading];
  23. } FailureBlock:^(NSError *error) {
  24. [[BGHUDHelper sharedInstance] syncStopLoading];
  25. }];
  26. }
  27. //
  28. /*
  29. 上下麦
  30. status
  31. wheat_id 暂时不用传了
  32. 麦位状态:1上麦成功 2拒绝上麦 3结束上麦(下麦)
  33. */
  34. - (void)requestUpdWheatUser:(NSString *)wheat_id toUserID:(NSString *)touid status:(NSString *)status block:(CommonBlock)block{
  35. NSMutableDictionary *dict = [[NSMutableDictionary alloc]init];
  36. [dict setValue:@"voice" forKey:@"ctl"];
  37. [dict setValue:@"upd_wheat_user" forKey:@"act"];
  38. [dict setValue:self.live_info.room_id forKey:@"room_id"];
  39. [dict setValue:touid forKey:@"to_user_id"];
  40. [dict setValue:status forKey:@"status"];
  41. [[BGHUDHelper sharedInstance] syncLoading];
  42. [[NetHttpsManager manager] POSTWithParameters:dict SuccessBlock:^(NSDictionary *responseJson) {
  43. block(responseJson);
  44. [self showError:responseJson];
  45. [[BGHUDHelper sharedInstance] syncStopLoading];
  46. } FailureBlock:^(NSError *error) {
  47. [[BGHUDHelper sharedInstance] syncStopLoading];
  48. }];
  49. }
  50. //禁止说话
  51. /*
  52. second 禁止说话状态:0解除1禁止
  53. */
  54. - (void)requestBanVoice:(NSString *)wheat_id toUserID:(NSString *)touid second:(NSString *)second block:(CommonBlock)block{
  55. NSMutableDictionary *dict = [[NSMutableDictionary alloc]init];
  56. [dict setValue:@"voice" forKey:@"ctl"];
  57. [dict setValue:@"user_ban_voice" forKey:@"act"];
  58. [dict setValue:self.live_info.room_id forKey:@"room_id"];
  59. [dict setValue:touid forKey:@"to_user_id"];
  60. [dict setValue:second forKey:@"second"];
  61. [[BGHUDHelper sharedInstance] syncLoading];
  62. [[NetHttpsManager manager] POSTWithParameters:dict SuccessBlock:^(NSDictionary *responseJson) {
  63. block(responseJson);
  64. [self showError:responseJson];
  65. [[BGHUDHelper sharedInstance] syncStopLoading];
  66. } FailureBlock:^(NSError *error) {
  67. [[BGHUDHelper sharedInstance] syncStopLoading];
  68. }];
  69. }
  70. //等待申请列表
  71. // type: 0=申请列表,1=已上麦人管理列表
  72. - (void)requestWheatListType:(NSString *)type block:(CommonBlock)block{
  73. NSMutableDictionary *dict = [[NSMutableDictionary alloc]init];
  74. [dict setValue:@"voice" forKey:@"ctl"];
  75. [dict setValue:@"get_wheat_list" forKey:@"act"];
  76. [dict setValue:self.live_info.room_id forKey:@"room_id"];
  77. [dict setValue:type forKey:@"type"];
  78. [[BGHUDHelper sharedInstance] syncLoading];
  79. [[NetHttpsManager manager] POSTWithParameters:dict SuccessBlock:^(NSDictionary *responseJson) {
  80. [[BGHUDHelper sharedInstance] syncStopLoading];
  81. block(responseJson);
  82. [self showError:responseJson];
  83. } FailureBlock:^(NSError *error) {
  84. [[BGHUDHelper sharedInstance] syncStopLoading];
  85. }];
  86. }
  87. /*
  88. 修改麦位类型
  89. type
  90. 麦位权限:0直接上麦 1申请上麦 2锁定上麦
  91. */
  92. - (void)setWheatApplyTypeWheatId:(NSString *)wheat_id type:(NSString *)type block:(CommonBlock)block{
  93. NSMutableDictionary *dict = [[NSMutableDictionary alloc]init];
  94. [dict setValue:@"voice" forKey:@"ctl"];
  95. [dict setValue:@"wheat_apply" forKey:@"act"];
  96. [dict setValue:self.live_info.room_id forKey:@"room_id"];
  97. [dict setValue:wheat_id forKey:@"wheat_id"];
  98. [dict setValue:type forKey:@"type"];
  99. [[BGHUDHelper sharedInstance] syncLoading];
  100. [[NetHttpsManager manager] POSTWithParameters:dict SuccessBlock:^(NSDictionary *responseJson) {
  101. block(responseJson);
  102. [[BGHUDHelper sharedInstance] syncStopLoading];
  103. [self showError:responseJson];
  104. } FailureBlock:^(NSError *error) {
  105. [[BGHUDHelper sharedInstance] syncStopLoading];
  106. }];
  107. }
  108. - (void)showError:(NSDictionary *)res {
  109. if (![res[@"error"] isEqualToString:@""])
  110. {
  111. [[BGHUDHelper sharedInstance] tipMessage:res[@"error"]];
  112. }
  113. }
  114. @end