DB数据库文件

This commit is contained in:
2026-05-26 09:43:42 +08:00
parent e0b303c5d4
commit a4c8f623be
30 changed files with 1416 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
<?php
/**
* 为已有渠道补齐缺失的默认配置(不删除已有数据)
* 用法php db/run_fill_missing_channel_config.php
*/
declare(strict_types=1);
define('BASE_PATH', dirname(__DIR__));
require_once BASE_PATH . '/vendor/autoload.php';
if (class_exists(\Dotenv\Dotenv::class) && is_file(BASE_PATH . '/.env')) {
\Dotenv\Dotenv::createUnsafeMutable(BASE_PATH)->load();
}
\Webman\Config::load(BASE_PATH . '/config', ['route', 'plugin']);
\Webman\ThinkOrm\ThinkOrm::start(null);
use app\dice\service\DiceChannelConfigService;
use plugin\saiadmin\app\model\system\SystemDept;
echo "========== 补齐渠道缺失配置 ==========\n";
$service = new DiceChannelConfigService();
$service->ensureConfigCompositeKeys();
$summary = $service->syncAllChannelsFromDefault();
foreach ($summary as $deptId => $info) {
$copied = implode(',', $info['copied'] ?? []) ?: '无';
$merged = empty($info['merged']) ? '无' : json_encode($info['merged'], JSON_UNESCAPED_UNICODE);
$skipped = implode(',', $info['skipped'] ?? []) ?: '无';
echo "渠道 {$deptId}: 新增表 [{$copied}] 补齐行 {$merged} 跳过 [{$skipped}]\n";
}
echo "\n渠道数: " . SystemDept::count() . "\n完成。\n";