Fix bug
This commit is contained in:
parent
d64b426c90
commit
d120312ac9
@ -25,6 +25,7 @@ export 'src/manager/im_user_manager.dart';
|
||||
export 'src/models/conversation_info.dart';
|
||||
export 'src/models/group_info.dart';
|
||||
export 'src/models/message.dart';
|
||||
export 'src/models/search_info.dart';
|
||||
export 'src/models/signaling_info.dart';
|
||||
export 'src/models/user_info.dart';
|
||||
export 'src/openim.dart';
|
||||
|
@ -522,7 +522,7 @@ class MessageManager {
|
||||
|
||||
/// Search local message
|
||||
/// 搜索消息
|
||||
Future<dynamic> searchLocalMessages({
|
||||
Future<SearchResult> searchLocalMessages({
|
||||
required String sourceID,
|
||||
required int sessionType,
|
||||
List<String> keywordList = const [],
|
||||
@ -535,23 +535,26 @@ class MessageManager {
|
||||
int count = 40,
|
||||
String? operationID,
|
||||
}) =>
|
||||
_channel.invokeMethod(
|
||||
'searchLocalMessages',
|
||||
_buildParam({
|
||||
'filter': {
|
||||
'sourceID': sourceID,
|
||||
'sessionType': sessionType,
|
||||
'keywordList': keywordList,
|
||||
'keywordListMatchType': keywordListMatchType,
|
||||
'senderUserIDList': senderUserIDList,
|
||||
'messageTypeList': messageTypeList,
|
||||
'searchTimePosition': searchTimePosition,
|
||||
'searchTimePeriod': searchTimePeriod,
|
||||
'pageIndex': pageIndex,
|
||||
'count': count,
|
||||
},
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}));
|
||||
_channel
|
||||
.invokeMethod(
|
||||
'searchLocalMessages',
|
||||
_buildParam({
|
||||
'filter': {
|
||||
'sourceID': sourceID,
|
||||
'sessionType': sessionType,
|
||||
'keywordList': keywordList,
|
||||
'keywordListMatchType': keywordListMatchType,
|
||||
'senderUserIDList': senderUserIDList,
|
||||
'messageTypeList': messageTypeList,
|
||||
'searchTimePosition': searchTimePosition,
|
||||
'searchTimePeriod': searchTimePeriod,
|
||||
'pageIndex': pageIndex,
|
||||
'count': count,
|
||||
},
|
||||
'operationID': Utils.checkOperationID(operationID),
|
||||
}))
|
||||
.then((value) =>
|
||||
Utils.toObj(value, (map) => SearchResult.fromJson(map)));
|
||||
|
||||
static Map _buildParam(Map param) {
|
||||
param["ManagerName"] = "messageManager";
|
||||
|
57
lib/src/models/search_info.dart
Normal file
57
lib/src/models/search_info.dart
Normal file
@ -0,0 +1,57 @@
|
||||
import 'package:flutter_openim_sdk/flutter_openim_sdk.dart';
|
||||
|
||||
class SearchResult {
|
||||
int? totalCount;
|
||||
List<SearchResultItems>? searchResultItems;
|
||||
|
||||
SearchResult({this.totalCount, this.searchResultItems});
|
||||
|
||||
SearchResult.fromJson(Map<String, dynamic> json) {
|
||||
totalCount = json['totalCount'];
|
||||
if (json['searchResultItems'] != null) {
|
||||
searchResultItems = <SearchResultItems>[];
|
||||
json['searchResultItems'].forEach((v) {
|
||||
searchResultItems!.add(SearchResultItems.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = Map<String, dynamic>();
|
||||
data['totalCount'] = this.totalCount;
|
||||
if (this.searchResultItems != null) {
|
||||
data['searchResultItems'] =
|
||||
this.searchResultItems!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class SearchResultItems {
|
||||
String? conversationID;
|
||||
int? messageCount;
|
||||
List<Message>? messageList;
|
||||
|
||||
SearchResultItems({this.conversationID, this.messageCount, this.messageList});
|
||||
|
||||
SearchResultItems.fromJson(Map<String, dynamic> json) {
|
||||
conversationID = json['conversationID'];
|
||||
messageCount = json['messageCount'];
|
||||
if (json['messageList'] != null) {
|
||||
messageList = <Message>[];
|
||||
json['messageList'].forEach((v) {
|
||||
messageList!.add(Message.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final data = Map<String, dynamic>();
|
||||
data['conversationID'] = this.conversationID;
|
||||
data['messageCount'] = this.messageCount;
|
||||
if (this.messageList != null) {
|
||||
data['messageList'] = this.messageList!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user