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,46 @@
<?php
/**
* 渠道配置初始化:默认模板 + 为已有渠道补齐配置 + 业务数据 dept_id 回填
* 用法:在 server 目录执行 php db/run_channel_config_init.php
*/
require_once __DIR__ . '/../vendor/autoload.php';
$bootstrap = __DIR__ . '/../support/bootstrap.php';
if (is_file($bootstrap)) {
require_once $bootstrap;
}
use app\dice\service\DiceChannelConfigService;
use support\think\Db;
$service = new DiceChannelConfigService();
echo "1. 将 dept_id=0 的配置归为默认模板dept_id 置空)...\n";
echo " 若需将全部现有配置作为模板,请确认后手动执行 UPDATE ... SET dept_id=NULL\n";
foreach (
[
'dice_config',
'dice_ante_config',
'dice_lottery_pool_config',
'dice_reward_config',
'dice_reward',
'dice_game',
] as $table
) {
try {
Db::table($table)->where('dept_id', 0)->update(['dept_id' => null]);
echo " {$table}: ok\n";
} catch (\Throwable $e) {
echo " {$table}: 跳过 ({$e->getMessage()})\n";
}
}
echo "2. 为所有渠道补齐默认配置...\n";
$summary = $service->syncAllChannelsFromDefault();
print_r($summary);
echo "3. 回填玩家及记录 dept_id...\n";
$stats = $service->backfillDataDeptId();
print_r($stats);
echo "完成。\n";