mirror of
https://github.com/kuaifan/dootask.git
synced 2026-02-23 17:30:33 +00:00
perf: 离职后退出所有群
This commit is contained in:
parent
623c32113d
commit
0e71efd714
@ -766,14 +766,37 @@ class UsersController extends AbstractController
|
|||||||
]);
|
]);
|
||||||
$userTransfer->save();
|
$userTransfer->save();
|
||||||
$userTransfer->start();
|
$userTransfer->start();
|
||||||
// 离职移出全员群组
|
// 离职移出群组
|
||||||
$dialog = WebSocketDialog::whereGroupType('all')->orderByDesc('id')->first();
|
WebSocketDialog::select(['web_socket_dialogs.*'])
|
||||||
$dialog?->exitGroup($userInfo->userid, 'remove', false, false);
|
->join('web_socket_dialog_users as u', 'web_socket_dialogs.id', '=', 'u.dialog_id')
|
||||||
|
->where('web_socket_dialogs.type', 'group')
|
||||||
|
->where('u.userid', $userInfo->userid)
|
||||||
|
->orderByDesc('web_socket_dialogs.id')
|
||||||
|
->chunk(100, function($list) use ($transferUser, $userInfo) {
|
||||||
|
/** @var WebSocketDialog $dialog */
|
||||||
|
foreach ($list as $dialog) {
|
||||||
|
// 离职员工退出群
|
||||||
|
$dialog->exitGroup($userInfo->userid, 'remove', false, false);
|
||||||
|
if ($dialog->owner_id === $userInfo->userid) {
|
||||||
|
// 如果是群主则把交接人设为群主
|
||||||
|
$dialog->owner_id = $transferUser->userid;
|
||||||
|
if ($dialog->save()) {
|
||||||
|
$dialog->joinGroup($transferUser->userid, 0);
|
||||||
|
$dialog->pushMsg("groupUpdate", [
|
||||||
|
'id' => $dialog->id,
|
||||||
|
'owner_id' => $dialog->owner_id,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
} elseif ($type === 'cleardisable') {
|
} elseif ($type === 'cleardisable') {
|
||||||
// 取消离职重新加入全员群组
|
// 取消离职重新加入全员群组
|
||||||
|
if (Base::settingFind('system', 'all_group_autoin', 'yes') === 'yes') {
|
||||||
$dialog = WebSocketDialog::whereGroupType('all')->orderByDesc('id')->first();
|
$dialog = WebSocketDialog::whereGroupType('all')->orderByDesc('id')->first();
|
||||||
$dialog?->joinGroup($userInfo->userid, $user->userid);
|
$dialog?->joinGroup($userInfo->userid, $user->userid);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
|||||||
@ -230,7 +230,7 @@
|
|||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem :label="$L('交接人')">
|
<FormItem :label="$L('交接人')">
|
||||||
<UserInput v-model="disableData.transfer_userid" :disabled-choice="[disableData.userid]" :multiple-max="1" max-hidden-select :placeholder="$L('选择交接人')"/>
|
<UserInput v-model="disableData.transfer_userid" :disabled-choice="[disableData.userid]" :multiple-max="1" max-hidden-select :placeholder="$L('选择交接人')"/>
|
||||||
<div class="form-tip">{{ $L(`${disableData.nickname} 负责的项目、任务和文件将移交给交接人`) }}</div>
|
<div class="form-tip">{{ $L(`${disableData.nickname} 负责的项目、任务和文件将移交给交接人;同时退出所有群(如果是群主则转让给交接人)`) }}</div>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
</Form>
|
</Form>
|
||||||
<div slot="footer" class="adaption">
|
<div slot="footer" class="adaption">
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user