Files
ccdi/doc/implementation/scripts/test_intermediary_edit_fix.bat
2026-02-09 14:28:25 +08:00

108 lines
3.2 KiB
Batchfile
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
@echo off
setlocal enabledelayedexpansion
REM 中介黑名单编辑功能修复测试脚本
REM 用于验证修改按钮点击后数据是否正确反显
set BASE_URL=http://localhost:8080
set USERNAME=admin
set PASSWORD=admin123
echo ==========================================
echo 中介黑名单编辑功能修复测试
echo ==========================================
echo.
REM 步骤1: 登录获取 token
echo 步骤1: 登录系统...
curl -s -X POST "%BASE_URL%/login/test" -H "Content-Type: application/json" -d "{\"username\":\"%USERNAME%\",\"password\":\"%PASSWORD%\"}" > login_response.json
echo 登录响应:
type login_response.json
echo.
REM 使用 PowerShell 提取 token
for /f "tokens=2 delims=:," %%a in ('powershell -command "(Get-Content login_response.json | ConvertFrom-Json).data.token"') do set TOKEN=%%a
set TOKEN=%TOKEN:"=%
if "%TOKEN%"=="" (
echo ❌ 登录失败,无法获取 token
pause
exit /b 1
)
echo ✅ 登录成功Token: %TOKEN:~0,20%...
echo.
REM 步骤2: 查询中介黑名单列表
echo 步骤2: 查询中介黑名单列表...
curl -s -X GET "%BASE_URL%/dpc/intermediary/list?pageNum=1&pageSize=10" -H "Authorization: Bearer %TOKEN%" > list_response.json
echo 列表响应:
powershell -command "Get-Content list_response.json | ConvertFrom-Json | ConvertTo-Json -Depth 3"
echo.
REM 步骤3: 获取个人中介详情
echo 步骤3: 测试个人中介详情查询(假设 ID=1...
curl -s -X GET "%BASE_URL%/dpc/intermediary/1" -H "Authorization: Bearer %TOKEN%" > person_detail.json
echo 个人中介详情响应:
powershell -command "Get-Content person_detail.json | ConvertFrom-Json | ConvertTo-Json -Depth 10"
echo.
REM 检查关键字段
findstr /C:"\"intermediaryType\":\"1\"" person_detail.json >nul
if !errorlevel! equ 0 (
echo ✅ 个人中介类型字段正确
) else (
echo ❌ 个人中介类型字段缺失或错误
)
findstr /C:"\"name\"" person_detail.json >nul
if !errorlevel! equ 0 (
echo ✅ 姓名字段存在
) else (
echo ❌ 姓名字段缺失
)
echo.
REM 步骤4: 获取机构中介详情(假设 ID=2
echo 步骤4: 测试机构中介详情查询(假设 ID=2...
curl -s -X GET "%BASE_URL%/dpc/intermediary/2" -H "Authorization: Bearer %TOKEN%" > entity_detail.json
echo 机构中介详情响应:
powershell -command "Get-Content entity_detail.json | ConvertFrom-Json | ConvertTo-Json -Depth 10"
echo.
REM 检查关键字段
findstr /C:"\"intermediaryType\":\"2\"" entity_detail.json >nul
if !errorlevel! equ 0 (
echo ✅ 机构中介类型字段正确
) else (
echo ❌ 机构中介类型字段缺失或错误
)
findstr /C:"\"name\"" entity_detail.json >nul
if !errorlevel! equ 0 (
echo ✅ 机构名称字段存在
) else (
echo ❌ 机构名称字段缺失
)
echo.
echo ==========================================
echo 测试完成
echo ==========================================
echo.
echo 验证要点:
echo 1. 确保后端返回的数据包含 intermediaryType 字段
echo 2. 确保返回的数据结构与前端表单字段匹配
echo 3. 个人中介 (intermediaryType='1') 应包含 indivXXX 字段
echo 4. 机构中介 (intermediaryType='2') 应包含 corpXXX 字段
echo.
echo 如需测试特定 ID请修改脚本中的 ID 值
echo.
pause