mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-23 19:37:23 +08:00
announce only check paid torrent for leechers
This commit is contained in:
@@ -95,8 +95,9 @@ class Test extends Command
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$r = nexus_env('PHP_PATH') ?: 'php';
|
||||
dd($r);
|
||||
$now = Carbon::now();
|
||||
$now->addSeconds();
|
||||
dd($diffInSeconds);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -31,9 +31,10 @@ class Torrent extends NexusModel
|
||||
];
|
||||
|
||||
public static $commentFields = [
|
||||
'id', 'name', 'added', 'visible', 'banned', 'owner', 'sp_state', 'pos_state', 'hr', 'picktype', 'picktime',
|
||||
'last_action', 'leechers', 'seeders', 'times_completed', 'views', 'size', 'cover', 'anonymous', 'approval_status',
|
||||
'pos_state_until', 'category', 'source', 'medium', 'codec', 'standard', 'processing', 'team', 'audiocodec', 'price'
|
||||
'id', 'name', 'added', 'visible', 'banned', 'owner', 'sp_state', 'promotion_time_type', 'promotion_until', 'pos_state',
|
||||
'hr', 'picktype', 'picktime', 'last_action', 'leechers', 'seeders', 'times_completed', 'views', 'size', 'cover', 'anonymous',
|
||||
'approval_status', 'pos_state_until', 'category', 'source', 'medium', 'codec', 'standard', 'processing', 'team', 'audiocodec',
|
||||
'price',
|
||||
];
|
||||
|
||||
public static $basicRelations = [
|
||||
|
||||
@@ -479,7 +479,7 @@ class TorrentRepository extends BaseRepository
|
||||
{
|
||||
$user = $this->getUser($user);
|
||||
user_can('torrent-approval', true);
|
||||
$torrent = Torrent::query()->findOrFail($params['torrent_id'], ['id', 'banned', 'approval_status', 'visible', 'owner']);
|
||||
$torrent = Torrent::query()->findOrFail($params['torrent_id'], Torrent::$commentFields);
|
||||
$lastLog = TorrentOperationLog::query()
|
||||
->where('torrent_id', $params['torrent_id'])
|
||||
->where('uid', $user->id)
|
||||
@@ -497,6 +497,21 @@ class TorrentRepository extends BaseRepository
|
||||
$torrentUpdate['visible'] = 'yes';
|
||||
if ($torrent->approval_status != $params['approval_status']) {
|
||||
$torrentOperationLog['action_type'] = TorrentOperationLog::ACTION_TYPE_APPROVAL_ALLOW;
|
||||
//increase promotion time
|
||||
if (
|
||||
Setting::get('torrent.approval_status_none_visible') == 'no'
|
||||
&& $torrent->sp_state != Torrent::PROMOTION_NORMAL
|
||||
&& $torrent->promotion_until
|
||||
) {
|
||||
$hasBeenDownloaded = Snatch::query()->where('torrentid', $torrent->id)->exists();
|
||||
$log = "Torrent: {$torrent->id} is in promotion, hasBeenDownloaded: $hasBeenDownloaded";
|
||||
if (!$hasBeenDownloaded) {
|
||||
$diffInSeconds = $torrent->promotion_until->diffInSeconds($torrent->added);
|
||||
$log .= ", addSeconds: $diffInSeconds";
|
||||
$torrentUpdate['promotion_until'] = $torrent->promotion_until->addSeconds($diffInSeconds);
|
||||
}
|
||||
do_log($log);
|
||||
}
|
||||
}
|
||||
if ($torrent->approval_status == Torrent::APPROVAL_STATUS_DENY) {
|
||||
$notifyUser = true;
|
||||
@@ -519,6 +534,7 @@ class TorrentRepository extends BaseRepository
|
||||
} else {
|
||||
throw new \InvalidArgumentException("Invalid approval_status: " . $params['approval_status']);
|
||||
}
|
||||
|
||||
if (isset($torrentOperationLog['action_type'])) {
|
||||
$torrentOperationLog['uid'] = $user->id;
|
||||
$torrentOperationLog['torrent_id'] = $torrent->id;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.8.0');
|
||||
defined('RELEASE_DATE') || define('RELEASE_DATE', '2023-02-11');
|
||||
defined('RELEASE_DATE') || define('RELEASE_DATE', '2023-02-12');
|
||||
defined('IN_TRACKER') || define('IN_TRACKER', false);
|
||||
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
|
||||
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");
|
||||
|
||||
+1
-1
@@ -152,7 +152,7 @@ if ($torrent['approval_status'] != \App\Models\Torrent::APPROVAL_STATUS_ALLOW &&
|
||||
err("torrent review not approved");
|
||||
}
|
||||
}
|
||||
if (isset($torrent['price']) && $torrent['price'] > 0 && $torrent['owner'] != $userid) {
|
||||
if ($seeder == 'no' && isset($torrent['price']) && $torrent['price'] > 0 && $torrent['owner'] != $userid) {
|
||||
$hasBuy = \App\Models\TorrentBuyLog::query()->where('uid', $userid)->where('torrent_id', $torrent['id'])->exists();
|
||||
if (!$hasBuy) {
|
||||
err("You have not buy the torrent yet");
|
||||
|
||||
Reference in New Issue
Block a user