peer location relative to privacy

This commit is contained in:
xiaomlove
2022-07-24 02:04:29 +08:00
parent f9bcb4d969
commit fefb6ff8f3
3 changed files with 63 additions and 48 deletions

View File

@@ -179,7 +179,7 @@ class Torrent extends NexusModel
throw new \RuntimeException('no select sp_state field');
}
$spState = $this->sp_state;
$global = self::getGlobalPromotionState();
$global = get_global_sp_state();
$log = sprintf('torrent: %s sp_state: %s, global sp state: %s', $this->id, $spState, $global);
if ($global != self::PROMOTION_NORMAL) {
$spState = $global;
@@ -214,18 +214,6 @@ class Torrent extends NexusModel
);
}
public static function getGlobalPromotionState()
{
if (is_null(self::$globalPromotionState)) {
$result = TorrentState::query()->first(['global_sp_state']);
if (!$result) {
do_log("global sp state no value", 'error');
}
self::$globalPromotionState = $result->global_sp_state ?? false;
}
return self::$globalPromotionState;
}
public static function getFieldsForList($appendTableName = false): array|bool
{
$fields = 'id, sp_state, promotion_time_type, promotion_until, banned, picktype, pos_state, category, source, medium, codec, standard, processing, team, audiocodec, leechers, seeders, name, small_descr, times_completed, size, added, comments,anonymous,owner,url,cache_stamp, pt_gen, hr, approval_status';