Files
tyapi-server/test_article_simple.sh
2025-09-01 18:29:59 +08:00

34 lines
842 B
Bash
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.

#!/bin/bash
# 文章系统API简单测试脚本
# 使用方法: ./test_article_simple.sh
BASE_URL="http://localhost:8080/api/v1"
echo "=== 文章系统API测试 ==="
echo ""
# 测试1: 获取文章列表
echo "1. 测试获取文章列表..."
curl -s -X GET "$BASE_URL/articles?page=1&page_size=5" \
-H "Content-Type: application/json" | jq .
echo ""
echo ""
# 测试2: 获取文章统计
echo "2. 测试获取文章统计..."
curl -s -X GET "$BASE_URL/articles/stats" \
-H "Content-Type: application/json" | jq .
echo ""
echo ""
# 测试3: 搜索文章
echo "3. 测试搜索文章..."
curl -s -X GET "$BASE_URL/articles/search?keyword=技术&page=1&page_size=5" \
-H "Content-Type: application/json" | jq .
echo ""
echo ""
echo "=== 测试完成 ==="
echo "注意: 需要认证的接口需要JWT token请先登录获取token"