inspect_water_cleanup.php 944 B

12345678910111213141516171819
  1. <?php
  2. require dirname(__DIR__) . '/vendor/autoload.php';
  3. \Dotenv\Dotenv::createUnsafeMutable(dirname(__DIR__))->load();
  4. \support\App::loadAllConfig(['route']);
  5. \Webman\ThinkOrm\ThinkOrm::start(null);
  6. use support\think\Db;
  7. $tables = Db::query('SHOW TABLES');
  8. foreach ($tables as $record) {
  9. $table = array_values($record)[0];
  10. if (!preg_match('/^[a-zA-Z0-9_]+$/D',$table)) continue;
  11. echo $table.' '.Db::table($table)->count()."\n";
  12. }
  13. foreach (['sa_system_user','sa_agent_profile','sa_agent_contract'] as $table) {
  14. if (!in_array($table,array_map(fn($r)=>array_values($r)[0],$tables),true)) continue;
  15. echo "COLUMNS $table\n";
  16. foreach (Db::query('SHOW COLUMNS FROM `'.$table.'`') as $column) echo $column['Field'].' '.$column['Type']."\n";
  17. }
  18. echo "MENUS\n";
  19. foreach (Db::table('sa_system_menu')->where('type','<>',3)->field('id,parent_id,code,path,component')->select()->toArray() as $menu) echo json_encode($menu,JSON_UNESCAPED_UNICODE)."\n";