32 lines
1.9 KiB
PowerShell
32 lines
1.9 KiB
PowerShell
# 验证报价模板 list / agent 接口(登录免验证码后)
|
|
$ErrorActionPreference = 'Continue'
|
|
$loginBody = '{"username":"admin","password":"123456","captcha":"","checkKey":""}'
|
|
$login = Invoke-RestMethod -Uri 'http://127.0.0.1:8180/jeecgboot/sys/login' -Method POST -Body $loginBody -ContentType 'application/json;charset=UTF-8'
|
|
$token = $login.result.token
|
|
Write-Host ("login_ok=" + $login.success)
|
|
$h = @{ 'X-Access-Token' = $token }
|
|
|
|
$raw = Invoke-WebRequest -Uri 'http://127.0.0.1:8180/jeecgboot/inquiry/quoteTemplate/list?pageNo=1&pageSize=20' -Headers $h -UseBasicParsing
|
|
Write-Host '=== list raw ==='
|
|
Write-Host $raw.Content.Substring(0, [Math]::Min(1200, $raw.Content.Length))
|
|
|
|
$agent = Invoke-WebRequest -Uri 'http://127.0.0.1:8180/jeecgboot/inquiry/quoteTemplate/agent/listEnabled?enabledOnly=true' -Headers $h -UseBasicParsing
|
|
Write-Host '=== agent raw ==='
|
|
Write-Host $agent.Content.Substring(0, [Math]::Min(800, $agent.Content.Length))
|
|
|
|
# DB count via env already loaded by process; use MYSQL from .env keys used previously
|
|
$envLines = Get-Content 'E:\wwwroot\.env'
|
|
$user = 'inquiry_robot'
|
|
$pw = $null
|
|
foreach ($line in $envLines) {
|
|
if ($line -match '^MYSQL_PASSWORD=(.+)$') { $pw = $Matches[1].Trim().Trim('"') }
|
|
if ($line -match '^YTD_MYSQL_PASSWORD=(.+)$') { $pw = $Matches[1].Trim().Trim('"') }
|
|
if ($line -match '^MYSQL_USER=(.+)$') { $user = $Matches[1].Trim().Trim('"') }
|
|
}
|
|
$mysql = 'C:\yutongda\tools\mysql-8.0.39-winx64\bin\mysql.exe'
|
|
Write-Host ("mysql_user=" + $user + " pw_len=" + ($(if ($pw) { $pw.Length } else { 0 })))
|
|
if ($pw) {
|
|
& $mysql -h 127.0.0.1 -P 3306 -u $user "--password=$pw" --default-character-set=utf8mb4 inquiry_robot -N -e "SELECT 'tpl',COUNT(*) FROM inq_quote_template; SELECT 'ver',COUNT(*) FROM inq_quote_template_version; SELECT 'enabled',COUNT(*) FROM inq_quote_template WHERE status='ENABLED';"
|
|
}
|
|
Write-Host 'QUOTE_TEMPLATE_VERIFY_OK'
|