mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 20:17:24 +08:00
fix torrent update notify staff
This commit is contained in:
@@ -477,7 +477,7 @@ class TorrentRepository extends BaseRepository
|
|||||||
//No change
|
//No change
|
||||||
return $params;
|
return $params;
|
||||||
}
|
}
|
||||||
$torrentUpdate = $torrentOperationLog = $staffMsg = [];
|
$torrentUpdate = $torrentOperationLog = [];
|
||||||
$torrentUpdate['approval_status'] = $params['approval_status'];
|
$torrentUpdate['approval_status'] = $params['approval_status'];
|
||||||
if ($params['approval_status'] == Torrent::APPROVAL_STATUS_ALLOW) {
|
if ($params['approval_status'] == Torrent::APPROVAL_STATUS_ALLOW) {
|
||||||
$torrentUpdate['banned'] = 'no';
|
$torrentUpdate['banned'] = 'no';
|
||||||
@@ -506,18 +506,8 @@ class TorrentRepository extends BaseRepository
|
|||||||
$torrentOperationLog['comment'] = $params['comment'] ?? '';
|
$torrentOperationLog['comment'] = $params['comment'] ?? '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($torrent->banned == 'yes' && $torrent->owner == $user->id) {
|
NexusDB::transaction(function () use ($torrent, $torrentOperationLog, $torrentUpdate) {
|
||||||
$torrentUrl = sprintf('%s/details.php?id=%s', getSchemeAndHttpHost(), $torrent->id);
|
$log = "torrent: " . $torrent->id;
|
||||||
$staffMsg = [
|
|
||||||
'sender' => $user->id,
|
|
||||||
'subject' => nexus_trans('torrent.owner_update_torrent_subject', ['detail_url' => $torrentUrl, 'torrent_name' => $_POST['name']]),
|
|
||||||
'msg' => nexus_trans('torrent.owner_update_torrent_msg', ['detail_url' => $torrentUrl, 'torrent_name' => $_POST['name']]),
|
|
||||||
'added' => now(),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
NexusDB::transaction(function () use ($torrent, $torrentOperationLog, $torrentUpdate, $staffMsg) {
|
|
||||||
$log = "";
|
|
||||||
if (!empty($torrentUpdate)) {
|
if (!empty($torrentUpdate)) {
|
||||||
$log .= "[UPDATE_TORRENT]: " . nexus_json_encode($torrentUpdate);
|
$log .= "[UPDATE_TORRENT]: " . nexus_json_encode($torrentUpdate);
|
||||||
$torrent->update($torrentUpdate);
|
$torrent->update($torrentUpdate);
|
||||||
@@ -526,11 +516,6 @@ class TorrentRepository extends BaseRepository
|
|||||||
$log .= "[ADD_TORRENT_OPERATION_LOG]: " . nexus_json_encode($torrentOperationLog);
|
$log .= "[ADD_TORRENT_OPERATION_LOG]: " . nexus_json_encode($torrentOperationLog);
|
||||||
TorrentOperationLog::add($torrentOperationLog);
|
TorrentOperationLog::add($torrentOperationLog);
|
||||||
}
|
}
|
||||||
if (!empty($staffMsg)) {
|
|
||||||
$log .= "[INSERT_STAFF_MESSAGE]: " . nexus_json_encode($staffMsg);
|
|
||||||
StaffMessage::query()->insert($staffMsg);
|
|
||||||
NexusDB::cache_del('staff_new_message_count');
|
|
||||||
}
|
|
||||||
do_log($log);
|
do_log($log);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -251,6 +251,16 @@ else
|
|||||||
$searchRep = new \App\Repositories\SearchRepository();
|
$searchRep = new \App\Repositories\SearchRepository();
|
||||||
$searchRep->updateTorrent($id);
|
$searchRep->updateTorrent($id);
|
||||||
|
|
||||||
|
if ($row['banned'] == 'yes' && $row['owner'] == $CURUSER['id']) {
|
||||||
|
$torrentUrl = sprintf('%s/details.php?id=%s', getSchemeAndHttpHost(), $row['id']);
|
||||||
|
\App\Models\StaffMessage::query()->insert([
|
||||||
|
'sender' => $CURUSER['id'],
|
||||||
|
'subject' => nexus_trans('torrent.owner_update_torrent_subject', ['detail_url' => $torrentUrl, 'torrent_name' => $_POST['name']]),
|
||||||
|
'msg' => nexus_trans('torrent.owner_update_torrent_msg', ['detail_url' => $torrentUrl, 'torrent_name' => $_POST['name']]),
|
||||||
|
'added' => now(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
$returl = "details.php?id=$id&edited=1";
|
$returl = "details.php?id=$id&edited=1";
|
||||||
if (isset($_POST["returnto"]))
|
if (isset($_POST["returnto"]))
|
||||||
$returl = $_POST["returnto"];
|
$returl = $_POST["returnto"];
|
||||||
|
|||||||
Reference in New Issue
Block a user