diff --git a/app/Models/WebSocketDialog.php b/app/Models/WebSocketDialog.php index 38be79c03..f4ebd19bf 100644 --- a/app/Models/WebSocketDialog.php +++ b/app/Models/WebSocketDialog.php @@ -258,8 +258,13 @@ class WebSocketDialog extends AbstractModel /** @var WebSocketDialogUser $item */ foreach ($list as $item) { if ($checkDelete) { - if ($type === 'remove' && !in_array(User::userid(), [$this->owner_id, $item->inviter])) { - throw new ApiException('只有群主或邀请人可以移出成员'); + if ($type === 'remove') { + // 移出时:如果是全员群仅允许管理员操作,其他群仅群主或邀请人可以操作 + if ($this->group_type === 'all') { + User::auth("admin"); + } elseif (!in_array(User::userid(), [$this->owner_id, $item->inviter])) { + throw new ApiException('只有群主或邀请人可以移出成员'); + } } if ($item->userid == $this->owner_id) { throw new ApiException('群主不可' . $typeDesc); diff --git a/resources/assets/js/pages/manage/components/DialogGroupInfo.vue b/resources/assets/js/pages/manage/components/DialogGroupInfo.vue index ffb12be2b..16fbbf837 100644 --- a/resources/assets/js/pages/manage/components/DialogGroupInfo.vue +++ b/resources/assets/js/pages/manage/components/DialogGroupInfo.vue @@ -21,9 +21,7 @@
  • {{ $L("群主") }}
    -
    - -
    +
  • @@ -32,7 +30,7 @@ -
    +
    @@ -88,7 +86,7 @@ export default { }, computed: { - ...mapState(['cacheDialogs', 'cacheUserBasic']), + ...mapState(['cacheDialogs', 'cacheUserBasic', 'userIsAdmin']), dialogData() { return this.cacheDialogs.find(({id}) => id == this.dialogId) || {}; @@ -183,6 +181,14 @@ export default { }); }, + operableAdd() { + const {owner_id, group_type} = this.dialogData + if (group_type == 'all') { + return this.userIsAdmin + } + return [0, this.userId].includes(owner_id) + }, + openAdd() { this.addData = { dialog_id: this.dialogId, @@ -209,10 +215,18 @@ export default { }); }, + operableExit(item) { + const {owner_id, group_type} = this.dialogData + if (group_type == 'all') { + return this.userIsAdmin + } + return owner_id == this.userId || item.inviter == this.userId + }, + onExit(item) { let content = "你确定要退出群组吗?" let userids = []; - if ($A.isJson(item)) { + if ($A.isJson(item) && item.userid != this.userId) { content = `你确定要将【${item.nickname}】移出群组吗?` userids = [item.userid]; }