mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 03:57:22 +08:00
plugin sticky promotion do not change torrent original field
This commit is contained in:
@@ -39,7 +39,7 @@ use JeroenG\Explorer\Infrastructure\Scout\ElasticEngine;
|
||||
use League\Flysystem\StorageAttributes;
|
||||
use Nexus\Database\NexusDB;
|
||||
use Nexus\Imdb\Imdb;
|
||||
use NexusPlugin\PostLike\PostLike;
|
||||
use NexusPlugin\PostLike\PostLikeRepository;
|
||||
use NexusPlugin\StickyPromotion\Models\StickyPromotion;
|
||||
use NexusPlugin\StickyPromotion\Models\StickyPromotionParticipator;
|
||||
use Rhilip\Bencode\Bencode;
|
||||
@@ -77,8 +77,9 @@ class Test extends Command
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$r = StickyPromotionParticipator::query()->first();
|
||||
dd($r->created_at);
|
||||
$torrent = Torrent::query()->first();
|
||||
$torrent->name = Carbon::now()->toDateTimeString();
|
||||
$torrent->update(['seeders' => 100]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -16,12 +16,14 @@ class BonusLogs extends NexusModel
|
||||
const BUSINESS_TYPE_BUY_MEDAL = 2;
|
||||
const BUSINESS_TYPE_BUY_ATTENDANCE_CARD = 3;
|
||||
const BUSINESS_TYPE_STICKY_PROMOTION = 4;
|
||||
const BUSINESS_TYPE_POST_REWARD = 5;
|
||||
|
||||
public static array $businessTypes = [
|
||||
self::BUSINESS_TYPE_CANCEL_HIT_AND_RUN => ['text' => 'Cancel H&R'],
|
||||
self::BUSINESS_TYPE_BUY_MEDAL => ['text' => 'Buy medal'],
|
||||
self::BUSINESS_TYPE_BUY_ATTENDANCE_CARD => ['text' => 'Buy attendance card'],
|
||||
self::BUSINESS_TYPE_STICKY_PROMOTION => ['text' => 'Buy torrent sticky promotion'],
|
||||
self::BUSINESS_TYPE_POST_REWARD => ['text' => 'Reward post'],
|
||||
];
|
||||
|
||||
public static function getBonusForCancelHitAndRun()
|
||||
|
||||
@@ -14,7 +14,8 @@ class Torrent extends NexusModel
|
||||
'category', 'source', 'medium', 'codec', 'standard', 'processing', 'team', 'audiocodec',
|
||||
'size', 'added', 'type', 'numfiles', 'owner', 'nfo', 'sp_state', 'promotion_time_type',
|
||||
'promotion_until', 'anonymous', 'url', 'pos_state', 'cache_stamp', 'picktype', 'picktime',
|
||||
'last_reseed', 'pt_gen', 'technical_info', 'leechers', 'seeders', 'cover',
|
||||
'last_reseed', 'pt_gen', 'technical_info', 'leechers', 'seeders', 'cover', 'last_action',
|
||||
'times_completed'
|
||||
];
|
||||
|
||||
private static $globalPromotionState;
|
||||
@@ -157,10 +158,15 @@ class Torrent extends NexusModel
|
||||
}
|
||||
$spState = $this->sp_state;
|
||||
$global = self::getGlobalPromotionState();
|
||||
$log = sprintf('torrent: %s sp_state: %s, global sp state: %s', $this->id, $spState, $global);
|
||||
$log = sprintf('torrent: %s original sp_state: %s, original global_sp_state: %s', $this->id, $spState, $global);
|
||||
if ($this->__sticky_promotion) {
|
||||
//Cover original sp_state
|
||||
$spState = $this->__sticky_promotion['promotion_type'];
|
||||
$log .= "[SP_STATE_CHANGE] to __sticky_promotion: $spState]";
|
||||
}
|
||||
if ($this->__ignore_global_sp_state) {
|
||||
$log .= "[IGNORE_GLOBAL_SP_STATE]";
|
||||
$global = self::PROMOTION_NORMAL;
|
||||
$log .= "[IGNORE_GLOBAL_SP_STATE], reset to: $global";
|
||||
}
|
||||
if ($global != self::PROMOTION_NORMAL) {
|
||||
$spState = $global;
|
||||
|
||||
Reference in New Issue
Block a user