exam-table

This commit is contained in:
xiaomlove
2021-04-23 20:05:39 +08:00
parent ba7e5030e9
commit a0c7a7e5dc
8 changed files with 271 additions and 136 deletions

View File

@@ -4,28 +4,39 @@ namespace App\Models;
class Exam extends NexusModel
{
protected $fillable = ['name', 'description', 'begin', 'end', 'status'];
protected $fillable = ['name', 'description', 'begin', 'end', 'status', 'filters', 'indexes'];
protected $casts = [
'filters' => 'object',
'indexes' => 'array',
];
const STATUS_ENABLED = 0;
const STATUS_DISABLED = 1;
public static $status = [
self::STATUS_ENABLED => ['text' => '启用中'],
self::STATUS_DISABLED => ['text' => '已禁用'],
self::STATUS_ENABLED => ['text' => 'Enabled'],
self::STATUS_DISABLED => ['text' => 'Disabled'],
];
const INDEX_UPLOADED = 1;
const INDEX_SEED_TIME = 2;
const INDEX_SEED_TIME_AVERGAGE = 2;
const INDEX_DOWNLOADED = 3;
const INDEX_LEECH_TIME = 4;
const INDEX_BONUS = 5;
const INDEX_BONUS = 4;
public static $indexes = [
self::INDEX_UPLOADED => ['text' => 'Uploaded'],
self::INDEX_SEED_TIME => ['text' => 'Seed time'],
self::INDEX_DOWNLOADED => ['text' => 'Download'],
self::INDEX_LEECH_TIME => ['text' => 'Leech time'],
self::INDEX_BONUS => ['text' => 'Bonus'],
self::INDEX_UPLOADED => ['name' => 'Uploaded', 'unit' => 'GB'],
self::INDEX_SEED_TIME_AVERGAGE => ['name' => 'Seed Time Average', 'unit' => 'Hour'],
self::INDEX_DOWNLOADED => ['name' => 'Downloaded', 'unit' => 'GB'],
self::INDEX_BONUS => ['name' => 'Bonus', 'unit' => ''],
];
const FILTER_USER_CLASS = 'classes';
const FILTER_USER_REGISTER_TIME_RANGE = 'register_time_range';
public static $filters = [
self::FILTER_USER_CLASS => ['name' => 'User Class'],
self::FILTER_USER_REGISTER_TIME_RANGE => ['name' => 'User Register Time Range'],
];
public function getStatusTextAttribute()