文件
fenleixinxi/tools/verify_all.php
MiAn 66b9abe089 feat: 新增工具脚本用于批量下载蔬菜水果分类实拍图并更新数据库
新增3个工具脚本:
1. check_cats.py - 检查分类数据
2. list_all_veg_fruit.py - 列出所有蔬菜水果分类
3. verify_all.php - 验证分类图片完整性
4. download_real_photos.py - 批量下载蔬菜水果真实实拍图,裁剪为240x240,同步更新数据库和uniapp静态资源
2026-10-29 08:28:52 +08:00

29 行
986 B
PHP

<?php
/**
* 验证 ThinkPHP 下分类与附件数据
*/
define('APP_PATH', __DIR__ . '/../application/');
require __DIR__ . '/../thinkphp/base.php';
\think\App::initCommon();
$total = \think\Db::name('fc_category')->where('enabled', 1)->count();
$veg = \think\Db::name('fc_category')->where('pid', 1)->where('enabled', 1)->count();
$fruit = \think\Db::name('fc_category')->where('pid', 2)->where('enabled', 1)->count();
echo "总分类数: {$total}\n";
echo "蔬菜二级分类数: {$veg}\n";
echo "水果二级分类数: {$fruit}\n";
$rows = \think\Db::name('fc_category')->whereIn('pid', [1, 2])->where('enabled', 1)->select();
$missingFiles = 0;
foreach ($rows as $r) {
$filePath = __DIR__ . '/../public' . $r['image'];
if (!file_exists($filePath)) {
echo "缺失图片: {$r['name']} -> {$r['image']}\n";
$missingFiles++;
}
}
if ($missingFiles === 0) {
echo "✓ 全部 " . count($rows) . " 个蔬菜水果分类图片均存在于本地!\n";
}