修复了一些问题

This commit is contained in:
2026-08-25 18:31:49 +08:00
parent c8d199a694
commit 3dbd196e06
9 changed files with 99 additions and 25 deletions
+9 -8
View File
@@ -227,14 +227,15 @@ class SchemaUsers {
'version' => '1.0.0',
'option_key' => 'aksrt_settings',
'groups' => [
['key' => 'basic', 'title' => '基础设置', 'fields' => [
['key' => 'message_s', 'label' => '站内通知总开关', 'type' => 'switch', 'default' => true],
['key' => 'msg_center_rewrite_slug', 'label' => '消息中心 URL 别名', 'type' => 'input', 'default' => 'message'],
['key' => 'message_icon_show', 'label' => '通知图标位置', 'type' => 'checkbox', 'default' => ['nav_menu'], 'options' => [
['label' => '导航菜单', 'value' => 'nav_menu'],
['label' => '用户头像', 'value' => 'avatar'],
['label' => '移动端底部', 'value' => 'mobile_bar'],
]],
['key' => 'basic', 'title' => '基础设置', 'fields' => [
['key' => 'message_s', 'label' => '站内通知总开关', 'type' => 'switch', 'default' => true],
['key' => 'msg_center_rewrite_slug', 'label' => '消息中心 URL 别名', 'type' => 'input', 'default' => 'message'],
['key' => 'message_icon_show', 'label' => '通知图标位置', 'type' => 'checkbox', 'default' => ['nav_menu'], 'options' => [
['label' => '导航菜单', 'value' => 'nav_menu'],
['label' => '头像下拉面板', 'value' => 'avatar_dropdown'],
['label' => '用户中心顶部资料卡', 'value' => 'user_center_header'],
['label' => '公开主页顶部资料卡', 'value' => 'user_home_header'],
]],
['key' => 'message_paginate_type', 'label' => '列表翻页模式', 'type' => 'radio', 'default' => 'ajax_lists', 'options' => [
['label' => 'AJAX 追加加载', 'value' => 'ajax_lists'],
['label' => '数字翻页按钮', 'value' => 'default'],
+10 -7
View File
@@ -334,7 +334,11 @@ class Integration {
return !empty(Settings::get_value('message_s', true));
}
/** 通知基础设置(basic group) */
/**
* 通知基础设置(basic group)
*
* @return array{enabled:bool,slug:string,icon_show:array<int,string>,paginate_type:string,user_set:bool}
*/
public static function notification_settings(): array {
$settings = Settings::get_all();
$slug = sanitize_key((string) ($settings['msg_center_rewrite_slug'] ?? 'message'));
@@ -348,14 +352,13 @@ class Integration {
}
$icon_show = $settings['message_icon_show'] ?? ['nav_menu'];
if (!is_array($icon_show)) {
$icon_show = ['nav_menu'];
}
$allowed_positions = ['nav_menu', 'avatar', 'mobile_bar'];
$icon_show = array_values(array_intersect($icon_show, $allowed_positions));
$allowed_positions = ['nav_menu', 'avatar_dropdown', 'user_center_header', 'user_home_header'];
$icon_show = is_array($icon_show)
? array_values(array_intersect($icon_show, $allowed_positions))
: [];
return [
'enabled' => !empty($settings['message_s']),
'enabled' => self::message_enabled(),
'slug' => $slug,
'icon_show' => $icon_show,
'paginate_type' => $paginate,