mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-14 12:30:49 +08:00
support modify personal attendance card
This commit is contained in:
@@ -26,6 +26,7 @@ class UserResource extends JsonResource
|
||||
'class_text' => $this->class_text,
|
||||
'avatar' => $this->avatar,
|
||||
'invites' => $this->invites,
|
||||
'attendance_card' => $this->attendance_card,
|
||||
'uploaded' => $this->uploaded,
|
||||
'uploaded_text' => mksize($this->uploaded),
|
||||
'downloaded' => $this->downloaded,
|
||||
|
||||
@@ -155,7 +155,7 @@ class User extends Authenticatable
|
||||
'id', 'username', 'email', 'class', 'status', 'added', 'avatar',
|
||||
'uploaded', 'downloaded', 'seedbonus', 'seedtime', 'leechtime',
|
||||
'invited_by', 'enabled', 'seed_points', 'last_access', 'invites',
|
||||
'lang',
|
||||
'lang', 'attendance_card',
|
||||
];
|
||||
|
||||
public static function getDefaultUserAttributes(): array
|
||||
|
||||
@@ -219,6 +219,7 @@ class UserRepository extends BaseRepository
|
||||
'downloaded' => 'downloaded',
|
||||
'bonus' => 'seedbonus',
|
||||
'invites' => 'invites',
|
||||
'attendance_card' => 'attendance_card',
|
||||
];
|
||||
if (!isset($fieldMap[$field])) {
|
||||
throw new \InvalidArgumentException("Invalid field: $field, only support: " . implode(', ', array_keys($fieldMap)));
|
||||
@@ -240,6 +241,9 @@ class UserRepository extends BaseRepository
|
||||
} else {
|
||||
throw new \InvalidArgumentException("Invalid action: $action.");
|
||||
}
|
||||
if ($new < 0) {
|
||||
throw new NexusException("New value($new) lte 0");
|
||||
}
|
||||
//for administrator, use english
|
||||
$modCommentText = nexus_trans('message.field_value_change_message_body', [
|
||||
'field' => nexus_trans("user.labels.$sourceField", [], 'en'),
|
||||
|
||||
Reference in New Issue
Block a user