作者:金针菇滚滚夹着五根水葱 | 来源:互联网 | 2023-07-13 18:38
Flutter高仿微信系列共59篇,从Flutter客户端、Kotlin客户端、Web服务器、数据库表结构、Xmpp即时通讯服务器、视频通话服务器、腾讯云服务器全面讲
Flutter高仿微信系列共59篇,从Flutter客户端、Kotlin客户端、Web服务器、数据库表结构、Xmpp即时通讯服务器、视频通话服务器、腾讯云服务器全面讲解。
详情请查看
效果图:
实现代码:
//删除并退出对话框
void _deleteAndExistDialog(){LoadingDialogUtils.showBaseDialog(context, msg: "确定要删除并退出吗?", clickConfirm: (){_deleteAndExist();}, clickCancel: (){});
}//删除并退出
void _deleteAndExist() async {LoadingDialogUtils.showLoadingContentDialog(context);String account = SpUtils.getAccount();List members = [account];GroupUserBean? groupUserBean = await GroupUserRepository.getInstance().findGroupUserByAccountAndGroupId(account, widget.groupId);//清空群聊信息await GroupChatRepository.getInstance().deleteAllGroupChatByGroupId(widget.groupId);//删除群聊用户await GroupUserRepository.getInstance().deleteGroupUserByGroupId(account, widget.groupId);await GroupUserRepository.getInstance().deleteGroupUserByGroupIdAndAccountServer(account, widget.groupId);LoadingDialogUtils.dimissLoadingDialog(context);Navigator.popUntil(context, (route) {return route.isFirst;});
} //删除本地群聊数据
@override
Future deleteAllGroupChatByGroupId(String groupId) async {String sql = "DELETE FROM wc_group_chat where group_id = '${groupId}'";return _queryAdapter.queryNoReturn(sql);
} //删除本地群成员数据
@override
Future deleteGroupUserByGroupId(String account, String groupId) async {String sql = "DELETE FROM ${tableName} where group_id = '${groupId}' and account = '${account}' ";return _queryAdapter.queryNoReturn(sql);
} //删除群成员-web服务器端删除
Future deleteGroupUserByGroupIdAndAccount(String account, String groupId) async {LogUtils.d("删除群成员:${account}, ${groupId}");String url = BASE_URL + "groupUser?method=deleteGroupUserByGroupIdAndAccount";Response respOnse= await getInstance().postForm(url,{'account': account,'groupId':groupId});final respOnseResult= jsonDecode(response.toString());final baseResult = BaseResult.fromJson(responseResult);LogUtils.d("删除群成员baseResult:${baseResult.toJson()}");return baseResult.isSuccess!;
}