chore: 忽略 tools/ 目录并从版本库移除历史脚本

这个提交包含在:
2026-10-30 14:05:29 +08:00
父节点 66b9abe089
当前提交 aab5f7ae41
共有 748 个文件被更改,包括 2651 次插入 和 2736 次删除

查看文件

@@ -106,6 +106,8 @@ class Category extends Backend
return json(['total' => $total, 'rows' => array_slice($ordered, $offset, $limit)]);
}
$homeCount = Db::name('fc_category')->where('pid', '>', 0)->where('is_home', 1)->count();
$this->view->assign('homeCount', $homeCount);
return $this->view->fetch();
}
@@ -114,6 +116,64 @@ class Category extends Backend
*
* @return string
*/
/**
* 校验首页金刚区推荐上限(最多8个,且仅允许二级分类)
*
* @param array $idArr 涉及的分类ID数组
* @param int $isHome 设定的推荐值(1开启,0关闭)
* @return void
*/
protected function checkHomeNavLimit(array $idArr, $isHome)
{
if ((int)$isHome !== 1 || empty($idArr)) {
return;
}
// 1. 检查是否存在一级大类
$topCategories = Db::name('fc_category')
->where('id', 'in', $idArr)
->where('pid', 0)
->column('name');
if (!empty($topCategories)) {
$topNames = implode('、', $topCategories);
$this->error("首页金刚区专用于二级品类推荐,一级大类【{$topNames}】不可推荐至金刚区");
}
// 2. 统计当前已推荐的二级分类数量(排除当前正在编辑的记录)
$currentCount = Db::name('fc_category')
->where('pid', '>', 0)
->where('is_home', 1)
->whereNotIn('id', $idArr)
->count();
$newTotal = $currentCount + count($idArr);
if ($newTotal > 8) {
$this->error("首页金刚区按钮上限仅为 8 个!当前已有 {$currentCount} 个已推荐,本次操作将达到 {$newTotal} 个,请先关闭其他已推荐分类。");
}
}
/**
* 批量更新与单项开关切换(严格控制首页金刚区最多 8 个)
*
* @param string $ids 待操作的记录ID串
* @return void
*/
public function multi($ids = "")
{
$ids = $ids ? $ids : $this->request->param("ids");
if ($ids) {
if ($this->request->has('params')) {
parse_str($this->request->post("params"), $values);
if (isset($values['is_home'])) {
$idArr = array_filter(explode(',', (string)$ids));
$this->checkHomeNavLimit($idArr, $values['is_home']);
}
}
}
parent::multi($ids);
}
public function add()
{
if ($this->request->isPost()) {
@@ -143,6 +203,9 @@ class Category extends Backend
if ($this->request->isPost()) {
$params = $this->request->post('row/a', []);
$params = $this->normalizeCategoryParams($params, (int)$ids);
if (isset($params['is_home'])) {
$this->checkHomeNavLimit([(int)$ids], $params['is_home']);
}
$this->request->post(['row' => $params]);
return parent::edit($ids);
}

查看文件

@@ -618,6 +618,16 @@
</a>
</div>
</div>
<div class="form-group" style="margin-bottom:10px;">
<label class="control-label col-xs-12 col-sm-3">首页金刚区推荐:</label>
<div class="col-xs-12 col-sm-9">
<input id="c-is_home" name="row[is_home]" type="hidden" value="0">
<a href="javascript:;" data-toggle="switcher" class="btn-switcher" data-input-id="c-is_home" data-yes="1" data-no="0">
<i class="fa fa-toggle-on text-success fa-flip-horizontal text-gray fa-2x"></i>
</a>
<span class="help-block" style="margin-bottom:0;color:#64748B;font-size:12px;">开启后将在小程序端首页金刚区优先展示该品类</span>
</div>
</div>
</div>
<input id="c-post_count" name="row[post_count]" type="hidden" value="0">

查看文件

@@ -618,6 +618,16 @@
</a>
</div>
</div>
<div class="form-group" style="margin-bottom:10px;">
<label class="control-label col-xs-12 col-sm-3">首页金刚区推荐:</label>
<div class="col-xs-12 col-sm-9">
<input id="c-is_home" name="row[is_home]" type="hidden" value="{$row.is_home}">
<a href="javascript:;" data-toggle="switcher" class="btn-switcher" data-input-id="c-is_home" data-yes="1" data-no="0">
<i class="fa fa-toggle-on text-success {eq name="$row.is_home" value="0"}fa-flip-horizontal text-gray{/eq} fa-2x"></i>
</a>
<span class="help-block" style="margin-bottom:0;color:#64748B;font-size:12px;">开启后将在小程序端首页金刚区优先展示该品类</span>
</div>
</div>
<div class="form-group" style="margin-bottom:10px;">
<label class="control-label col-xs-12 col-sm-3">帖子数量:</label>
<div class="col-xs-12 col-sm-9">

查看文件

@@ -97,7 +97,7 @@
<div class="panel-body">
<div class="fc-cat-notice">
<i class="fa fa-info-circle"></i>
<div>分类直接联动小程序<strong>首页金刚区</strong>与<strong>分类频道</strong>,按排序权重升序展示。点击开关可<strong>一键上架/下架</strong>,鼠标悬停分类图标可<strong>放大预览</strong>。</div>
<div>分类直接联动小程序<strong>首页金刚区</strong>与<strong>分类频道</strong>,按排序权重升序展示。点击开关可<strong>一键上架/下架</strong>,<strong>首页金刚区推荐上限为 8 个</strong>(仅限二级品类,超限自动拦截并提示),鼠标悬停分类图标可<strong>放大预览</strong>。</div>
</div>
<div id="myTabContent" class="tab-content">
@@ -108,6 +108,10 @@
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('fc/category/add')?'':'hide'}" title="{:__('Add')}"><i class="fa fa-plus"></i> 添加分类</a>
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('fc/category/edit')?'':'hide'}" title="{:__('Edit')}"><i class="fa fa-pencil"></i> {:__('Edit')}</a>
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('fc/category/del')?'':'hide'}" title="{:__('Delete')}"><i class="fa fa-trash"></i> {:__('Delete')}</a>
<span class="btn" style="background:#f0fdf4;color:#16a34a;border:1px solid #bbf7d0;border-radius:8px;font-weight:600;padding:6px 12px;cursor:default;">
<i class="fa fa-star text-warning"></i> 金刚区已推荐:<b id="fc-home-count">{$homeCount|default='8'}</b> / 8 个
</span>
<a href="javascript:;" class="btn btn-default btn-filter-home" style="border:1px solid #dbe6ee;" title="只查看已推荐至首页金刚区的二级品类"><i class="fa fa-star text-warning"></i> 只看金刚区</a>
</div>
<table id="table" class="table table-hover table-nowrap fc-cat-table"
data-operate-edit="{:$auth->check('fc/category/edit')}"