[Super Group]

This commit is contained in:
hrxiang
2022-07-22 12:12:55 +08:00
parent cff0a4cce2
commit 18f099c437
7 changed files with 98 additions and 5 deletions

View File

@@ -700,6 +700,37 @@ class MessageManager {
"operationID": Utils.checkOperationID(operationID),
})));
/// 获取聊天记录(以startMsg为节点以前的聊天记录)
/// [userID] 接收消息的用户id
/// [conversationID] 会话id查询通知时可用
/// [groupID] 接收消息的组id
/// [startMsg] 从这条消息开始查询[count]条获取的列表index==length-1为最新消息所以获取下一页历史记录startMsg=list.first
/// [count] 一次拉取的总数
/// [lastMinSeq] 第一页消息不用传,获取第二页开始必传 跟[startMsg]一样
Future<AdvancedMessage> getAdvancedHistoryMessageList({
String? userID,
String? groupID,
String? conversationID,
int? lastMinSeq,
Message? startMsg,
int? count,
String? operationID,
}) =>
_channel
.invokeMethod(
'getAdvancedHistoryMessageList',
_buildParam({
'userID': userID ?? '',
'groupID': groupID ?? '',
'conversationID': conversationID ?? '',
'startClientMsgID': startMsg?.clientMsgID ?? '',
'count': count ?? 40,
'lastMinSeq': lastMinSeq ?? 0,
'operationID': Utils.checkOperationID(operationID),
}))
.then((value) =>
Utils.toObj(value, (map) => AdvancedMessage.fromJson(map)));
static Map _buildParam(Map param) {
param["ManagerName"] = "messageManager";
return param;

View File

@@ -298,6 +298,12 @@ class GroupApplicationInfo {
/// 扩展信息
String? ex;
/// 2通过邀请 3通过搜索 4通过二维码
int? joinSource;
/// 邀请进群用户ID
String? inviterUserID;
GroupApplicationInfo({
this.groupID,
this.groupName,
@@ -321,6 +327,8 @@ class GroupApplicationInfo {
this.handleUserID,
this.handledTime,
this.ex,
this.inviterUserID,
this.joinSource,
});
GroupApplicationInfo.fromJson(Map<String, dynamic> json) {
@@ -346,6 +354,8 @@ class GroupApplicationInfo {
handleUserID = json['handleUserID'];
handledTime = json['handledTime'];
ex = json['ex'];
inviterUserID = json['inviterUserID'];
joinSource = json['joinSource'];
}
Map<String, dynamic> toJson() {
@@ -372,6 +382,8 @@ class GroupApplicationInfo {
data['handleUserID'] = this.handleUserID;
data['handledTime'] = this.handledTime;
data['ex'] = this.ex;
data['inviterUserID'] = this.inviterUserID;
data['joinSource'] = this.joinSource;
return data;
}
}

View File

@@ -1034,3 +1034,41 @@ class RevokedInfo {
return data;
}
}
class AdvancedMessage {
List<Message>? messageList;
bool? isEnd;
int? errCode;
String? errMsg;
int? lastMinSeq;
AdvancedMessage({
this.messageList,
this.isEnd,
this.errCode,
this.errMsg,
this.lastMinSeq,
});
AdvancedMessage.fromJson(Map<String, dynamic> json) {
messageList = json['messageList'] == null
? null
: (json['messageList'] as List)
.map((e) => Message.fromJson(e))
.toList();
isEnd = json['isEnd'];
errCode = json['errCode'];
errMsg = json['errMsg'];
lastMinSeq = json['lastMinSeq'];
}
Map<String, dynamic> toJson() {
final data = Map<String, dynamic>();
data['messageList'] = this.messageList?.map((e) => e.toJson()).toList();
data['isEnd'] = this.isEnd;
data['errCode'] = this.errCode;
data['errMsg'] = this.errMsg;
data['lastMinSeq'] = this.lastMinSeq;
return data;
}
}

View File

@@ -2,14 +2,14 @@ import 'dart:convert';
class Utils {
static List<T> toList<T>(String value, T f(Map<String, dynamic> map)) =>
(_formatJson(value) as List).map((e) => f(e)).toList();
(formatJson(value) as List).map((e) => f(e)).toList();
static T toObj<T>(String value, T f(Map<String, dynamic> map)) =>
f(_formatJson(value));
f(formatJson(value));
static List<dynamic> toListMap(String value) => _formatJson(value);
static List<dynamic> toListMap(String value) => formatJson(value);
static dynamic _formatJson(String value) => jsonDecode(value);
static dynamic formatJson(String value) => jsonDecode(value);
static String checkOperationID(String? obj) =>
obj ?? DateTime.now().millisecondsSinceEpoch.toString();