From ac5dc999533d392babc06e3c4535672764e33483 Mon Sep 17 00:00:00 2001 From: xiaomlove Date: Thu, 9 Feb 2023 16:34:38 +0800 Subject: [PATCH] improve medal time range no limit display --- app/Console/Commands/Test.php | 4 ++-- app/Filament/Resources/System/MedalResource.php | 4 ++-- app/Repositories/UserRepository.php | 4 +++- include/constants.php | 2 +- include/functions.php | 2 +- nexus/Install/Install.php | 2 +- public/medal.php | 2 +- resources/lang/en/nexus.php | 1 + resources/lang/zh_CN/nexus.php | 1 + resources/lang/zh_TW/nexus.php | 1 + 10 files changed, 14 insertions(+), 9 deletions(-) diff --git a/app/Console/Commands/Test.php b/app/Console/Commands/Test.php index 0047c20b..93fcdba7 100644 --- a/app/Console/Commands/Test.php +++ b/app/Console/Commands/Test.php @@ -95,8 +95,8 @@ class Test extends Command */ public function handle() { - $work = new WorkRepository(); - $work->settleRole(6, 1, true); + $r = extension_loaded('Zend OPcache'); + dd($r); } } diff --git a/app/Filament/Resources/System/MedalResource.php b/app/Filament/Resources/System/MedalResource.php index a621ef9a..6c4d127c 100644 --- a/app/Filament/Resources/System/MedalResource.php +++ b/app/Filament/Resources/System/MedalResource.php @@ -99,11 +99,11 @@ class MedalResource extends Resource Tables\Columns\IconColumn::make('display_on_medal_page')->label(__('label.medal.display_on_medal_page'))->boolean(), Tables\Columns\TextColumn::make('sale_begin_end_time') ->label(__('medal.fields.sale_begin_end_time')) - ->formatStateUsing(fn ($record) => new HtmlString(sprintf('%s ~
%s', $record->sale_begin_time ?? '--', $record->sale_end_time ?? '--'))) + ->formatStateUsing(fn ($record) => new HtmlString(sprintf('%s ~
%s', $record->sale_begin_time ?? nexus_trans('nexus.no_limit'), $record->sale_end_time ?? nexus_trans('nexus.no_limit')))) , Tables\Columns\TextColumn::make('bonus_addition_factor')->label(__('medal.fields.bonus_addition_factor')), Tables\Columns\TextColumn::make('gift_fee_factor')->label(__('medal.fields.gift_fee_factor')), - Tables\Columns\TextColumn::make('price')->label(__('label.price')), + Tables\Columns\TextColumn::make('price')->label(__('label.price'))->formatStateUsing(fn ($state) => number_format($state)), Tables\Columns\TextColumn::make('duration')->label(__('label.medal.duration')), diff --git a/app/Repositories/UserRepository.php b/app/Repositories/UserRepository.php index 723464c5..4868dd71 100644 --- a/app/Repositories/UserRepository.php +++ b/app/Repositories/UserRepository.php @@ -462,6 +462,7 @@ class UserRepository extends BaseRepository $targetUser->usernameChangeLogs()->create($changeLog); $targetUser->username = $changeLog['username_new']; $targetUser->save(); + $this->clearCache($targetUser); }); return true; } @@ -498,6 +499,7 @@ class UserRepository extends BaseRepository $modComment = date('Y-m-d') . " - " . $message['msg']; $targetUser->updateWithModComment(['class' => $newClass], $modComment); Message::add($message); + $this->clearCache($targetUser); }); return true; @@ -561,7 +563,7 @@ class UserRepository extends BaseRepository } } if ($result) { - clear_user_cache($user->id, $user->passkey); + $this->clearCache($user); if ($notify) { Message::add($message); } diff --git a/include/constants.php b/include/constants.php index ddb29fa2..9375b7c2 100644 --- a/include/constants.php +++ b/include/constants.php @@ -1,6 +1,6 @@
'; $wrapAfter = '
'; foreach ($medals as $medal) { - $html = sprintf('
', $medal->image_large, $medal->name, $maxHeight, $maxHeight); + $html = sprintf('
', $medal->image_large, $medal->name, $maxHeight, $maxHeight); if ($withActions) { $html .= sprintf( '
%s: %s%s: %s', diff --git a/nexus/Install/Install.php b/nexus/Install/Install.php index 71a0cd1a..d2828849 100644 --- a/nexus/Install/Install.php +++ b/nexus/Install/Install.php @@ -32,7 +32,7 @@ class Install 'UID_STARTS', ]; - protected array $requiredExtensions = ['ctype', 'curl', 'fileinfo', 'json', 'mbstring', 'openssl', 'pdo_mysql', 'tokenizer', 'xml', 'mysqli', 'bcmath', 'redis', 'gd', 'gmp']; + protected array $requiredExtensions = ['ctype', 'curl', 'fileinfo', 'json', 'mbstring', 'openssl', 'pdo_mysql', 'tokenizer', 'xml', 'mysqli', 'bcmath', 'redis', 'gd', 'gmp', 'Zend OPcache']; protected array $optionalExtensions = [ ['name' => 'pcntl', 'desc' => "If use Octane and 'Current' showing 0, make sure it's on php -m"], ['name' => 'posix', 'desc' => "If use Octane and 'Current' showing 0, make sure it's on php -m"], diff --git a/public/medal.php b/public/medal.php index b53b50f7..b3b78243 100644 --- a/public/medal.php +++ b/public/medal.php @@ -93,7 +93,7 @@ foreach ($rows as $row) { ); $table .= sprintf( '

%s

%s%s ~
%s%s%s%s%s%s%s', - $row->image_large, $row->name, $row->description, $row->sale_begin_time ?? '--', $row->sale_end_time ?? '--', $row->durationText, (($row->bonus_addition_factor ?? 0) * 100).'%', number_format($row->price), $row->inventory ?? nexus_trans('label.infinite'), $buyAction, $giftAction + $row->image_large, $row->name, $row->description, $row->sale_begin_time ?? nexus_trans('nexus.no_limit'), $row->sale_end_time ?? nexus_trans('nexus.no_limit'), $row->durationText, (($row->bonus_addition_factor ?? 0) * 100).'%', number_format($row->price), $row->inventory ?? nexus_trans('label.infinite'), $buyAction, $giftAction ); } $table .= ''; diff --git a/resources/lang/en/nexus.php b/resources/lang/en/nexus.php index a0ada173..d4882bc2 100644 --- a/resources/lang/en/nexus.php +++ b/resources/lang/en/nexus.php @@ -13,4 +13,5 @@ return [ 'increment' => 'increment', 'decrement' => 'decrement', 'action' => 'Action', + 'no_limit' => 'No limit', ]; diff --git a/resources/lang/zh_CN/nexus.php b/resources/lang/zh_CN/nexus.php index 30a4ab7a..70b11db2 100644 --- a/resources/lang/zh_CN/nexus.php +++ b/resources/lang/zh_CN/nexus.php @@ -13,4 +13,5 @@ return [ 'increment' => '增加', 'decrement' => '减少', 'action' => '操作', + 'no_limit' => '不限', ]; diff --git a/resources/lang/zh_TW/nexus.php b/resources/lang/zh_TW/nexus.php index 0fdcada7..5b30c1f1 100644 --- a/resources/lang/zh_TW/nexus.php +++ b/resources/lang/zh_TW/nexus.php @@ -13,4 +13,5 @@ return [ 'increment' => '增加', 'decrement' => '減少', 'action' => '操作', + 'no_limit' => '不限', ];