mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 12:07:23 +08:00
format code style
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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()
|
||||||
|
|||||||
Reference in New Issue
Block a user