Files
rlz/quick_test.sh

41 lines
1.1 KiB
Bash
Raw Normal View History

2026-01-26 15:02:59 +08:00
#!/bin/bash
# 快速API接口测试脚本简化版
SERVER_URL="http://localhost:8039"
# 如果需要测试公网,修改为: SERVER_URL="http://101.43.95.130:8039"
echo "快速测试后台接口..."
echo "服务器: $SERVER_URL"
echo ""
# 测试首页
echo -n "1. 首页接口: "
if curl -s -o /dev/null -w "%{http_code}" "$SERVER_URL/" | grep -q "200"; then
echo "✓ 正常"
else
echo "✗ 异常"
fi
# 测试验证码
echo -n "2. 验证码接口: "
code=$(curl -s "$SERVER_URL/captchaImage" | grep -o '"code":[0-9]*' | cut -d: -f2)
if [ "$code" = "200" ]; then
echo "✓ 正常"
else
echo "✗ 异常 (code=$code)"
fi
# 测试微信登录
echo -n "3. 微信登录接口: "
http_code=$(curl -s -o /dev/null -w "%{http_code}" -X POST "$SERVER_URL/weixinLogin" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "wxcode=test&encryptedData=test&iv=test")
if [ "$http_code" = "200" ] || [ "$http_code" = "500" ]; then
echo "✓ 正常 (HTTP $http_code)"
else
echo "✗ 异常 (HTTP $http_code)"
fi
echo ""
echo "测试完成!"