format code style

This commit is contained in:
xiaomlove
2022-12-19 19:17:22 +08:00
parent 7f86e69956
commit eaf2a57421
2 changed files with 9 additions and 8 deletions
+6 -5
View File
@@ -29,11 +29,12 @@ class Setting extends NexusModel
*/ */
public static function get($name = null, $default = null): mixed public static function get($name = null, $default = null): mixed
{ {
static $settings=null; static $settings = null;
if(is_null($settings)) if (is_null($settings)) {
$settings = NexusDB::remember("nexus_settings_in_laravel", 600, function () { $settings = NexusDB::remember("nexus_settings_in_laravel", 600, function () {
return self::getFromDb(); return self::getFromDb();
}); });
}
if (is_null($name)) { if (is_null($name)) {
return $settings; return $settings;
} }
+3 -3
View File
@@ -710,13 +710,13 @@ function get_row_count($table, $suffix = "")
function get_user_row($id) function get_user_row($id)
{ {
global $Cache, $CURUSER; global $Cache, $CURUSER;
static $userRows=[]; static $userRows = [];
static $curuserRowUpdated = false; static $curuserRowUpdated = false;
static $neededColumns = array( static $neededColumns = array(
'id', 'noad', 'class', 'enabled', 'privacy', 'avatar', 'signature', 'uploaded', 'downloaded', 'last_access', 'username', 'donor', 'id', 'noad', 'class', 'enabled', 'privacy', 'avatar', 'signature', 'uploaded', 'downloaded', 'last_access', 'username', 'donor',
'donoruntil', 'leechwarn', 'warned', 'title', 'downloadpos', 'parked', 'clientselect', 'showclienterror', 'donoruntil', 'leechwarn', 'warned', 'title', 'downloadpos', 'parked', 'clientselect', 'showclienterror',
); );
if(isset($userRows[$id]))return $userRows[$id]; if (isset($userRows[$id])) return $userRows[$id];
$cacheKey = 'user_'.$id.'_content'; $cacheKey = 'user_'.$id.'_content';
$row = \Nexus\Database\NexusDB::remember($cacheKey, 3600, function () use ($id, $neededColumns) { $row = \Nexus\Database\NexusDB::remember($cacheKey, 3600, function () use ($id, $neededColumns) {
$user = \App\Models\User::query()->with(['wearing_medals'])->find($id, $neededColumns); $user = \App\Models\User::query()->with(['wearing_medals'])->find($id, $neededColumns);
@@ -753,7 +753,7 @@ function get_user_row($id)
if (!$row) if (!$row)
return false; return false;
else return $userRows[$id]=$row; else return $userRows[$id] = $row;
} }
function get_user_class() function get_user_class()