# Verify all session fixes: channel-accounts, qdrant menu, sales-corpus, industry labels param( [string]$TenantDb = "fs_tenant_cs1", [string]$CompanyApi = "http://127.0.0.1:8006", [string]$AdminApi = "http://127.0.0.1:8004" ) $ErrorActionPreference = "Continue" $pass = 0 $fail = 0 $warn = 0 function Report-Ok($msg) { Write-Host "[PASS] $msg" -ForegroundColor Green; $script:pass++ } function Report-Fail($msg) { Write-Host "[FAIL] $msg" -ForegroundColor Red; $script:fail++ } function Report-Warn($msg) { Write-Host "[WARN] $msg" -ForegroundColor Yellow; $script:warn++ } function Test-HttpNot404 { param([string]$Base, [string]$Path, [string]$Label) $uri = "$($Base.TrimEnd('/'))$Path" try { $r = Invoke-WebRequest -Uri $uri -UseBasicParsing -TimeoutSec 10 $code = [int]$r.StatusCode } catch { $resp = $_.Exception.Response if ($resp) { $code = [int]$resp.StatusCode } else { $code = 0 } } if ($code -eq 404) { Report-Fail "$Label -> HTTP 404 ($uri)" } elseif ($code -ge 200 -and $code -lt 500) { Report-Ok "$Label -> HTTP $code (endpoint registered)" } else { Report-Warn "$Label -> HTTP $code" } } Write-Host "=== Session Fixes Verification ===" -ForegroundColor Cyan # --- API endpoints (401/200 OK, 404 FAIL) --- Write-Host "`n--- Backend API routes ---" -ForegroundColor Cyan $companyPaths = @( @{ Path = "/workflow/lobster-exec/lookup/channel-accounts?channelType=QW"; Label = "实例监控-渠道账号(company)" }, @{ Path = "/workflow/lobster/sales-corpus/tasks?page=1&size=10"; Label = "销冠语料-任务列表(company)" }, @{ Path = "/workflow/lobster/sales-corpus/scenarios"; Label = "销冠语料-场景(company)" }, @{ Path = "/workflow/tagBinding/tag-binding/data-scope"; Label = "数据范围(已移除UI,接口仍可用)" } ) foreach ($p in $companyPaths) { Test-HttpNot404 -Base $CompanyApi -Path $p.Path -Label $p.Label } $adminPaths = @( @{ Path = "/workflow/lobster-exec/lookup/channel-accounts?channelType=QW"; Label = "实例监控-渠道账号(admin)" }, @{ Path = "/workflow/lobster/sales-corpus/tasks?page=1&size=10"; Label = "销冠语料-任务列表(admin)" } ) foreach ($p in $adminPaths) { Test-HttpNot404 -Base $AdminApi -Path $p.Path -Label $p.Label } # --- DB: menus + sales corpus table --- Write-Host "`n--- Tenant DB ($TenantDb) ---" -ForegroundColor Cyan node -e @" const mysql = require('mysql2/promise'); (async () => { const c = await mysql.createConnection({ host: 'cq-cdb-8fjmemkb.sql.tencentcdb.com', port: 27220, user: 'root', password: 'Ylrz_1q2w3e4r5t6y', database: '$TenantDb', charset: 'utf8mb4' }); const checks = []; const [qdrantSys] = await c.query('SELECT menu_id,menu_name,path,visible FROM sys_menu WHERE menu_id=29951'); const [qdrantCm] = await c.query('SELECT menu_id,menu_name,path FROM company_menu WHERE menu_id=29951'); checks.push(['向量知识库 sys_menu', qdrantSys.length === 1 && qdrantSys[0].path === 'qdrant']); checks.push(['向量知识库 company_menu', qdrantCm.length >= 1]); const [srm] = await c.query('SELECT COUNT(*) cnt FROM sys_role_menu WHERE menu_id=29951'); const [crm] = await c.query('SELECT COUNT(*) cnt FROM company_role_menu WHERE menu_id=29951'); checks.push(['向量知识库角色授权 sys', srm[0].cnt > 0]); checks.push(['向量知识库角色授权 company', crm[0].cnt > 0]); const [tbl] = await c.query(`SELECT COUNT(*) cnt FROM information_schema.TABLES WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME='lobster_sales_corpus_task'`); checks.push(['销冠语料任务表', tbl[0].cnt === 1]); const [col] = await c.query(`SELECT COUNT(*) cnt FROM information_schema.COLUMNS WHERE TABLE_SCHEMA=DATABASE() AND TABLE_NAME='lobster_sales_corpus' AND COLUMN_NAME='task_id'`); checks.push(['语料 task_id 字段', col[0].cnt === 1]); for (const [name, ok] of checks) { console.log((ok ? 'PASS' : 'FAIL') + '|' + name); } await c.end(); })().catch(e => { console.log('FAIL|DB:' + e.message); process.exit(1); }); "@ 2>&1 | ForEach-Object { if ($_ -match '^(PASS|FAIL)\|(.+)$') { if ($matches[1] -eq 'PASS') { Report-Ok $matches[2] } else { Report-Fail $matches[2] } } else { Write-Host $_ } } # --- Frontend code checks --- Write-Host "`n--- Frontend code ---" -ForegroundColor Cyan $root = "d:\ylrz_saas_new" $feChecks = @( @{ File = "$root\saas-companyui\src\views\lobster\sales-corpus\index.vue"; Must = "formatIndustryType|getIndustryTypeLabel"; MustNot = "scopeLabel|loadDataScope|数据范围"; Name = "companyui 销冠语料(无数据范围+对齐)" }, @{ File = "$root\saas-companyui\src\views\company\workflowLobster\index.vue"; Must = "formatIndustryType"; Name = "companyui 行业类型中文" }, @{ File = "$root\saas-companyui\src\utils\lobster\industryOptions.js"; Must = "getIndustryTypeLabel"; Name = "companyui industryOptions 工具" }, @{ File = "$root\saas-mgnui\src\views\company\workflowLobster\index.vue"; Must = "formatIndustryType"; Name = "mgnui 行业类型中文" }, @{ File = "$root\saas-companyui\src\views\lobster\qdrant\index.vue"; Must = ""; Name = "companyui 向量知识库页面" } ) foreach ($c in $feChecks) { if (-not (Test-Path $c.File)) { Report-Fail "$($c.Name) - file missing" continue } $content = Get-Content $c.File -Raw -ErrorAction SilentlyContinue $ok = $true if ($c.Must) { foreach ($m in ($c.Must -split '\|')) { if ($content -notmatch [regex]::Escape($m) -and $content -notmatch $m) { $ok = $false; break } } } if ($c.MustNot) { foreach ($m in ($c.MustNot -split '\|')) { if ($content -match $m) { $ok = $false; break } } } if ($c.Name -match "向量知识库页面") { if (Test-Path $c.File) { Report-Ok $c.Name } else { Report-Fail $c.Name } } elseif ($ok) { Report-Ok $c.Name } else { Report-Fail $c.Name } } # sales-corpus align styles $corpUi = Get-Content "$root\saas-companyui\src\views\lobster\sales-corpus\index.vue" -Raw if ($corpUi -match 'width:\s*100%' -and $corpUi -match 'margin-left:\s*0') { Report-Ok "companyui 查询区 width 100% 对齐" } else { Report-Fail "companyui 查询区对齐样式" } Write-Host "`n=== Summary: PASS=$pass FAIL=$fail WARN=$warn ===" -ForegroundColor $(if ($fail -eq 0) { "Green" } else { "Red" }) if ($fail -gt 0) { exit 1 }