MORtmEntity.m 36 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087
  1. //
  2. // MOTtmEntiry.m
  3. // MiMoLive
  4. //
  5. // Created by SuperC on 2023/11/21.
  6. //
  7. #import "MORtmEntity.h"
  8. #import "MOWishStatusList.h"
  9. @implementation MORtmFanBean
  10. @end
  11. @implementation MORtmVipBean
  12. @end
  13. @implementation MORtmFamilyBean
  14. @end
  15. @implementation MORtmHeaddress
  16. @end
  17. @implementation MORtmDressing
  18. @end
  19. @implementation MORtmUser
  20. + (NSDictionary *)modelContainerPropertyGenericClass {
  21. // value使用[YYEatModel class]或YYEatModel.class或@"YYEatModel"没有区别
  22. return @{@"vip":[MORtmVipBean class],
  23. @"fans":[MORtmFanBean class],
  24. @"family":[MORtmFamilyBean class],
  25. @"headdress":[MORtmHeaddress class],
  26. @"dressing":[MORtmDressing class]};
  27. }
  28. @end
  29. @implementation MORtmGiftRebate
  30. + (NSDictionary *)modelContainerPropertyGenericClass {
  31. // value使用[YYEatModel class]或YYEatModel.class或@"YYEatModel"没有区别
  32. return @{@"user":[MORtmUser class]};
  33. }
  34. @end
  35. @implementation MORtmLiveRoomViewer
  36. @end
  37. @implementation MORedEnvelopeObject
  38. @end
  39. @implementation MORtmRoomResolution
  40. @end
  41. @implementation MORtmUserDialogItem
  42. @end
  43. @implementation MORtmUserDialog
  44. + (NSDictionary *)modelContainerPropertyGenericClass {
  45. // value使用[YYEatModel class]或YYEatModel.class或@"YYEatModel"没有区别
  46. return @{@"iconItems":[MORtmUserDialogItem class]};
  47. }
  48. @end
  49. @implementation MORtmFlexActivityPiggy
  50. @end
  51. @implementation MORtmWishList
  52. @end
  53. @implementation MORTMLinkMic
  54. + (NSDictionary *)modelContainerPropertyGenericClass {
  55. // value使用[YYEatModel class]或YYEatModel.class或@"YYEatModel"没有区别
  56. return @{@"user":[MORtmUser class]};
  57. }
  58. @end
  59. @implementation MORtmFansClub
  60. @end
  61. @implementation MORtmOpenVipNotice
  62. @end
  63. @implementation MORtmUserLevelUpgrade
  64. @end
  65. @implementation MORtmFastGive
  66. @end
  67. @implementation MORtmFollowGive
  68. @end
  69. @implementation MORtmRoomDesireDone
  70. + (NSDictionary *)modelContainerPropertyGenericClass {
  71. // value使用[YYEatModel class]或YYEatModel.class或@"YYEatModel"没有区别
  72. return @{@"sender":[MORtmUser class]};
  73. }
  74. @end
  75. @implementation MORtmBlindboxGift
  76. @end
  77. @implementation MORtmBlindboxDrawResult
  78. + (NSDictionary *)modelContainerPropertyGenericClass {
  79. return @{@"list": [MORtmBlindboxGift class]};
  80. }
  81. @end
  82. @implementation MORtmGiftReturnForMultiple
  83. + (NSDictionary *)modelContainerPropertyGenericClass {
  84. return @{@"user":[MORtmUser class]};
  85. }
  86. @end
  87. @implementation MORtmTranslate
  88. @end
  89. @implementation MORtmJosnEntity
  90. + (NSDictionary *)modelContainerPropertyGenericClass {
  91. // value使用[YYEatModel class]或YYEatModel.class或@"YYEatModel"没有区别
  92. return @{@"giftRebate":[MORtmGiftRebate class],
  93. @"l":[MORtmLiveRoomViewer class],
  94. @"linkMics":[MORTMLinkMic class],
  95. @"roomUser":[MORtmUser class],
  96. @"resolution":[MORtmRoomResolution class],
  97. @"activityPiggy":[MORtmFlexActivityPiggy class],
  98. @"fansClub":[MORtmFansClub class],
  99. @"openVipNotice":[MORtmOpenVipNotice class],
  100. @"rtmUserDialog":[MORtmUserDialog class],
  101. @"roomDesires":[MORoomDesire class],
  102. @"fastGive": [MORtmFastGive class],
  103. @"followGive": [MORtmFollowGive class],
  104. @"translateArr":[MORtmTranslate class],
  105. @"desireDone":[MORtmRoomDesireDone class],
  106. @"blindboxDrawResult":[MORtmBlindboxDrawResult class],
  107. @"dressing":[MORtmDressing class],
  108. @"pkLinkInvite":[MORtmLivePKLinkInvite class],
  109. @"pkV2Status":[MORtmPkV2Status class],
  110. @"pkV2StatusExpand":[MORtmPkV2StatusExpand class],
  111. @"returnForMultiple":[MORtmGiftReturnForMultiple class],
  112. @"rtmToast": [MORtmToast class],
  113. };
  114. }
  115. @end
  116. @implementation MORtmEntity
  117. + (NSDictionary *)modelContainerPropertyGenericClass {
  118. // value使用[YYEatModel class]或YYEatModel.class或@"YYEatModel"没有区别
  119. return @{@"user":[MORtmUser class]};
  120. }
  121. - (id)copyWithZone:(NSZone *)zone {
  122. MORtmEntity *copy = [[MORtmEntity alloc] init];
  123. if (copy) {
  124. copy.type = self.type;
  125. copy.data = self.data;
  126. copy.roomId = self.roomId;
  127. }
  128. return copy;
  129. }
  130. + (MORtmEntity *)prepareRealObjectWith:(MORtmEntity *)entity{
  131. if(entity.type == MORtmChat ||
  132. entity.type == MORtmEnter ||
  133. entity.type == MORtmExit ||
  134. entity.type == RoomClose ||
  135. entity.type == MORtmLink ||
  136. entity.type == PeerPK ||
  137. entity.type == MORtmGift ||
  138. entity.type == SystemOrder ||
  139. entity.type == MOPKStatus ||
  140. entity.type == MORtmChatSilence ||
  141. entity.type == MORtmKick ||
  142. entity.type == MORtmChatManage ||
  143. entity.type == MORtmGiftEndNum ||
  144. entity.type == MORtmRoomTip ||
  145. entity.type == MORoomCleanRtmTip ||
  146. entity.type == MOLikeComboTip ||
  147. entity.type == SystemLiveUpdate ||
  148. entity.type == MOChangeRoomType ||
  149. entity.type == MORoomTipTwo ||
  150. entity.type == MORoomVoiceTranslate){
  151. MORtmJosnEntity *josnData = [MORtmJosnEntity modelWithJSON:entity.data];
  152. josnData.changeSettingInfo = [MOSettingInfo modelObjectWithDictionary:josnData.multipleChange];
  153. entity.data = josnData;
  154. return entity;
  155. }
  156. else if (entity.type == MOWishListTip){
  157. NSArray<MORtmWishList *> *wishListArr = [NSArray modelArrayWithClass:[MORtmWishList class] json:entity.data];
  158. entity.data = wishListArr;
  159. return entity;
  160. }
  161. else if (entity.type == MORtmMicApply ||
  162. entity.type == MORtmMicAuditPass ||
  163. entity.type == MORtmMicAuditRefuse){
  164. MORtmJosnEntity *josnData = [MORtmJosnEntity modelWithJSON:entity.data];
  165. entity.data = josnData;
  166. return entity;
  167. }
  168. return entity;
  169. }
  170. + (MORtmEntity *)prepareRtmTextMessageWithType:(MORtmContentType )type AndText:(NSString *)text And:(BOOL)danMu AndRoomId:(NSString *)roomId{
  171. MORtmJosnEntity *jsonEntity = [MORtmJosnEntity new];
  172. jsonEntity.content = text ? text : @"";
  173. jsonEntity.danmu = danMu;
  174. MORtmEntity *entity = [MORtmEntity new];
  175. entity.type = type;
  176. entity.roomId = roomId ? roomId : @"";
  177. entity.data = jsonEntity;
  178. MORtmUser *userInfo = [MORtmEntity prepareBaseUser];
  179. entity.user = userInfo;
  180. return entity;
  181. }
  182. //创建一条艾特的文本
  183. + (MORtmEntity *)prepareRtmTextMessageWithType:(MORtmContentType )type AndText:(NSString *)text And:(BOOL)danMu AndRoomId:(NSString *)roomId AndAtDict:(NSDictionary *)dict{
  184. MORtmJosnEntity *jsonEntity = [MORtmJosnEntity new];
  185. jsonEntity.content = text ? text : @"";
  186. jsonEntity.danmu = danMu;
  187. if(dict){
  188. NSArray *allkeyArr = [dict allKeys];
  189. if(allkeyArr.count > 0){
  190. NSMutableArray *userIdArr = [NSMutableArray array];
  191. for (NSString *key in allkeyArr) {
  192. [userIdArr addObject:dict[key]];
  193. }
  194. if(userIdArr.count == allkeyArr.count){
  195. NSString *atlist = [userIdArr componentsJoinedByString:@","];
  196. NSString *atNameList = [allkeyArr componentsJoinedByString:@","];
  197. jsonEntity.atList = atlist;
  198. jsonEntity.atNameList = atNameList;
  199. }
  200. }
  201. }
  202. MORtmEntity *entity = [MORtmEntity new];
  203. entity.type = type;
  204. entity.roomId = roomId ? roomId : @"";
  205. entity.data = jsonEntity;
  206. MORtmUser *userInfo = [MORtmEntity prepareBaseUser];
  207. entity.user = userInfo;
  208. return entity;
  209. }
  210. + (MORtmUser *)prepareBaseUser{
  211. MORtmUser *userInfo = [MORtmUser new];
  212. userInfo.userId = GetUserId ? GetUserId : @"";
  213. userInfo.username = GetNickName ? GetNickName : @"";
  214. userInfo.avatar = GetAvatar ? GetAvatar : @"";
  215. userInfo.agoraId = GetAgoraId ? GetAgoraId : 0;
  216. userInfo.bubble = GetUserBubbleCode ? GetUserBubbleCode : 0;
  217. userInfo.headress = @"";//使用了新字段headRes
  218. userInfo.level = GetUserLevel ? GetUserLevel : 1;
  219. userInfo.rides = GetUserEnterBar ? GetUserEnterBar : 0;
  220. MORtmDressing *dressing = [MORtmDressing new];
  221. dressing.bubble = GetUserBubbleCode ? GetUserBubbleCode : 0;
  222. dressing.entryBar = GetUserEnterBar ? GetUserEnterBar : 0;
  223. dressing.cardFrame = GetUserCardFrameCode ? GetUserCardFrameCode : 0;
  224. dressing.enterFloating = GetUserEnterFloatingCode ? GetUserEnterFloatingCode : 0;
  225. dressing.rewardBanner = GetUserRewardBannerCode ? GetUserRewardBannerCode : 0;
  226. dressing.linkMicFrame = GetUserLinkMicFrameCode ? GetUserLinkMicFrameCode : 0;
  227. dressing.liveBarrage = GetUserLiveBarrageCode ? GetUserLiveBarrageCode : 0;
  228. BOOL isMysterious = GetIsMysterious;
  229. if(isMysterious){
  230. //神秘人
  231. userInfo.username = @"Mystery Man";
  232. userInfo.bubble = 0;
  233. userInfo.headress = @"";//使用了新字段headRes
  234. userInfo.level = 1;
  235. userInfo.rides = 0;
  236. dressing.bubble = 0;
  237. dressing.entryBar = 0;
  238. dressing.cardFrame = 0;
  239. dressing.enterFloating = 0;
  240. dressing.rewardBanner = 0;
  241. dressing.linkMicFrame = 0;
  242. dressing.liveBarrage = 0;
  243. if([MOSvgaSourceManage shareManager].theManAvatarUrl.length > 0){
  244. userInfo.avatar = [MOSvgaSourceManage shareManager].theManAvatarUrl;
  245. }
  246. else{
  247. userInfo.avatar = @"";
  248. }
  249. }
  250. userInfo.dressing = dressing;//装饰类赋值
  251. //vip
  252. MORtmVipBean *vipInfo = [MORtmVipBean new];
  253. NSInteger vipType = GetUserVipType ? GetUserVipType : 0;
  254. if(vipType != 0){
  255. NSTimeInterval currentTime = [[NSDate date] timeIntervalSince1970] * 1000;
  256. NSInteger vipExpirTime = GetUserVipExpirTime ? GetUserVipExpirTime : 0;
  257. if(currentTime > vipExpirTime){
  258. vipType = 0;
  259. }
  260. vipInfo.type = vipType;
  261. if(isMysterious){
  262. vipInfo.type = 0;
  263. }
  264. userInfo.vip = vipInfo;
  265. }
  266. //粉丝团
  267. MORtmFanBean *fanInfo = [MORtmFanBean new];
  268. MOFanClubData *fanClubData = [MOSvgaSourceManage shareManager].myDataInfo.fanClubData;
  269. if(fanClubData.id.length > 0){
  270. fanInfo.level = fanClubData.level;
  271. fanInfo.name = fanClubData.nameplate;
  272. if(isMysterious){
  273. fanInfo.level = 0;
  274. fanInfo.name = @"";
  275. }
  276. userInfo.fans = fanInfo;
  277. }
  278. //勋章Code数组
  279. NSArray *medalArr = [MOSvgaSourceManage shareManager].myDataInfo.userProfile.medalList;
  280. if(medalArr.count > 0){
  281. NSMutableArray *medalMuArr = [NSMutableArray array];
  282. for (MOMedalResources *object in medalArr) {
  283. NSInteger codeNum = (NSInteger)object.code;
  284. [medalMuArr addObject:@(codeNum)];
  285. }
  286. if(isMysterious){
  287. userInfo.medalCodeList = [NSMutableArray array];
  288. }
  289. else{
  290. userInfo.medalCodeList = [medalMuArr copy];
  291. }
  292. }
  293. //MORtmHeaddress 头像对象
  294. MORtmHeaddress *headdress = [MORtmHeaddress new];
  295. headdress.type = GetUserHeaddressType ? GetUserHeaddressType : 0;
  296. headdress.res = GetUserHeaddress ? GetUserHeaddress : @"";
  297. if(isMysterious){
  298. headdress.type = 0;
  299. headdress.res = @"";
  300. }
  301. userInfo.headressObject = headdress;
  302. return userInfo;
  303. }
  304. + (MORtmEntity *)prepareRtmApplyLianMaiMessageWithType:(MORtmContentType )type AndLinkMicType:(NSInteger)linkMicType AndRoomId:(NSString *)roomId{
  305. //状态 0:待审核 1:取消(观众) 2:同意(主播&管理员) 3:拒绝(主播&管理员) 4:挂断)
  306. MORtmJosnEntity *jsonEntity = [MORtmJosnEntity new];
  307. jsonEntity.type = linkMicType ? linkMicType : 1;
  308. jsonEntity.status = 0;
  309. jsonEntity.roomId = roomId ? roomId : @"";
  310. MORtmEntity *entity = [MORtmEntity new];
  311. entity.type = MORtmLink;
  312. entity.data = jsonEntity;
  313. entity.roomId = roomId ? roomId : @"";
  314. MORtmUser *userInfo = [MORtmEntity prepareBaseUser];
  315. entity.user = userInfo;
  316. return entity;
  317. }
  318. + (MORtmEntity *)prepareRtmManageLianMaiMessageWithType:(MORtmContentType )type AndLinkMicType:(NSInteger)linkMicType AndStatus:(NSInteger)status AndAgoraId:(NSInteger)agoraId AndRoomId:(NSString *)roomId {
  319. //状态 0:待审核 1:取消(观众) 2:同意(主播&管理员) 3:拒绝(主播&管理员) 4:挂断)
  320. //状态 0:待审核 1:取消(观众) 2:同意(主播&管理员) 3:拒绝(主播&管理员) 4:挂断 5:上麦) 6, 主播邀请 7, 多人邀请- 用户同意 8主播音频变化 9: 用户自动上麦广播 10: 用户拒绝主播邀请
  321. MORtmJosnEntity *jsonEntity = [MORtmJosnEntity new];
  322. jsonEntity.type = linkMicType ? linkMicType : 1;
  323. jsonEntity.status = status;
  324. jsonEntity.agoraId = agoraId;
  325. jsonEntity.roomId = roomId ? roomId : @"";
  326. MORtmEntity *entity = [MORtmEntity new];
  327. entity.type = type;
  328. entity.data = jsonEntity;
  329. entity.roomId = roomId ? roomId : @"";
  330. MORtmUser *userInfo = [MORtmEntity prepareBaseUser];
  331. entity.user = userInfo;
  332. return entity;
  333. }
  334. + (MORtmEntity *)prepareRtmManageAgreeLianMaiMessageAndLinkMicType:(NSInteger)linkMicType AndStatus:(NSInteger)status AndAgoraId:(NSInteger)agoraId AndUserId:(NSString *)userId AndUserName:(NSString *)userName AndAvatar:(NSString *)avatar AndRoomId:(NSString *)roomId AndVipType:(NSInteger)vipType{
  335. //状态 0:待审核 1:取消(观众) 2:同意(主播&管理员) 3:拒绝(主播&管理员) 4:挂断)
  336. //状态 0:待审核 1:取消(观众) 2:同意(主播&管理员) 3:拒绝(主播&管理员) 4:挂断 5:上麦) 6, 主播邀请 7, 多人邀请- 用户同意 8主播音频变化 9: 用户自动上麦广播 10: 用户拒绝主播邀请
  337. MORtmJosnEntity *jsonEntity = [MORtmJosnEntity new];
  338. jsonEntity.type = linkMicType ? linkMicType : 1;
  339. jsonEntity.status = status;
  340. jsonEntity.agoraId = agoraId;
  341. jsonEntity.userId = userId ? userId : @"";
  342. jsonEntity.userName = userName ? userName : @"";
  343. jsonEntity.avatar = avatar ? avatar : @"";
  344. jsonEntity.roomId = roomId ? roomId : @"";
  345. jsonEntity.vipType = vipType ? vipType : 0;
  346. MORtmEntity *entity = [MORtmEntity new];
  347. entity.type = MORtmLink;
  348. entity.data = jsonEntity;
  349. entity.roomId = roomId ? roomId : @"";
  350. MORtmUser *userInfo = [MORtmEntity prepareBaseUser];
  351. entity.user = userInfo;
  352. return entity;
  353. }
  354. + (MORtmEntity *)prepareRtmManageAgreeLianMaiMessageAndLinkMicType:(NSInteger)linkMicType AndStatus:(NSInteger)status AndRoomId:(NSString *)roomId AndMOLinkMic:(MOLinkMic *)linkMic AndSeatNum:(NSInteger)seatNum{
  355. //状态 0:待审核 1:取消(观众) 2:同意(主播&管理员) 3:拒绝(主播&管理员) 4:挂断) 5:上麦) 6, 主播邀请 7, 多人邀请- 用户同意
  356. //状态 0:待审核 1:取消(观众) 2:同意(主播&管理员) 3:拒绝(主播&管理员) 4:挂断 5:上麦) 6, 主播邀请 7, 多人邀请- 用户同意 8主播音频变化 9: 用户自动上麦广播 10: 用户拒绝主播邀请
  357. MORtmJosnEntity *jsonEntity = [MORtmJosnEntity new];
  358. jsonEntity.type = linkMicType ? linkMicType : 1;
  359. jsonEntity.status = status;
  360. jsonEntity.agoraId = linkMic.profile.agoraId ? linkMic.profile.agoraId : 0;
  361. jsonEntity.userId = linkMic.profile.id ? linkMic.profile.id : @"";
  362. jsonEntity.userName = linkMic.profile.nickname ? linkMic.profile.nickname : @"";
  363. jsonEntity.avatar = linkMic.profile.avatar ? linkMic.profile.avatar : @"";
  364. jsonEntity.vipType = linkMic.profile.vipType ? linkMic.profile.vipType : 0;
  365. jsonEntity.roomId = roomId ? roomId : @"";
  366. jsonEntity.seatNum = seatNum ? seatNum : 0;
  367. jsonEntity.video1 = linkMic.video1;
  368. jsonEntity.video2 = linkMic.video2;
  369. jsonEntity.audio1 = linkMic.audio1;
  370. jsonEntity.audio2 = linkMic.audio2;
  371. jsonEntity.admin = linkMic.admin;
  372. NSDictionary *dressing = [linkMic.dressing modelToJSONObject];
  373. jsonEntity.dressing = [MORtmDressing modelWithJSON:dressing];
  374. if(status == 6){
  375. jsonEntity.invite = linkMic.invite ? linkMic.invite : @"";
  376. jsonEntity.camera = linkMic.camera;
  377. }
  378. MORtmEntity *entity = [MORtmEntity new];
  379. entity.type = MORtmLink;
  380. entity.data = jsonEntity;
  381. entity.roomId = roomId ? roomId : @"";
  382. MORtmUser *userInfo = [MORtmEntity prepareBaseUser];
  383. entity.user = userInfo;
  384. return entity;
  385. }
  386. + (MORtmEntity *)prepareRtmActiveLianMaiMessageWithType:(MORtmContentType)type AndLinkMicType:(NSInteger)linkMicType AndRoomId:(NSString *)roomId{
  387. MORtmJosnEntity *jsonEntity = [MORtmJosnEntity new];
  388. jsonEntity.type = linkMicType ? linkMicType : 1;
  389. jsonEntity.roomId = roomId ? roomId : @"";
  390. NSInteger agoraId = GetAgoraId;
  391. jsonEntity.agoraId = agoraId ? agoraId : 0;
  392. MORtmEntity *entity = [MORtmEntity new];
  393. entity.type = type;
  394. entity.data = jsonEntity;
  395. entity.roomId = roomId ? roomId : @"";
  396. MORtmUser *userInfo = [MORtmEntity prepareBaseUser];
  397. entity.user = userInfo;
  398. return entity;
  399. }
  400. + (MORtmEntity *)prepareRtmPeerPkMessageWithStatus:(NSInteger)status PkSecretStr:(NSString *)pkSecretStr AndRoomId:(NSString *)roomId{
  401. //状态, 0:待处理 1:取消 2:同意 3:拒绝 4:投降或退出
  402. MORtmJosnEntity *jsonEntity = [MORtmJosnEntity new];
  403. jsonEntity.status = status;
  404. jsonEntity.pkSecret = pkSecretStr;
  405. MORtmEntity *entity = [MORtmEntity new];
  406. entity.type = PeerPK;
  407. entity.roomId = roomId ? roomId : @"";
  408. entity.data = jsonEntity;
  409. MORtmUser *userInfo = [MORtmEntity prepareBaseUser];
  410. entity.user = userInfo;
  411. return entity;
  412. }
  413. + (MORtmEntity *)prepareRtmPeerPkQuitMessageWith:(BOOL)isSurrender AndRoomId:(NSString *)roomId{
  414. MORtmEntity *entity = [MORtmEntity new];
  415. entity.type = PeerPKQuit;
  416. entity.data = @(isSurrender);
  417. MORtmUser *userInfo = [MORtmEntity prepareBaseUser];
  418. entity.user = userInfo;
  419. entity.roomId = roomId ? roomId : @"";
  420. return entity;
  421. }
  422. //根据消息类型枚举 创建一条对应Rtm消息
  423. + (MORtmEntity *)prepareRtmMessageWithType:(MORtmContentType )type AndRoomId:(NSString *)roomId{
  424. MORtmEntity *entity = [MORtmEntity new];
  425. entity.type = type;
  426. entity.data = nil;
  427. MORtmUser *userInfo = [MORtmEntity prepareBaseUser];
  428. entity.user = userInfo;
  429. entity.roomId = roomId ? roomId : @"";
  430. return entity;
  431. }
  432. + (MORtmEntity *)prepareRtmMessageWithEnterWith:(MOLiveDetail *)liveDetail{
  433. MORtmEntity *entity = [MORtmEntity new];
  434. entity.type = MORtmEnter;
  435. entity.roomId = liveDetail.currentRoom.id ? liveDetail.currentRoom.id : @"";
  436. MORtmUser *userInfo = [MORtmEntity prepareBaseUser];
  437. userInfo.enterBarPlayType = liveDetail.enterBarPlayType ? liveDetail.enterBarPlayType : 0;
  438. userInfo.enterFloatingSkinType = liveDetail.enterFloatingSkinType ? liveDetail.enterFloatingSkinType : 0;
  439. userInfo.enterFloatingAvatar = liveDetail.enterFloatingAvatar;
  440. entity.user = userInfo;
  441. return entity;
  442. }
  443. //准备一条 礼物 Rtm
  444. + (MORtmEntity *)prepareRtmGiftMessageWithCode:(NSInteger)code NameStr:(NSString *)nameStr Count:(NSInteger)count AndRoomId:(NSString *)roomId{
  445. MORtmJosnEntity *jsonEntity = [MORtmJosnEntity new];
  446. jsonEntity.code = code ? code : 1;
  447. jsonEntity.name = nameStr;
  448. jsonEntity.count = count ? count : 1;
  449. MORtmEntity *entity = [MORtmEntity new];
  450. entity.type = MORtmGift;
  451. entity.data = jsonEntity;
  452. entity.roomId = roomId ? roomId : @"";
  453. MORtmUser *userInfo = [MORtmEntity prepareBaseUser];
  454. entity.user = userInfo;
  455. return entity;
  456. }
  457. //准备一条 礼物 Rtm
  458. + (MORtmEntity *)prepareRtmGiftMessageWith:(MOGiftInfo *)giftInfo AndRoomId:(NSString *)roomId{
  459. MORtmJosnEntity *jsonEntity = [MORtmJosnEntity new];
  460. jsonEntity.code = giftInfo.giftCode ? giftInfo.giftCode : 1;
  461. jsonEntity.name = giftInfo.giftName;
  462. jsonEntity.count = giftInfo.num ? giftInfo.num : 1;
  463. jsonEntity.rebateMultiple = giftInfo.rebateMultiple ? giftInfo.rebateMultiple : 0;
  464. jsonEntity.rebateDiamond = giftInfo.rebateDiamond ? giftInfo.rebateDiamond : 0;
  465. jsonEntity.multipleUserList = (giftInfo.multipleUserList.count > 0) ? ([giftInfo.multipleUserList copy]) : nil;
  466. jsonEntity.priceDiamond = giftInfo.diamond ? giftInfo.diamond : 0;
  467. jsonEntity.hitDiamond = giftInfo.hitDiamond ? giftInfo.hitDiamond : 0;
  468. jsonEntity.antiDrillCritGift = giftInfo.antiDrillCritGift;
  469. if(giftInfo.selectSkin.id.length > 0){
  470. jsonEntity.code = giftInfo.selectSkin.code ? giftInfo.selectSkin.code : 1;
  471. jsonEntity.name = giftInfo.selectSkin.name ? giftInfo.selectSkin.name : @"";
  472. }
  473. MORtmEntity *entity = [MORtmEntity new];
  474. entity.type = MORtmGift;
  475. entity.data = jsonEntity;
  476. entity.roomId = roomId ? roomId : @"";
  477. MORtmUser *userInfo = [MORtmEntity prepareBaseUser];
  478. entity.user = userInfo;
  479. return entity;
  480. }
  481. //准备一条 礼物数量 Rtm
  482. + (MORtmEntity *)prepareRtmGiftEndNumMessageWith:(MOGiftInfo *)giftInfo AndRoomId:(NSString *)roomId{
  483. MORtmJosnEntity *jsonEntity = [MORtmJosnEntity new];
  484. jsonEntity.code = giftInfo.giftCode ? giftInfo.giftCode : 1;
  485. jsonEntity.name = giftInfo.giftName;
  486. jsonEntity.count = giftInfo.num ? giftInfo.num : 1;
  487. jsonEntity.rebateMultiple = giftInfo.rebateMultiple ? giftInfo.rebateMultiple : 0;
  488. jsonEntity.rebateDiamond = giftInfo.rebateDiamond ? giftInfo.rebateDiamond : 0;
  489. jsonEntity.multipleUserList = (giftInfo.multipleUserList.count > 0) ? ([giftInfo.multipleUserList copy]) : nil;
  490. jsonEntity.effectType = giftInfo.effectType ? giftInfo.effectType : 0;
  491. MORtmEntity *entity = [MORtmEntity new];
  492. entity.type = MORtmGiftEndNum;
  493. entity.data = jsonEntity;
  494. entity.roomId = roomId ? roomId : @"";
  495. MORtmUser *userInfo = [MORtmEntity prepareBaseUser];
  496. entity.user = userInfo;
  497. return entity;
  498. }
  499. /// 准备一条PK 房间状态信息
  500. /// - Parameters:
  501. /// - pkModel: PK状态对象
  502. /// - status: PK状态 0:就绪 1:PK中 2:惩罚 3:结束
  503. /// - quitStatus: 中途结束信息 1:对方退出 2:对方投降 3:我方退出 4:我方投降, 5:正常结束 0:单纯状态信息更新
  504. + (MORtmEntity *)prepareRtmAboutPkStatusWith:(MOLiveList *)pkModel AndStatus:(NSInteger)status AndQuitStatus:(NSInteger)quitStatus AndRoomId:(NSString *)roomId{
  505. MORtmJosnEntity *jsonEntity = [MORtmJosnEntity new];
  506. jsonEntity.status = status ? status : 0;
  507. jsonEntity.selfScore = pkModel.weScore ? pkModel.weScore : 0;
  508. jsonEntity.oppScore = pkModel.oppScore ? pkModel.oppScore : 0;
  509. jsonEntity.quitInfo = quitStatus ? quitStatus : 0;
  510. MORtmEntity *entity = [MORtmEntity new];
  511. entity.type = MOPKStatus;
  512. entity.data = jsonEntity;
  513. entity.roomId = roomId ? roomId : @"";
  514. MORtmUser *userInfo = [MORtmEntity prepareBaseUser];
  515. entity.user = userInfo;
  516. return entity;
  517. }
  518. + (MORtmEntity *)preparePkRtmWith:(MOLinePKViewModel *)pkViewModel AndStatus:(NSInteger)status AndQuitStatus:(NSInteger)quitStatus AndRoomId:(NSString *)roomId{
  519. MORtmJosnEntity *jsonEntity = [MORtmJosnEntity new];
  520. jsonEntity.status = status ? status : 0;
  521. jsonEntity.selfScore = pkViewModel.curOwnerCampInfo.pkValue ?: 0;
  522. jsonEntity.oppScore = pkViewModel.curPeerCampInfo.pkValue ?: 0;
  523. jsonEntity.quitInfo = quitStatus ? quitStatus : 0;
  524. MORtmEntity *entity = [MORtmEntity new];
  525. entity.type = MOPKStatus;
  526. entity.data = jsonEntity;
  527. entity.roomId = roomId ? roomId : @"";
  528. MORtmUser *userInfo = [MORtmEntity prepareBaseUser];
  529. entity.user = userInfo;
  530. return entity;
  531. }
  532. + (MORtmEntity *)prepareRtmAboutKickSomeOneWith:(NSString *)userId AndRoomId:(NSString *)roomId{
  533. MORtmJosnEntity *jsonEntity = [MORtmJosnEntity new];
  534. jsonEntity.userId = userId;
  535. jsonEntity.roomId = roomId;
  536. MORtmEntity *entity = [MORtmEntity new];
  537. entity.type = MORtmKick;
  538. entity.data = jsonEntity;
  539. entity.roomId = roomId ? roomId : @"";
  540. MORtmUser *userInfo = [MORtmEntity prepareBaseUser];
  541. entity.user = userInfo;
  542. return entity;
  543. }
  544. + (MORtmEntity *)prepareRtmAboutSilenceSomeOneWith:(NSString *)userId AndRoomId:(NSString *)roomId And:(BOOL)isSilence{
  545. MORtmJosnEntity *jsonEntity = [MORtmJosnEntity new];
  546. jsonEntity.userId = userId;
  547. jsonEntity.roomId = roomId;
  548. jsonEntity.silence = isSilence;
  549. MORtmEntity *entity = [MORtmEntity new];
  550. entity.type = MORtmChatSilence;
  551. entity.data = jsonEntity;
  552. entity.roomId = roomId ? roomId : @"";
  553. MORtmUser *userInfo = [MORtmEntity prepareBaseUser];
  554. entity.user = userInfo;
  555. return entity;
  556. }
  557. /// 准备一条管理员信息
  558. /// - Parameters:
  559. /// - userId: 用户ID
  560. /// - roomId: 房间ID
  561. + (MORtmEntity *)prepareRtmAboutManageSomeOneWith:(NSString *)userId AndRoomId:(NSString *)roomId And:(BOOL)isManager{
  562. MORtmJosnEntity *jsonEntity = [MORtmJosnEntity new];
  563. jsonEntity.userId = userId;
  564. jsonEntity.roomId = roomId;
  565. jsonEntity.manager = isManager;
  566. MORtmEntity *entity = [MORtmEntity new];
  567. entity.type = MORtmChatManage;
  568. entity.data = jsonEntity;
  569. entity.roomId = roomId ? roomId : @"";
  570. MORtmUser *userInfo = [MORtmEntity prepareBaseUser];
  571. entity.user = userInfo;
  572. return entity;
  573. }
  574. /// 准备一条提示信息
  575. /// - Parameters:
  576. /// - roomId: 房间ID
  577. /// - type: // 1: 关注 2: PK 3:禁言
  578. /// - status: // 1: 关注 (1关注 0取关) 2: PK(0:失败 1: 胜利 2: 自己投降3:对方投降) 3:(0解除禁言 1禁言)
  579. /// - content: //提示内容, 有些类型需要 (非必传)
  580. + (MORtmEntity *)prePareRtmAboutRoomTipWithRoomId:(NSString *)roomId AndType:(NSInteger)type AndStatus:(NSInteger)status AndTipContent:(NSString *)content AndUserName:(NSString *)userName{
  581. MORtmJosnEntity *jsonEntity = [MORtmJosnEntity new];
  582. jsonEntity.roomId = roomId ? roomId : @"";
  583. jsonEntity.type = type ? type : 0;
  584. jsonEntity.status = status ? status : 0;
  585. jsonEntity.tipContent = content ? content : @"";
  586. jsonEntity.userName = userName ? userName : @"";
  587. MORtmEntity *entity = [MORtmEntity new];
  588. entity.type = MORtmRoomTip;
  589. entity.data = jsonEntity;
  590. entity.roomId = roomId ? roomId : @"";
  591. MORtmUser *userInfo = [MORtmEntity prepareBaseUser];
  592. entity.user = userInfo;
  593. //PK 兼容安卓
  594. if(userName.length == 0){
  595. jsonEntity.userName = entity.user.username;
  596. }
  597. return entity;
  598. }
  599. // 准备一条 房间挂起的Rtm
  600. + (MORtmEntity *)prePareRtmAboutRoomTipWithRoomId:(NSString *)roomId AndType:(NSInteger)type AndStatus:(NSInteger)status AndTipContent:(NSString *)content AndUserName:(NSString *)userName AndSuspend:(double)suspend{
  601. MORtmJosnEntity *jsonEntity = [MORtmJosnEntity new];
  602. jsonEntity.roomId = roomId ? roomId : @"";
  603. jsonEntity.type = type ? type : 0;
  604. jsonEntity.status = status ? status : 0;
  605. jsonEntity.tipContent = content ? content : @"";
  606. jsonEntity.userName = userName ? userName : @"";
  607. jsonEntity.suspendExpire = suspend;
  608. MORtmEntity *entity = [MORtmEntity new];
  609. entity.type = MORtmRoomTip;
  610. entity.data = jsonEntity;
  611. entity.roomId = roomId ? roomId : @"";
  612. MORtmUser *userInfo = [MORtmEntity prepareBaseUser];
  613. entity.user = userInfo;
  614. return entity;
  615. }
  616. + (MORtmEntity *)prePareRtmAboutLikeComboWithRoomId:(NSString *)roomId AndType:(NSInteger)type AndLikeNum:(NSInteger)likeNum{
  617. MORtmJosnEntity *jsonEntity = [MORtmJosnEntity new];
  618. jsonEntity.roomId = roomId ? roomId : @"";
  619. jsonEntity.type = type ? type : 0;
  620. jsonEntity.likeCombo = likeNum ? likeNum : 0;
  621. MORtmEntity *entity = [MORtmEntity new];
  622. entity.type = MOLikeComboTip;
  623. entity.data = jsonEntity;
  624. entity.roomId = roomId ? roomId : @"";
  625. MORtmUser *userInfo = [MORtmEntity prepareBaseUser];
  626. entity.user = userInfo;
  627. return entity;
  628. }
  629. + (MORtmEntity *)prePareRtmAboutWishListWithRoomId:(NSString *)roomId AndWishList:(NSArray *)wishList{
  630. NSMutableArray *needWishArr = [NSMutableArray array];
  631. for (MOWishStatusList *object in wishList) {
  632. MORtmWishList *tipObject = [[MORtmWishList alloc] init];
  633. tipObject.giftCode = object.giftCode;
  634. tipObject.complete = (NSInteger)object.complete;
  635. tipObject.num = (NSInteger)object.num;
  636. tipObject.done = object.done;
  637. [needWishArr addObject:tipObject];
  638. }
  639. MORtmEntity *entity = [MORtmEntity new];
  640. entity.type = MOWishListTip;
  641. entity.data = needWishArr;
  642. entity.roomId = roomId ? roomId : @"";
  643. MORtmUser *userInfo = [MORtmEntity prepareBaseUser];
  644. entity.user = userInfo;
  645. return entity;
  646. }
  647. /// 准备一条语言翻译的Rtm
  648. /// - Parameters:
  649. /// - roomId: 房间ID
  650. /// - wishList: 接口数组
  651. + (MORtmEntity *)prePareRtmAboutTranslateArrWithRoomId:(NSString *)roomId AndTranslateArr:(NSArray *)translateArr{
  652. MORtmJosnEntity *jsonEntity = [MORtmJosnEntity new];
  653. jsonEntity.translateArr = translateArr;
  654. MORtmEntity *entity = [MORtmEntity new];
  655. entity.type = MORoomVoiceTranslate;
  656. entity.data = jsonEntity;
  657. entity.roomId = roomId ? roomId : @"";
  658. MORtmUser *userInfo = [MORtmEntity prepareBaseUser];
  659. entity.user = userInfo;
  660. return entity;
  661. }
  662. + (MORtmEntity *)prepareRtmAboutGetRedTipWithSendUserName:(NSString *)sendUserName RedId:(NSString *)redEId{
  663. MORtmJosnEntity *jsonEntity = [MORtmJosnEntity new];
  664. jsonEntity.redSendName = sendUserName;
  665. jsonEntity.redEId = redEId;
  666. MORtmEntity *entity = [MORtmEntity new];
  667. entity.type = SystemTipGetRed;
  668. entity.data = jsonEntity;
  669. MORtmUser *userInfo = [MORtmEntity prepareBaseUser];
  670. entity.user = userInfo;
  671. return entity;
  672. }
  673. /// 准备一条房间转换Rtm
  674. + (MORtmEntity *)prepareRtmAboutChangeRoomTypeWithRoomId:(NSString *)roomId AndType:(NSInteger)type AndPlanConvertTime:(double)planConvertTime AndDiamond:(double)diamond{
  675. MORtmJosnEntity *jsonEntity = [MORtmJosnEntity new];
  676. jsonEntity.type = type;
  677. jsonEntity.roomId = roomId ? roomId : @"";
  678. jsonEntity.planConvertTime = planConvertTime;
  679. jsonEntity.diamond = diamond;
  680. MORtmEntity *entity = [MORtmEntity new];
  681. entity.type = MOChangeRoomType;
  682. entity.data = jsonEntity;
  683. MORtmUser *userInfo = [MORtmEntity prepareBaseUser];
  684. entity.user = userInfo;
  685. return entity;
  686. }
  687. + (NSString *)insertString:(NSString *)insertText intoString:(NSString *)original {
  688. if (original.length == 0) return insertText;
  689. NSRange atRange = [original rangeOfString:@"@"];
  690. NSMutableString *result = [NSMutableString stringWithString:original];
  691. if (atRange.location != NSNotFound) {// @ 存在,插入到它后面
  692. [result insertString:insertText atIndex:(atRange.location + 1)];
  693. } else {// @ 不存在,插入到开头
  694. [result insertString:[NSString stringWithFormat:@"@%@", insertText] atIndex:0];
  695. }
  696. return [result copy];
  697. }
  698. /// 打招呼需求本地构造一条被房主艾特的消息
  699. + (MORtmEntity *)prepareLocalChatMessage:(MOUserBase *)userModel content:(NSString *)content {
  700. MORtmJosnEntity *jsonEntity = [MORtmJosnEntity new];
  701. NSString *contentResult = [self insertString:GetNickName intoString:content];
  702. jsonEntity.content = contentResult;
  703. jsonEntity.danmu = NO;
  704. jsonEntity.atList = GetUserId;
  705. jsonEntity.atNameList = GetNickName;
  706. MORtmEntity *entity = [MORtmEntity new];
  707. entity.data = jsonEntity;
  708. MORtmUser *userInfo = [MORtmEntity createSender:userModel];
  709. entity.user = userInfo;
  710. entity.type = MORtmChat;
  711. return entity;
  712. }
  713. /// 准备一条通用提示消息RoomTipTwo
  714. + (MORtmEntity *)prepareRoomTipTwoMessage:(NSInteger)type AndUserName:(NSString *)userName AndRoomId:(NSString *)roomId AndTipNormalNum:(NSInteger)tipNormalNum{
  715. MORtmJosnEntity *jsonEntity = [MORtmJosnEntity new];
  716. jsonEntity.type = type;
  717. jsonEntity.userName = userName ? userName : @"";
  718. jsonEntity.roomId = roomId ? roomId : @"";
  719. jsonEntity.tipNormalNum = tipNormalNum ? tipNormalNum : 0;
  720. MORtmEntity *entity = [MORtmEntity new];
  721. entity.data = jsonEntity;
  722. MORtmUser *userInfo = [MORtmEntity prepareBaseUser];
  723. entity.user = userInfo;
  724. entity.type = MORoomTipTwo;
  725. return entity;
  726. }
  727. /// 自己构造发送人的信息
  728. + (MORtmUser *)createSender:(MOUserBase *)userModel {
  729. MORtmUser *userInfo = [MORtmUser new];
  730. userInfo.userId = userModel.userProfile.id;
  731. userInfo.username = userModel.userProfile.nickname;
  732. userInfo.avatar = userModel.userProfile.avatar;
  733. userInfo.agoraId = userModel.userProfile.agoraId;
  734. userInfo.bubble = userModel.userProfile.adornment.bubbleCode;
  735. userInfo.headress = @"";//使用了新字段headRes
  736. userInfo.level = userModel.level;
  737. userInfo.rides = 0;
  738. //vip
  739. MORtmVipBean *vipInfo = [MORtmVipBean new];
  740. vipInfo.type = userModel.vipType;
  741. userInfo.vip = vipInfo;
  742. //粉丝团
  743. MORtmFanBean *fanInfo = [MORtmFanBean new];
  744. MOUserAnchorClub *fanClubData = userModel.userAnchorClub;
  745. if(fanClubData.id.length > 0){
  746. fanInfo.level = fanClubData.level;
  747. fanInfo.name = fanClubData.nameplate;
  748. userInfo.fans = fanInfo;
  749. }
  750. //勋章Code数组
  751. NSArray *medalArr = [userModel.userProfile.medalList valueForKey:@"code"];
  752. if(medalArr.count > 0){
  753. userInfo.medalCodeList = medalArr;
  754. }
  755. //MORtmHeaddress 头像对象
  756. MORtmHeaddress *headdress = [MORtmHeaddress new];
  757. headdress.type = userModel.userProfile.adornment.headgearType;
  758. headdress.res = userModel.userProfile.adornment.headgearRes;
  759. userInfo.headressObject = headdress;
  760. return userInfo;
  761. }
  762. #pragma mark - ChangeObject
  763. + (MOUserProfile *)toCreateUserProfileWith:(MORtmUser *)user{
  764. MOUserProfile *result = [[MOUserProfile alloc] init];
  765. if(user){
  766. result.id = user.id;
  767. if(result.id.length == 0){
  768. result.id = user.userId;
  769. }
  770. result.nickname = user.nickname;
  771. if(result.nickname.length == 0){
  772. result.nickname = user.username;
  773. }
  774. result.agoraId = user.agoraId;
  775. result.avatar = user.avatar;
  776. MOAdornment *adorment = [[MOAdornment alloc] init];
  777. adorment.enterBar = user.rides;
  778. adorment.headgearType = user.headdress.type;
  779. adorment.headgearRes = user.headdress.res;
  780. result.adornment = adorment;
  781. MOHeaddress *headdress = [[MOHeaddress alloc] init];
  782. headdress.headgearType = user.headdress.type;
  783. headdress.headgearRes = user.headdress.res;
  784. result.headdress = headdress;
  785. result.vipType = user.vip.type;
  786. MODressing *dressing = [MORtmEntity toCreateUserProfileDressingWith:user];
  787. result.dressing = dressing;
  788. }
  789. return result;
  790. }
  791. + (MODressing *)toCreateUserProfileDressingWith:(MORtmUser *)user{
  792. MODressing *dressing = [[MODressing alloc] init];
  793. dressing.rewardBanner = user.dressing.rewardBanner;
  794. dressing.bubble = user.dressing.bubble;
  795. dressing.enterFloating = user.dressing.enterFloating;
  796. dressing.linkMicFrame = user.dressing.linkMicFrame;
  797. dressing.entryBar = user.dressing.entryBar;
  798. dressing.cardFrame = user.dressing.cardFrame;
  799. dressing.liveBarrage = user.dressing.liveBarrage;
  800. return dressing;
  801. }
  802. + (MOLinkMic *)toCreateLinkMicObjectWith:(MORTMLinkMic *)inObject{
  803. MOLinkMic *result = [[MOLinkMic alloc] init];
  804. result.profile = [MORtmEntity toCreateUserProfileWith:inObject.user];
  805. result.lock = inObject.lock;
  806. result.video1 = inObject.video1;
  807. result.video2 = inObject.video2;
  808. result.audio1 = inObject.audio1;
  809. result.audio2 = inObject.audio2;
  810. result.admin = inObject.admin;
  811. result.goldenBean = inObject.goldenBean;
  812. NSDictionary *dressing = [inObject.user.dressing modelToJSONObject];
  813. result.dressing = [MODressing modelWithJSON:dressing];
  814. return result;
  815. }
  816. + (MOLinkMic *)toCreateLinkMicObjectWithEntity:(MORtmEntity *)entity{
  817. MORtmJosnEntity *jsonEntity = (MORtmJosnEntity *)entity.data;
  818. MOUserProfile *userProfile = [MOUserProfile new];
  819. userProfile.id = jsonEntity.userId;
  820. userProfile.avatar = jsonEntity.avatar;
  821. userProfile.agoraId = jsonEntity.agoraId;
  822. userProfile.nickname = jsonEntity.userName;
  823. MOLinkMic *linkMic = [MOLinkMic new];
  824. linkMic.video = (jsonEntity.type == 1) ? YES : NO;
  825. linkMic.profile = userProfile;
  826. linkMic.video1 = jsonEntity.video1;
  827. linkMic.video2 = jsonEntity.video2;
  828. linkMic.audio1 = jsonEntity.audio1;
  829. linkMic.audio2 = jsonEntity.audio2;
  830. linkMic.admin = jsonEntity.admin;
  831. return linkMic;
  832. }
  833. @end