diff --git a/app/Filament/Resources/User/BonusLogResource.php b/app/Filament/Resources/User/BonusLogResource.php index ed81691a..fa1690b5 100644 --- a/app/Filament/Resources/User/BonusLogResource.php +++ b/app/Filament/Resources/User/BonusLogResource.php @@ -57,6 +57,7 @@ class BonusLogResource extends Resource ->label(__('bonus-log.fields.old_total_value')) , Tables\Columns\TextColumn::make('value') + ->formatStateUsing(fn ($record) => $record->old_total_value > $record->new_total_value ? "-" . $record->value : "+" . $record->value) ->label(__('bonus-log.fields.value')) , Tables\Columns\TextColumn::make('new_total_value') diff --git a/app/Filament/Resources/User/UserMetaResource.php b/app/Filament/Resources/User/UserMetaResource.php index ce67dbe5..b0e05ad5 100644 --- a/app/Filament/Resources/User/UserMetaResource.php +++ b/app/Filament/Resources/User/UserMetaResource.php @@ -46,7 +46,7 @@ class UserMetaResource extends Resource { return $table ->columns([ - Tables\Columns\TextColumn::make('id'), + Tables\Columns\TextColumn::make('id')->sortable(), Tables\Columns\TextColumn::make('uid') ->searchable() ->label(__('label.username')) @@ -63,6 +63,7 @@ class UserMetaResource extends Resource ->formatStateUsing(fn ($state) => format_datetime($state)) , ]) + ->defaultSort('id', 'desc') ->filters([ Tables\Filters\Filter::make('uid') ->form([ diff --git a/app/Models/BonusLogs.php b/app/Models/BonusLogs.php index cfa49e1b..0f5861a8 100644 --- a/app/Models/BonusLogs.php +++ b/app/Models/BonusLogs.php @@ -34,6 +34,8 @@ class BonusLogs extends NexusModel const BUSINESS_TYPE_BUY_CHANGE_USERNAME_CARD = 17; const BUSINESS_TYPE_GIFT_MEDAL = 18; + const BUSINESS_TYPE_ROLE_WORK_SALARY = 1000; + public static array $businessTypes = [ self::BUSINESS_TYPE_CANCEL_HIT_AND_RUN => ['text' => 'Cancel H&R'], self::BUSINESS_TYPE_BUY_MEDAL => ['text' => 'Buy medal'], @@ -53,6 +55,8 @@ class BonusLogs extends NexusModel self::BUSINESS_TYPE_BUY_RAINBOW_ID => ['text' => 'Buy rainbow ID'], self::BUSINESS_TYPE_BUY_CHANGE_USERNAME_CARD => ['text' => 'Buy change username card'], self::BUSINESS_TYPE_GIFT_MEDAL => ['text' => 'Gift medal to someone'], + + self::BUSINESS_TYPE_ROLE_WORK_SALARY => ['text' => 'Role work salary'], ]; public function getBusinessTypeTextAttribute() diff --git a/app/Models/Message.php b/app/Models/Message.php index 3800f3b2..f62b7e76 100644 --- a/app/Models/Message.php +++ b/app/Models/Message.php @@ -28,8 +28,7 @@ class Message extends NexusModel public static function add(array $data): bool { - NexusDB::cache_del('user_'.$data["receiver"].'_inbox_count'); - NexusDB::cache_del('user_'.$data["receiver"].'_unread_message_count'); + clear_inbox_count_cache($data["receiver"]); return self::query()->insert($data); } diff --git a/app/Repositories/ClaimRepository.php b/app/Repositories/ClaimRepository.php index 7f438912..a0670c2d 100644 --- a/app/Repositories/ClaimRepository.php +++ b/app/Repositories/ClaimRepository.php @@ -259,7 +259,7 @@ class ClaimRepository extends BaseRepository } //Send message - Message::query()->insert($message); + Message::add($message); }); do_log("[DONE], cost time: " . (time() - $now->timestamp) . " seconds"); return true; diff --git a/include/constants.php b/include/constants.php index 4206d85d..ddb29fa2 100644 --- a/include/constants.php +++ b/include/constants.php @@ -1,6 +1,6 @@ getScript()] ?? []; } -function can_access_torrent($torrent) +function can_access_torrent($torrent, $uid) { global $specialcatmode; if (get_setting('main.spsct') != 'yes') { @@ -5797,7 +5797,7 @@ function can_access_torrent($torrent) if ($searchBoxId != $specialcatmode) { return true; } - if (get_user_class() >= get_setting('authority.view_special_torrent')) { + if (user_can('view_special_torrent', false, $uid)) { return true; } return false; diff --git a/include/globalfunctions.php b/include/globalfunctions.php index 3ac22085..aaf7e8e9 100644 --- a/include/globalfunctions.php +++ b/include/globalfunctions.php @@ -1053,6 +1053,16 @@ function clear_icon_cache() \Nexus\Database\NexusDB::cache_del("category_icon_content"); } +function clear_inbox_count_cache($uid) +{ + do_log("clear_inbox_count_cache"); + foreach (\Illuminate\Support\Arr::wrap($uid) as $id) { + \Nexus\Database\NexusDB::cache_del('user_'.$id.'_inbox_count'); + \Nexus\Database\NexusDB::cache_del('user_'.$id.'_unread_message_count'); + } +} + + function user_can($permission, $fail = false, $uid = 0): bool { $log = "permission: $permission, fail: $fail, user: $uid"; diff --git a/public/details.php b/public/details.php index a0b7efc6..4c1f30e9 100644 --- a/public/details.php +++ b/public/details.php @@ -33,7 +33,7 @@ if (!$row) { stderr($lang_details['std_error'], $lang_details['std_no_torrent_id']); } elseif ( ($row['banned'] == 'yes' && !user_can('seebanned') && $row['owner'] != $CURUSER['id']) - || (!can_access_torrent($row) && $row['owner'] != $CURUSER['id']) + || (!can_access_torrent($row, $CURUSER['id']) && $row['owner'] != $CURUSER['id']) ) { permissiondenied(); } else { diff --git a/public/download.php b/public/download.php index e1b2be27..6bdcd046 100644 --- a/public/download.php +++ b/public/download.php @@ -110,7 +110,7 @@ if (filesize($fn) == 0) { $approvalNotAllowed = $row['approval_status'] != \App\Models\Torrent::APPROVAL_STATUS_ALLOW && get_setting('torrent.approval_status_none_visible') == 'no'; $allowOwnerDownload = $row['owner'] == $CURUSER['id']; $canSeedBanned = user_can('seebanned'); -$canAccessTorrent = can_access_torrent($row); +$canAccessTorrent = can_access_torrent($row, $CURUSER['id']); if ((($row['banned'] == 'yes' || ($approvalNotAllowed && !$allowOwnerDownload)) && !$canSeedBanned) || !$canAccessTorrent) { do_log("[DENY_DOWNLOAD], user: {$CURUSER['id']}, approvalNotAllowed: $approvalNotAllowed, allowOwnerDownload: $allowOwnerDownload, canSeedBanned: $canSeedBanned, canAccessTorrent: $canAccessTorrent", 'error'); denyDownload(); diff --git a/public/torrents.php b/public/torrents.php index f9d9af43..b14e38c7 100644 --- a/public/torrents.php +++ b/public/torrents.php @@ -968,7 +968,7 @@ else stdhead($lang_torrents['head_special']); print("
| "); displayHotAndClassic(); - +$searchBoxRightTdStyle = 'padding: 1px;padding-left: 10px;white-space: nowrap'; if ($allsec != 1 || $enablespecial != 'yes'){ //do not print searchbox if showing bookmarked torrents from all sections; ?> | |
| + | |
| + | ~ |
| + | |
| + | ~ |
| + | |
| + | ~ |
| + | |
| + | ~ |
| + | |
| + | true, 'format' => 'Y-m-d', 'style' => 'width: '.$filterInputWidth.'px']), diff --git a/resources/lang/en/bonus-log.php b/resources/lang/en/bonus-log.php index b5530052..b3997fa4 100644 --- a/resources/lang/en/bonus-log.php +++ b/resources/lang/en/bonus-log.php @@ -20,6 +20,8 @@ return [ \App\Models\BonusLogs::BUSINESS_TYPE_BUY_RAINBOW_ID => 'Buy rainbow ID', \App\Models\BonusLogs::BUSINESS_TYPE_BUY_CHANGE_USERNAME_CARD => 'Buy change username card', \App\Models\BonusLogs::BUSINESS_TYPE_GIFT_MEDAL => 'Gift medal', + + \App\Models\BonusLogs::BUSINESS_TYPE_ROLE_WORK_SALARY => 'Role work salary', ], 'fields' => [ 'business_type' => 'Business type', diff --git a/resources/lang/zh_CN/bonus-log.php b/resources/lang/zh_CN/bonus-log.php index f8897b40..54261612 100644 --- a/resources/lang/zh_CN/bonus-log.php +++ b/resources/lang/zh_CN/bonus-log.php @@ -20,6 +20,8 @@ return [ \App\Models\BonusLogs::BUSINESS_TYPE_BUY_RAINBOW_ID => '购买彩虹 ID', \App\Models\BonusLogs::BUSINESS_TYPE_BUY_CHANGE_USERNAME_CARD => '购买改名卡', \App\Models\BonusLogs::BUSINESS_TYPE_GIFT_MEDAL => '赠送勋章', + + \App\Models\BonusLogs::BUSINESS_TYPE_ROLE_WORK_SALARY => '工作组工资', ], 'fields' => [ 'business_type' => '业务类型', diff --git a/resources/lang/zh_TW/bonus-log.php b/resources/lang/zh_TW/bonus-log.php index 5572c1e5..8788a121 100644 --- a/resources/lang/zh_TW/bonus-log.php +++ b/resources/lang/zh_TW/bonus-log.php @@ -20,6 +20,8 @@ return [ \App\Models\BonusLogs::BUSINESS_TYPE_BUY_RAINBOW_ID => '購買彩虹 ID', \App\Models\BonusLogs::BUSINESS_TYPE_BUY_CHANGE_USERNAME_CARD => '購買改名卡', \App\Models\BonusLogs::BUSINESS_TYPE_GIFT_MEDAL => '贈送勛章', + + \App\Models\BonusLogs::BUSINESS_TYPE_ROLE_WORK_SALARY => '工作組工資', ], 'fields' => [ 'business_type' => '業務類型', |