mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-23 19:37:23 +08:00
ptgen api point support parameter & default user
This commit is contained in:
@@ -143,6 +143,31 @@ class User extends Authenticatable
|
||||
'invited_by', 'enabled', 'seed_points',
|
||||
];
|
||||
|
||||
public static function getDefaultUserAttributes(): array
|
||||
{
|
||||
return [
|
||||
'id' => 0,
|
||||
'username' => nexus_trans('user.deleted_username'),
|
||||
'class' => self::CLASS_PEASANT,
|
||||
'email' => '',
|
||||
'status' => self::STATUS_CONFIRMED,
|
||||
'added' => '1970-01-01 08:00:00',
|
||||
'avatar' => '',
|
||||
'uploaded' => 0,
|
||||
'downloaded' => 0,
|
||||
'seedbonus' => 0,
|
||||
'seedtime' => 0,
|
||||
'leechtime' => 0,
|
||||
'enabled' => self::ENABLED_NO,
|
||||
'seed_points' => 0
|
||||
];
|
||||
}
|
||||
|
||||
public static function defaultUser()
|
||||
{
|
||||
return new static(self::getDefaultUserAttributes());
|
||||
}
|
||||
|
||||
public function checkIsNormal(array $fields = ['status', 'enabled'])
|
||||
{
|
||||
if (in_array('status', $fields) && $this->getAttribute('status') != self::STATUS_CONFIRMED) {
|
||||
|
||||
Reference in New Issue
Block a user