25 lines
757 B
Dart
25 lines
757 B
Dart
import 'package:get/get.dart';
|
|
import 'package:loopin/IM/im_service.dart';
|
|
import 'package:loopin/models/conversation_view_model.dart';
|
|
|
|
class ChatController extends GetxController {
|
|
RxInt count = 100.obs; // 每页条数
|
|
RxString nextSeq = '0'.obs; // 页码
|
|
|
|
final chatList = <ConversationViewModel>[].obs;
|
|
|
|
// 获取会话列表
|
|
void getConversationList() async {
|
|
final res = await ImService.instance.getConversationList(nextSeq.value, count.value);
|
|
|
|
if (!res.success || res.data == null) return;
|
|
|
|
final List<ConversationViewModel> convList = res.data;
|
|
// for (var conv in convList) {
|
|
// logger.i('基本会话: ${conv.conversation.toLogString()}, 头像: ${conv.faceUrl}');
|
|
// }
|
|
|
|
chatList.value = convList;
|
|
}
|
|
}
|