mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-14 12:30:49 +08:00
[admin] torrent add more bulk action
This commit is contained in:
@@ -51,4 +51,19 @@ class NexusModel extends Model
|
||||
return sprintf('%s: %s', nexus_trans('label.deadline'), $raw);
|
||||
}
|
||||
|
||||
public static function listStaticProps($dataSource, $textTransPrefix, $onlyKeyValue = false, $valueField = 'text'): array
|
||||
{
|
||||
$result = $dataSource;
|
||||
$keyValue = [];
|
||||
foreach ($result as $key => &$info) {
|
||||
$text = $textTransPrefix ? nexus_trans("$textTransPrefix.$key") : $info['text'];
|
||||
$info['text'] = $text;
|
||||
$keyValue[$key] = $info[$valueField];
|
||||
}
|
||||
if ($onlyKeyValue) {
|
||||
return $keyValue;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -48,6 +48,14 @@ class Tag extends NexusModel
|
||||
],
|
||||
];
|
||||
|
||||
public static function listSpecial(): array
|
||||
{
|
||||
return array_filter([
|
||||
Setting::get('system.official_tag'),
|
||||
Setting::get('system.zero_bonus_tag'),
|
||||
]);
|
||||
}
|
||||
|
||||
public function torrents(): \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Torrent::class, 'torrent_tags', 'tag_id', 'torrent_id');
|
||||
|
||||
@@ -130,6 +130,16 @@ class Torrent extends NexusModel
|
||||
self::PICK_RECOMMENDED => ['text' => self::PICK_RECOMMENDED, 'color' => '#820084'],
|
||||
];
|
||||
|
||||
const PROMOTION_TIME_TYPE_GLOBAL = 0;
|
||||
const PROMOTION_TIME_TYPE_PERMANENT = 1;
|
||||
const PROMOTION_TIME_TYPE_DEADLINE = 2;
|
||||
|
||||
public static array $promotionTimeTypes = [
|
||||
self::PROMOTION_TIME_TYPE_GLOBAL => ['text' => 'Global'],
|
||||
self::PROMOTION_TIME_TYPE_PERMANENT => ['text' => 'Permanent'],
|
||||
self::PROMOTION_TIME_TYPE_DEADLINE => ['text' => 'Until'],
|
||||
];
|
||||
|
||||
const BONUS_REWARD_VALUES = [50, 100, 200, 500, 1000];
|
||||
|
||||
const APPROVAL_STATUS_NONE = 0;
|
||||
@@ -272,6 +282,11 @@ class Torrent extends NexusModel
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function listPromotionTimeTypes($onlyKeyValue = false, $valueField = 'text'): array
|
||||
{
|
||||
return self::listStaticProps(self::$promotionTimeTypes, 'torrent.promotion_time_types', $onlyKeyValue, $valueField);
|
||||
}
|
||||
|
||||
public static function listPickInfo($onlyKeyValue = false, $valueField = 'text'): array
|
||||
{
|
||||
$result = self::$pickTypes;
|
||||
|
||||
Reference in New Issue
Block a user