修复新人等级被降为零

This commit is contained in:
pllx
2026-04-27 14:23:34 +08:00
parent 277cb617da
commit 3c749969b4
2 changed files with 38 additions and 1 deletions
+5 -1
View File
@@ -15,6 +15,9 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Cache;
/**
* 类功能:读取和计算系统参数,提供等级经验阈值等全局配置能力。
*/
class Sysparam extends Model
{
/** @var string 表名 */
@@ -74,7 +77,8 @@ class Sysparam extends Model
// 不超过最大等级
$maxLevel = (int) static::getValue('maxlevel', '99');
return min($level, $maxLevel);
// 聊天室普通用户最低等级为 1,避免低经验新人被自动存点降成 0 后无法进入默认房间。
return max(1, min($level, $maxLevel));
}
/**