优化:存点称号改为后端动态返回
- 后端根据 VIP 等级/管理员身份返回 title 字段 - 前端移除硬编码的等级-称号映射,直接使用返回值 - 管理员显示'管理员',VIP 显示会员名称,其他显示'普通会员'
This commit is contained in:
@@ -271,6 +271,14 @@ class ChatController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
// 确定用户称号:管理员 > VIP 名称 > 普通会员
|
||||
$title = '普通会员';
|
||||
if ($user->user_level >= $superLevel) {
|
||||
$title = '管理员';
|
||||
} elseif ($user->isVip()) {
|
||||
$title = $user->vipName() ?: '会员';
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'status' => 'success',
|
||||
'data' => [
|
||||
@@ -279,6 +287,7 @@ class ChatController extends Controller
|
||||
'exp_gain' => $actualExpGain,
|
||||
'jjb_gain' => $actualJjbGain,
|
||||
'user_level' => $user->user_level,
|
||||
'title' => $title,
|
||||
'leveled_up' => $leveledUp,
|
||||
'is_max_level' => $user->user_level >= $superLevel,
|
||||
'auto_event' => $autoEvent ? $autoEvent->renderText($user->username) : null,
|
||||
|
||||
@@ -733,9 +733,7 @@
|
||||
now.getMinutes().toString().padStart(2, '0') + ':' +
|
||||
now.getSeconds().toString().padStart(2, '0');
|
||||
const d = data.data;
|
||||
const levelTitle = d.user_level >= 10 ? '管理员' : (d.user_level >= 5 ? '高级会员' : (d
|
||||
.user_level >= 3 ?
|
||||
'三级会员' : '普通会员'));
|
||||
const levelTitle = d.title || '普通会员';
|
||||
|
||||
let levelInfo = '';
|
||||
if (d.is_max_level) {
|
||||
|
||||
Reference in New Issue
Block a user