refactor model event again

This commit is contained in:
xiaomlove
2024-04-26 03:21:35 +08:00
parent ae29693549
commit 8a44a0a269
12 changed files with 136 additions and 31 deletions

View File

@@ -3114,9 +3114,9 @@ function loggedinorreturn($mainpage = false) {
function deletetorrent($id, $notify = false) {
$idArr = is_array($id) ? $id : [$id];
$torrentInfo = \Nexus\Database\NexusDB::table("torrents")
$torrentInfo = \App\Models\Torrent::query()
->whereIn("id", $idArr)
->get(['id', 'pieces_hash'])
->get()
->KeyBy("id")
;
$torrentRep = new \App\Repositories\TorrentRepository();
@@ -3146,7 +3146,7 @@ function deletetorrent($id, $notify = false) {
$meiliSearchRep->deleteDocuments($idArr);
if (is_int($id)) {
do_action("torrent_delete", $id);
fire_event("torrent_deleted", $id);
fire_event("torrent_deleted", $torrentInfo->get($id));
}
}