Flutter高仿微信-第53篇-群聊-删除并退出
创始人
2024-02-18 12:47:36
0

 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!;
}

相关内容

热门资讯

喜欢穿一身黑的男生性格(喜欢穿... 今天百科达人给各位分享喜欢穿一身黑的男生性格的知识,其中也会对喜欢穿一身黑衣服的男人人好相处吗进行解...
发春是什么意思(思春和发春是什... 本篇文章极速百科给大家谈谈发春是什么意思,以及思春和发春是什么意思对应的知识点,希望对各位有所帮助,...
网络用语zl是什么意思(zl是... 今天给各位分享网络用语zl是什么意思的知识,其中也会对zl是啥意思是什么网络用语进行解释,如果能碰巧...
为什么酷狗音乐自己唱的歌不能下... 本篇文章极速百科小编给大家谈谈为什么酷狗音乐自己唱的歌不能下载到本地?,以及为什么酷狗下载的歌曲不是...
家里可以做假山养金鱼吗(假山能... 今天百科达人给各位分享家里可以做假山养金鱼吗的知识,其中也会对假山能放鱼缸里吗进行解释,如果能碰巧解...
华为下载未安装的文件去哪找(华... 今天百科达人给各位分享华为下载未安装的文件去哪找的知识,其中也会对华为下载未安装的文件去哪找到进行解...
四分五裂是什么生肖什么动物(四... 本篇文章极速百科小编给大家谈谈四分五裂是什么生肖什么动物,以及四分五裂打一生肖是什么对应的知识点,希...
怎么往应用助手里添加应用(应用... 今天百科达人给各位分享怎么往应用助手里添加应用的知识,其中也会对应用助手怎么添加微信进行解释,如果能...
苏州离哪个飞机场近(苏州离哪个... 本篇文章极速百科小编给大家谈谈苏州离哪个飞机场近,以及苏州离哪个飞机场近点对应的知识点,希望对各位有...
客厅放八骏马摆件可以吗(家里摆... 今天给各位分享客厅放八骏马摆件可以吗的知识,其中也会对家里摆八骏马摆件好吗进行解释,如果能碰巧解决你...