live_room_message_info.dart 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455
  1. import 'package:flutter/material.dart';
  2. enum XYPkBattlingStatus {
  3. XYPkBattlingStatusLeftDefault,//表示显示左边头像
  4. XYPkBattlingStatusRightDefault,//表示显示右边新增邀请按钮
  5. XYPkBattlingStatusWait,//等待加入
  6. XYPkBattlingStatusBattling,//PK 中
  7. XYPkBattlingStatusPunish,//惩罚
  8. XYPkBattlingStatusOver,//结束
  9. }
  10. class LiveRoomMessageInfo {
  11. //消息类型
  12. String? type;
  13. /// 消息时间戳
  14. String? timestamp;
  15. /// 用户配置信息字符串 通过截取字段
  16. String? profileString;
  17. /// 发送者用户id
  18. // String? senderId;
  19. /// 发送者用户名
  20. String? senderNickname;
  21. /// 发送者头像url
  22. String? senderAvatarUrl;
  23. /// 接收者用户id
  24. String? reciveId;
  25. /// 接收者用户id
  26. String? reciveNickname;
  27. /// 接收者的头像url
  28. String? reciveAvatarUrl;
  29. /// 主播的用户id
  30. String? anchorUserId;
  31. /// 用户等级
  32. int? grageNum;
  33. /// 主播等级
  34. int? anchorGrageNum;
  35. /// 贵族等级
  36. int? nobility;
  37. /// 官方
  38. int? isOfficial;
  39. /// 房主
  40. int? isHouseOwer;
  41. /// 房管
  42. int? isHouseManager;
  43. /// 主持人
  44. int? isHost;
  45. /// 性别 1男 2女
  46. int? userSex;
  47. /// 年龄
  48. String? userAge;
  49. ///聊天用户标签(等级、靓号、官方等)+ 用户名字AWRichText
  50. // @property (nonatomic, strong) AWRichText userMarkRichText;
  51. // ///聊天、礼物文字
  52. // @property (nonatomic, strong) AWRichText textRichText;
  53. // ///飘屏通知AWRichText
  54. // @property (nonatomic, strong) AWRichText noticeRichText;
  55. /// 内容标识
  56. String? contentText1;
  57. String? contentText2;
  58. String? contentText3;
  59. ///聊天列表总高度
  60. num? cellHeight;
  61. ///聊天列表需要显示的宽度
  62. num? cellShadowWidth;
  63. ///聊天列表用户标签高度
  64. num? cellUserMarkHeight;
  65. /// 礼物对应的动画资源id
  66. String? giftAnimationId;
  67. /// 是否为贴纸
  68. String? giftIsSticker;
  69. /// 贴纸名字
  70. String? giftStickerName;
  71. /// 贴纸路径url
  72. String? giftStickerPath;
  73. /// 贴纸显示时间
  74. String? giftStickerDuration;
  75. /// 礼物id
  76. String? giftId;
  77. /// 礼物数量
  78. String? giftQuantity;
  79. /// 礼物价格
  80. String? giftPrice;
  81. /// 1 - 购买的 2 - 从背包送的 3 - 百变礼盒开出
  82. String? giftSourceType;
  83. /// 礼物连击次数
  84. String? giftCombo;
  85. /// 礼物连击标识
  86. String? comboKeyHash;
  87. /// 礼物图片url
  88. String? giftImageUrl;
  89. /// 是否聊天列表显示
  90. bool? showInComment;
  91. /// 是否弹幕显示 isComboTimeout = true 时 标识这是一条连击结束的消息,只在弹幕中构造
  92. bool? isComboTimeout;
  93. /// 是否连击banner显示
  94. bool? isCombo;
  95. /// 礼物连击等级
  96. int? comboValueLevel;
  97. /// 礼物连击倒计时秒数
  98. int? comboPeriodSec;
  99. /// 礼物连击banner背景动画id
  100. String? giftBannerAnimationId;
  101. /// 礼物连击时全区通知的背景动画id
  102. String? floatScreenAnimationId;
  103. /// 礼物连击时全区通知的停留的时间
  104. num? floatScreenStayTime;
  105. /// 头饰动效id
  106. String? headWearAnimationId;
  107. /// 汽泡动效id
  108. String? bubbleId;
  109. /// 礼物名字
  110. String? giftName;
  111. /// 中奖金额
  112. String? winAmount;
  113. /// 中奖倍数
  114. String? winMultiple;
  115. /// 中奖最大倍数
  116. String? winMultipleMax;
  117. /// 热度
  118. String? heatNum;
  119. /// 观看人数
  120. String? watchNum;
  121. /// 直播状态
  122. String? liveStatus;
  123. /// 直播流状态
  124. String? streamStatus;
  125. /// 推流地址
  126. String? pullUrl;
  127. /// 房管
  128. int? userMasterAction;
  129. /// 神秘人
  130. String? anonymousGift;
  131. /// 目标类型
  132. // String? targetType;
  133. /// 用户角色
  134. String? userRole;
  135. /// 主播收入改变
  136. String? scoreValue;
  137. /// 官方
  138. String? offical;
  139. /// 11weath财富 21charm魅力
  140. String? scoreType;
  141. /// 主播魅力值
  142. String? glamorousNum;
  143. /// 主播收入
  144. String? incomeAmount;
  145. /// 是否为活动消息(太空旅行、幸运礼物/等)一排
  146. bool? isActivity;
  147. /// 是否为房间提示消息(进房,上下麦,房间上锁等)一排
  148. bool? isAlert;
  149. /// 是否为礼物或者聊天文字消,两排
  150. bool? isTextOrGift;
  151. /// 活动图片url
  152. String? activityIcon;
  153. /// 活动跳转链接
  154. String? activityUrl;
  155. /// 靓号
  156. String? niceNo;
  157. /// 靓号等级
  158. int? niceLevel;
  159. /// 坐骑id
  160. String? mountsId;
  161. /// 坐骑名字
  162. String? mountsName;
  163. /// 坐骑动画id
  164. String? mountsAnimationId;
  165. /// 勋章显示时间
  166. int? nobleTime;
  167. /// 勋章等级
  168. String? nobleValue;
  169. /// vip等级
  170. String? vipValue;
  171. /// 星耀等级
  172. String? starLevel;
  173. /// 勋章ID
  174. String? medalId;
  175. //1v1视频剩余可用时间
  176. String? minutesRemain;
  177. //通话计费时长
  178. String? hisMinutes;
  179. //通话费用
  180. String? hisAmount;
  181. //pk
  182. String? pkToken;
  183. String? pkBattleId;
  184. ////0拒绝 1同意
  185. String? pkDecision;
  186. int? pkProceedTime;
  187. int? pkPunishTime;
  188. int? pkChangeValue;
  189. String? pkUserId;
  190. List<dynamic>? pkTopGivers;
  191. ///battlingStatus 1等待加入 2PK中 3惩罚 4结束
  192. XYPkBattlingStatus? pkBattlingStatus;
  193. ///battleRole 1 红方 2 蓝方
  194. int? pkRole;
  195. ///battleResult 0 打平 1 红方胜 2 蓝方胜
  196. int? pkResult;
  197. int? pkRankIndex;
  198. ///battleResult 0 打平 1胜 2败
  199. int? pkRankResult;
  200. ///临时类型标识
  201. int? tempType;
  202. /// noticeType : 0 无消息 , 1 聊天框显示 , 2顶部显示 , 3都显示
  203. int? noticeType;
  204. /// 语音房消息
  205. /// 聊天室房间id
  206. String? roomId;
  207. /// 麦位
  208. int? seatNo;
  209. /// 上麦下麦用户id
  210. String? userId;
  211. /// 表情id
  212. String? expId;
  213. /// 表情url
  214. String? expUrl;
  215. /// 表情播放时间
  216. int? playTimes;
  217. /// 表情最后帧数
  218. int? finalFrame;
  219. /// 通知类型
  220. String? noticestyle;
  221. //用户信息实体
  222. XYLiveUserModel? userInfo;
  223. String? _groupId;
  224. SenderProfile? _senderProfile;
  225. int? _targetType;
  226. Msg? _msg;
  227. int? _senderId;
  228. String? get groupId => _groupId;
  229. SenderProfile? get senderProfile => _senderProfile;
  230. int? get targetType => _targetType;
  231. Msg? get msg => _msg;
  232. int? get senderId => _senderId;
  233. LiveRoomMessageInfo({
  234. String? groupId,
  235. SenderProfile? senderProfile,
  236. int? targetType,
  237. Msg? msg,
  238. int? senderId}){
  239. _groupId = groupId;
  240. _senderProfile = senderProfile;
  241. _targetType = targetType;
  242. _msg = msg;
  243. _senderId = senderId;
  244. }
  245. LiveRoomMessageInfo.fromJson(dynamic json) {
  246. _groupId = json['groupId'];
  247. _senderProfile = json['senderProfile'] != null ? SenderProfile.fromJson(json['senderProfile']) : null;
  248. _targetType = json['targetType'];
  249. _msg = json['msg'] != null ? Msg.fromJson(json['msg']) : null;
  250. _senderId = json['senderId'];
  251. userInfo = XYLiveUserModel();
  252. userInfo!.setPro(json["senderProfile"]["profileString"]);
  253. //这里是消息类型
  254. //1, 用户进入直播间
  255. if(_msg!.type == ""){
  256. }
  257. //2,
  258. }
  259. Map<String, dynamic> toJson() {
  260. var map = <String, dynamic>{};
  261. map['groupId'] = _groupId;
  262. if (_senderProfile != null) {
  263. map['senderProfile'] = _senderProfile?.toJson();
  264. }
  265. map['targetType'] = _targetType;
  266. if (_msg != null) {
  267. map['msg'] = _msg?.toJson();
  268. }
  269. map['senderId'] = _senderId;
  270. return map;
  271. }
  272. }
  273. class XYLiveUserModel {
  274. //粉丝等级
  275. int? fansLevel;
  276. /// 会员等级
  277. int? vipLevel;
  278. /// 守护等级
  279. int? guardLevel;
  280. /// 勋章 id
  281. String? medalIds;
  282. /// 是否房管 1观众 2房管 3主播
  283. int? userRole;
  284. /// 附加信息
  285. String? profileString;
  286. /// 是否新人 webscoket解析用户信息使用
  287. bool? isNew;
  288. /// 用户id
  289. String? userId;
  290. /// 用户头像
  291. String? userAvatar;
  292. /// 用户名字
  293. String? userName;
  294. /// 靓号 不是每个人都有
  295. String? niceNo;
  296. ///靓号等级
  297. int? niceLevel;
  298. /// 用户等级(财富等级)
  299. int? wealthLevel;
  300. ///星耀等级
  301. int? starLevel;
  302. /// 贵族等级
  303. int? nobleLevel;
  304. /// 是否正在直播
  305. bool? isLive;
  306. int? userSex;
  307. int? userAge;
  308. /// ID
  309. String? userNo;
  310. /// 在线状态
  311. int? isOnline;
  312. /// 是否实名认证
  313. bool? isAuth;
  314. /// 是否在房间 0不在 1在
  315. bool? isInRoom;
  316. /// tag
  317. String? userTag;
  318. void setPro(String profileString){
  319. if(profileString.length > 9){
  320. this.wealthLevel = int.parse(profileString.substring(0,3));
  321. this.nobleLevel = int.parse(profileString.substring(3,4));
  322. this.guardLevel = int.parse(profileString.substring(4,5));
  323. this.vipLevel = int.parse(profileString.substring(5,6));
  324. this.fansLevel = int.parse(profileString.substring(6,8));
  325. }
  326. this.niceLevel = int.parse(profileString.substring(9,10));
  327. if(profileString.length > 19){
  328. this.niceNo = (profileString.substring(10,20));
  329. }
  330. if (int.parse(profileString.substring(8,9)) == 0) {
  331. this.isNew = false;
  332. } else {
  333. this.isNew = true;
  334. }
  335. }
  336. }
  337. class Msg {
  338. String? _type;
  339. int? _timestamp;
  340. String? get type => _type;
  341. int? get timestamp => _timestamp;
  342. Msg({
  343. String? type,
  344. int? timestamp}){
  345. _type = type;
  346. _timestamp = timestamp;
  347. }
  348. Msg.fromJson(dynamic json) {
  349. _type = json['type'];
  350. _timestamp = json['timestamp'];
  351. }
  352. Map<String, dynamic> toJson() {
  353. var map = <String, dynamic>{};
  354. map['type'] = _type;
  355. map['timestamp'] = _timestamp;
  356. return map;
  357. }
  358. }
  359. /// userNo : 10811379
  360. /// userAvatar : "http://user.qn.timichat.net/avatar/162116510154752/1631951244395.png"
  361. /// userRole : 1
  362. /// profileString : "00110000000000000000"
  363. /// userId : 162116510154752
  364. /// userName : "好好66"
  365. class SenderProfile {
  366. int? _userNo;
  367. String? _userAvatar;
  368. int? _userRole;
  369. String? _profileString;
  370. int? _userId;
  371. String? _userName;
  372. int? get userNo => _userNo;
  373. String? get userAvatar => _userAvatar;
  374. int? get userRole => _userRole;
  375. String? get profileString => _profileString;
  376. int? get userId => _userId;
  377. String? get userName => _userName;
  378. SenderProfile({
  379. int? userNo,
  380. String? userAvatar,
  381. int? userRole,
  382. String? profileString,
  383. int? userId,
  384. String? userName}){
  385. _userNo = userNo;
  386. _userAvatar = userAvatar;
  387. _userRole = userRole;
  388. _profileString = profileString;
  389. _userId = userId;
  390. _userName = userName;
  391. }
  392. SenderProfile.fromJson(dynamic json) {
  393. _userNo = json['userNo'];
  394. _userAvatar = json['userAvatar'];
  395. _userRole = json['userRole'];
  396. _profileString = json['profileString'];
  397. _userId = json['userId'];
  398. _userName = json['userName'];
  399. }
  400. Map<String, dynamic> toJson() {
  401. var map = <String, dynamic>{};
  402. map['userNo'] = _userNo;
  403. map['userAvatar'] = _userAvatar;
  404. map['userRole'] = _userRole;
  405. map['profileString'] = _profileString;
  406. map['userId'] = _userId;
  407. map['userName'] = _userName;
  408. return map;
  409. }
  410. }