Files
user-system/scripts/validate.bat
long-agent 5b6bd93179 refactor: 整理项目根目录结构
整理内容:
- 删除 60+ 临时测试输出文件 (*.txt)
- 移动二进制文件到 bin/ 目录
- 移动 Shell 脚本到 scripts/ 目录
  - scripts/dev/: check_gitea.sh, check_sub2api.sh, run_tests.sh
  - scripts/deploy/: deploy_*.sh, simple_deploy.sh
  - scripts/ops/: fix_nginx.sh, fix_ssl.sh, install_docker.sh
  - scripts/test/: test_*.sh, test_*.bat
- 移动批处理文件到 scripts/
- 移动 Python 脚本到 tools/
- 清理临时日志文件

保留根目录必要文件:
- go.mod, go.sum, go.work
- Makefile, docker-compose.yml
- .env.example, .gitignore
- README.md, AGENTS.md, DEPLOY_GUIDE.md

验证: go build ./... && go test ./... 通过
2026-04-07 18:10:36 +08:00

212 lines
4.4 KiB
Batchfile
Raw 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
chcp 65001 >nul
echo ====================================
echo 用户管理系统 - 代码结构验证
echo ====================================
echo.
echo 正在验证项目结构...
echo.
set TOTAL=0
set EXISTS=0
set MISSING=0
REM 检查文件
if exist "cmd\server\main.go" (
echo [√] cmd\server\main.go
set /a EXISTS+=1
) else (
echo [×] cmd\server\main.go
set /a MISSING+=1
)
set /a TOTAL+=1
if exist "go.mod" (
echo [√] go.mod
set /a EXISTS+=1
) else (
echo [×] go.mod
set /a MISSING+=1
)
set /a TOTAL+=1
if exist "internal\domain\user.go" (
echo [√] internal\domain\user.go
set /a EXISTS+=1
) else (
echo [×] internal\domain\user.go
set /a MISSING+=1
)
set /a TOTAL+=1
if exist "internal\service\auth.go" (
echo [√] internal\service\auth.go
set /a EXISTS+=1
) else (
echo [×] internal\service\auth.go
set /a MISSING+=1
)
set /a TOTAL+=1
if exist "internal\service\user.go" (
echo [√] internal\service\user.go
set /a EXISTS+=1
) else (
echo [×] internal\service\user.go
set /a MISSING+=1
)
set /a TOTAL+=1
if exist "internal\service\role.go" (
echo [√] internal\service\role.go
set /a EXISTS+=1
) else (
echo [×] internal\service\role.go
set /a MISSING+=1
)
set /a TOTAL+=1
if exist "internal\service\permission.go" (
echo [√] internal\service\permission.go
set /a EXISTS+=1
) else (
echo [×] internal\service\permission.go
set /a MISSING+=1
)
set /a TOTAL+=1
if exist "internal\service\device.go" (
echo [√] internal\service\device.go
set /a EXISTS+=1
) else (
echo [×] internal\service\device.go
set /a MISSING+=1
)
set /a TOTAL+=1
if exist "internal\api\handler\auth.go" (
echo [√] internal\api\handler\auth.go
set /a EXISTS+=1
) else (
echo [×] internal\api\handler\auth.go
set /a MISSING+=1
)
set /a TOTAL+=1
if exist "internal\api\handler\user.go" (
echo [√] internal\api\handler\user.go
set /a EXISTS+=1
) else (
echo [×] internal\api\handler\user.go
set /a MISSING+=1
)
set /a TOTAL+=1
if exist "internal\api\handler\role.go" (
echo [√] internal\api\handler\role.go
set /a EXISTS+=1
) else (
echo [×] internal\api\handler\role.go
set /a MISSING+=1
)
set /a TOTAL+=1
if exist "internal\api\handler\permission.go" (
echo [√] internal\api\handler\permission.go
set /a EXISTS+=1
) else (
echo [×] internal\api\handler\permission.go
set /a MISSING+=1
)
set /a TOTAL+=1
if exist "internal\api\handler\device.go" (
echo [√] internal\api\handler\device.go
set /a EXISTS+=1
) else (
echo [×] internal\api\handler\device.go
set /a MISSING+=1
)
set /a TOTAL+=1
if exist "internal\cache\cache_manager.go" (
echo [√] internal\cache\cache_manager.go
set /a EXISTS+=1
) else (
echo [×] internal\cache\cache_manager.go
set /a MISSING+=1
)
set /a TOTAL+=1
if exist "internal\monitoring\metrics.go" (
echo [√] internal\monitoring\metrics.go
set /a EXISTS+=1
) else (
echo [×] internal\monitoring\metrics.go
set /a MISSING+=1
)
set /a TOTAL+=1
if exist "internal\api\router\router.go" (
echo [√] internal\api\router\router.go
set /a EXISTS+=1
) else (
echo [×] internal\api\router\router.go
set /a MISSING+=1
)
set /a TOTAL+=1
if exist "migrations\sqlite\V1__init.sql" (
echo [√] migrations\sqlite\V1__init.sql
set /a EXISTS+=1
) else (
echo [×] migrations\sqlite\V1__init.sql
set /a MISSING+=1
)
set /a TOTAL+=1
if exist "configs\config.yaml" (
echo [√] configs\config.yaml
set /a EXISTS+=1
) else (
echo [×] configs\config.yaml
set /a MISSING+=1
)
set /a TOTAL+=1
if exist "docker-compose.yml" (
echo [√] docker-compose.yml
set /a EXISTS+=1
) else (
echo [×] docker-compose.yml
set /a MISSING+=1
)
set /a TOTAL+=1
echo.
echo ====================================
echo 验证结果
echo ====================================
echo 总文件数: %TOTAL%
echo 存在文件: %EXISTS%
echo 缺失文件: %MISSING%
echo.
set /a PERCENT=%EXISTS%*100/%TOTAL%
echo 完成度: %PERCENT%%%
if %PERCENT% GEQ 95 (
echo.
echo [SUCCESS] 项目结构完整,可以进行验收!
exit /b 0
) else if %PERCENT% GEQ 80 (
echo.
echo [WARNING] 项目基本完成,但还有部分功能需要补充
exit /b 1
) else (
echo.
echo [ERROR] 项目完成度较低,需要继续完善
exit /b 1
)