diff --git a/app/Console/Commands/Test.php b/app/Console/Commands/Test.php index efce531e..7f5bc0f8 100644 --- a/app/Console/Commands/Test.php +++ b/app/Console/Commands/Test.php @@ -61,6 +61,7 @@ use NexusPlugin\PostLike\PostLikeRepository; use NexusPlugin\StickyPromotion\Models\StickyPromotion; use NexusPlugin\StickyPromotion\Models\StickyPromotionParticipator; +use NexusPlugin\Tracker\TrackerRepository; use NexusPlugin\Work\Models\RoleWork; use NexusPlugin\Work\WorkRepository; use PhpIP\IP; @@ -100,10 +101,8 @@ public function __construct() */ public function handle() { - $ip = "44, -55, -444,65 5 32"; - $result = preg_split("/[\r\n\s,,]+/", trim($ip)); + $tool = new TrackerRepository(); + $result = $tool->checkStatus(); dd($result); } diff --git a/app/Repositories/DashboardRepository.php b/app/Repositories/DashboardRepository.php index 550ccb57..16720fdc 100644 --- a/app/Repositories/DashboardRepository.php +++ b/app/Repositories/DashboardRepository.php @@ -9,6 +9,7 @@ use Carbon\Carbon; use Filament\Facades\Filament; use Illuminate\Support\Facades\DB; +use Nexus\Database\NexusDB; class DashboardRepository extends BaseRepository { @@ -51,18 +52,26 @@ public function getSystemInfo(): array 'text' => nexus_trans("dashboard.system_info.$name"), 'value' => DB::select(DB::raw('select version() as info'))[0]->info, ]; - $name = 'os'; +// $name = 'os'; +// $result[$name] = [ +// 'name' => $name, +// 'text' => nexus_trans("dashboard.system_info.$name"), +// 'value' => PHP_OS, +// ]; + $name = 'redis_version'; $result[$name] = [ 'name' => $name, 'text' => nexus_trans("dashboard.system_info.$name"), - 'value' => PHP_OS, + 'value' => NexusDB::redis()->info()['redis_version'], ]; + $name = 'server_software'; $result[$name] = [ 'name' => $name, 'text' => nexus_trans("dashboard.system_info.$name"), 'value' => $_SERVER['SERVER_SOFTWARE'] ?? '', ]; + $name = 'load_average'; $result[$name] = [ 'name' => $name, diff --git a/app/Repositories/ToolRepository.php b/app/Repositories/ToolRepository.php index 4f339c0b..6cce94a5 100644 --- a/app/Repositories/ToolRepository.php +++ b/app/Repositories/ToolRepository.php @@ -1,6 +1,7 @@ whereIn("id", $receiverUidArr)->get(User::$commonFields); + foreach ($users as $user) { + $locale = $user->locale; + $subject = nexus_trans($subjectTransKey, $subjectTransContext, $locale); + $msg = nexus_trans($msgTransKey, $msgTransContext, $locale); + $result = $this->sendMail($user->email, $subject, $msg); + do_log(sprintf("send msg: %s result: %s", $msg, var_export($result, true)), $result ? "info" : "error"); + } + } + } } diff --git a/include/functions.php b/include/functions.php index 9c0c9405..935f6a20 100644 --- a/include/functions.php +++ b/include/functions.php @@ -5319,7 +5319,7 @@ function torrentTags($tags = 0, $type = 'checkbox') return $html; } -function saveSetting($prefix, $nameAndValue, $autoload = 'yes') +function saveSetting(string $prefix, array $nameAndValue, string $autoload = 'yes'): void { $prefix = strtolower($prefix); $datetimeNow = date('Y-m-d H:i:s'); diff --git a/nexus/Plugin/BasePlugin.php b/nexus/Plugin/BasePlugin.php index 9752e0e4..3219bb4f 100644 --- a/nexus/Plugin/BasePlugin.php +++ b/nexus/Plugin/BasePlugin.php @@ -45,7 +45,12 @@ public function getNexusView($name): string public function trans($name): string { - return nexus_trans(sprintf("%s::%s", static::ID, $name)); + return nexus_trans($this->getTransKey($name)); + } + + public function getTransKey($name): string + { + return sprintf("%s::%s", static::ID, $name); } public static function getInstance(): static diff --git a/resources/lang/en/dashboard.php b/resources/lang/en/dashboard.php index 6c373525..d4306c20 100644 --- a/resources/lang/en/dashboard.php +++ b/resources/lang/en/dashboard.php @@ -47,6 +47,7 @@ 'server_software' => 'Web software', 'load_average' => 'Server load average', 'filament_version' => 'Filament version', + 'redis_version' => 'Redis version', ], 'latest_user' => [ 'page_title' => 'User latest', diff --git a/resources/lang/zh_CN/dashboard.php b/resources/lang/zh_CN/dashboard.php index 1a1f34f4..3772731e 100644 --- a/resources/lang/zh_CN/dashboard.php +++ b/resources/lang/zh_CN/dashboard.php @@ -47,6 +47,7 @@ 'server_software' => 'Web 软件', 'load_average' => '服务器平均负载', 'filament_version' => 'Filament 版本', + 'redis_version' => 'Redis 版本', ], 'latest_user' => [ 'page_title' => '最新用户', diff --git a/resources/lang/zh_TW/dashboard.php b/resources/lang/zh_TW/dashboard.php index 63fcbdea..fb128dcf 100644 --- a/resources/lang/zh_TW/dashboard.php +++ b/resources/lang/zh_TW/dashboard.php @@ -47,6 +47,7 @@ 'server_software' => 'Web 軟件', 'load_average' => '服務器平均負載', 'filament_version' => 'Filament 版本', + 'redis_version' => 'Redis 版本', ], 'latest_user' => [ 'page_title' => '最新用戶',