对小工具进行了一些修复

This commit is contained in:
2026-08-26 11:17:22 +08:00
parent 523af723ae
commit 9ad6f41592
9 changed files with 17 additions and 223 deletions
+3 -29
View File
@@ -93,11 +93,10 @@ final class WidgetSchemas {
['id' => 'radius', 'type' => 'switcher', 'label' => '两边显示为圆形', 'default' => false],
['id' => 'interval', 'type' => 'spinner', 'label' => '滚动间隔', 'default' => 3, 'min' => 1, 'max' => 10, 'step' => 1, 'unit' => '秒'],
['id' => 'color', 'type' => 'palette', 'label' => '颜色', 'default' => 'c-blue', 'options' => self::zib_palette()],
['id' => 'source', 'type' => 'radio', 'label' => '内容来源', 'default' => '', 'options' => ['' => '自定义', 'posts' => '文章', 'forums' => '论坛帖子']],
['id' => 'source', 'type' => 'radio', 'label' => '内容来源', 'default' => '', 'options' => ['' => '自定义', 'posts' => '文章']],
['id' => 'msg_icon', 'type' => 'icon', 'label' => '消息图标', 'default' => 'zibsvg-hot', 'dependency' => ['source', '!=', '']],
['id' => 'count', 'type' => 'spinner', 'label' => '获取帖子或文章数量', 'default' => 8, 'min' => 1, 'max' => 50, 'dependency' => ['source', '!=', '']],
['id' => 'count', 'type' => 'spinner', 'label' => '获取文章数量', 'default' => 8, 'min' => 1, 'max' => 50, 'dependency' => ['source', '!=', '']],
['id' => 'desc_s', 'type' => 'switcher', 'label' => '显示简介(关闭则只显示标题)', 'default' => false],
['id' => 'forums_opts', 'type' => 'fieldset', 'label' => '论坛帖子筛选', 'default' => [], 'dependency' => ['source', '==', 'forums'], 'fields' => self::notice_forum_fields()],
['id' => 'posts_opts', 'type' => 'fieldset', 'label' => '文章筛选', 'default' => [], 'dependency' => ['source', '==', 'posts'], 'fields' => self::notice_post_fields()],
[
'id' => 'img_ids', 'type' => 'group', 'label' => '消息列表', 'max_items' => 50,
@@ -201,7 +200,6 @@ final class WidgetSchemas {
['id' => 'title', 'type' => 'textarea', 'label' => '标题(必填)', 'default' => '', 'allow_html' => true, 'attributes' => ['rows' => 1]],
['id' => 'cat', 'type' => 'text', 'label' => '分类限制', 'default' => '', 'sanitize' => 'reference_ids'],
['id' => 'topics', 'type' => 'text', 'label' => '专题限制', 'default' => '', 'sanitize' => 'reference_ids', 'description' => '多个 ID 用英文逗号隔开,支持负数排除。'],
['id' => 'zibpay_type', 'type' => 'checkbox', 'label' => '商品类型筛选', 'default' => [], 'options' => ['1' => '付费阅读', '2' => '付费下载', '5' => '付费图片', '6' => '付费视频']],
['id' => 'limit_day', 'type' => 'spinner', 'label' => '发布时间限制', 'default' => 0, 'min' => 0, 'step' => 5, 'max' => 3650],
['id' => 'orderby', 'type' => 'select', 'label' => '排序方式', 'default' => '', 'options' => self::posts_orderby()],
['id' => 'order', 'type' => 'radio', 'label' => '顺序', 'default' => 'desc', 'options' => ['desc' => '降序', 'asc' => '升序']],
@@ -214,7 +212,7 @@ final class WidgetSchemas {
return [
'' => '默认排序', 'modified' => '更新时间', 'date' => '发布时间', 'views' => '浏览数量',
'like' => '点赞数量', 'comment_count' => '评论数量', 'favorite' => '收藏数量',
'zibpay_price' => '销售价格', 'zibpay_points_price' => '积分售价', 'sales_volume' => '销售数量', 'rand' => '随机排序',
'rand' => '随机排序',
];
}
@@ -468,35 +466,11 @@ final class WidgetSchemas {
return [
['id' => 'cat', 'type' => 'text', 'label' => '分类限制', 'default' => '', 'sanitize' => 'reference_ids'],
['id' => 'topics', 'type' => 'text', 'label' => '专题限制', 'default' => '', 'sanitize' => 'reference_ids'],
['id' => 'zibpay_type', 'type' => 'checkbox', 'label' => '商品类型筛选', 'default' => [], 'options' => ['1' => '付费阅读', '2' => '付费下载', '5' => '付费图片', '6' => '付费视频']],
['id' => 'orderby', 'type' => 'select', 'label' => '排序方式', 'default' => '', 'options' => self::posts_orderby()],
['id' => 'order', 'type' => 'radio', 'label' => '顺序', 'default' => 'desc', 'options' => ['desc' => '升序', 'asc' => '降序']],
];
}
private static function notice_forum_fields(): array {
return [
['id' => 'plate', 'type' => 'select', 'label' => '包含版块', 'default' => [], 'options' => 'post', 'query_args' => ['post_type' => 'plate'], 'ajax' => true, 'settings' => ['min_length' => 2], 'placeholder' => '输入关键词以搜索', 'chosen' => true, 'multiple' => true, 'sortable' => true],
['id' => 'plate_exclude', 'type' => 'select', 'label' => '排除版块', 'default' => [], 'options' => 'post', 'query_args' => ['post_type' => 'plate'], 'ajax' => true, 'settings' => ['min_length' => 2], 'placeholder' => '输入关键词以搜索版块分类', 'chosen' => true, 'multiple' => true, 'sortable' => true, 'dependency' => ['plate', '==', '', '', 'visible']],
['id' => 'topic', 'type' => 'select', 'label' => '包含话题', 'default' => [], 'options' => 'categories', 'query_args' => ['taxonomy' => 'forum_topic'], 'placeholder' => '输入关键词以搜索', 'chosen' => true, 'multiple' => true, 'sortable' => true, 'ajax' => true, 'settings' => ['min_length' => 2]],
['id' => 'tag', 'type' => 'select', 'label' => '包含标签', 'default' => [], 'options' => 'categories', 'query_args' => ['taxonomy' => 'forum_tag'], 'placeholder' => '输入关键词以搜索', 'chosen' => true, 'multiple' => true, 'sortable' => true, 'ajax' => true, 'settings' => ['min_length' => 2]],
['id' => 'bbs_type', 'type' => 'checkbox', 'label' => '类型筛选', 'default' => [], 'options' => ['' => '标准', 'question' => '提问']],
['id' => 'allow_view', 'type' => 'checkbox', 'label' => '阅读权限筛选', 'default' => [], 'options' => ['signin' => '登录后查看', 'comment' => '评论后查看', 'pay' => '付费查看', 'points' => '支付积分查看', 'roles' => '部分用户可查看']],
['id' => 'filter', 'type' => 'checkbox', 'label' => '其它筛选', 'default' => [], 'options' => ['topping' => '置顶帖子', 'vote' => '投票帖子', 'essence' => '精华帖子', 'question_status' => '提问已解决', 'is_hot' => '热门帖子']],
['id' => 'orderby', 'type' => 'select', 'label' => '排序方式', 'default' => 'date', 'options' => self::notice_forum_orderby()],
['id' => 'order', 'type' => 'radio', 'label' => '顺序', 'default' => 'desc', 'options' => ['desc' => '升序', 'asc' => '降序']],
];
}
private static function notice_forum_orderby(): array {
return [
'name' => '标题名称', 'date' => '最新发布', 'modified' => '最近更新', 'last_reply' => '最新回复',
'dynamic_score' => '推荐指数', 'views' => '最多查看', 'score' => '评分最高', 'comment_count' => '最多回复',
'favorite_count' => '最多收藏', 'zibpay_price' => '售价金额', 'zibpay_points_price' => '积分金额',
'sales_volume' => '销售数量', 'rand' => '随机',
];
}
private static function pay_types(): array {
return ['' => '全部', 'reading' => '付费阅读', 'download' => '付费下载', 'gallery' => '付费图库', 'video' => '付费视频', 'vip' => 'VIP 专属'];
}