增加鉴权服务模块

This commit is contained in:
2025-07-15 19:10:13 +08:00
parent e78f192d34
commit 9a3a8267b5
3 changed files with 155 additions and 26 deletions
@@ -30,55 +30,71 @@ spring:
routes:
# 用户服务路由
- id: emotion-user-route
uri: lb://emotion-user
uri: http://localhost:19001
predicates:
- Path=/user/**
filters:
- StripPrefix=0
# 验证码服务路由
- id: emotion-captcha-route
uri: http://localhost:19001
predicates:
- Path=/captcha/**
filters:
- StripPrefix=0
# OAuth服务路由
- id: emotion-oauth-route
uri: http://localhost:19001
predicates:
- Path=/oauth/**
filters:
- StripPrefix=0
# AI服务路由
- id: emotion-ai-route
uri: lb://emotion-ai
uri: http://localhost:19002
predicates:
- Path=/ai/**
filters:
- StripPrefix=0
# 记录服务路由
- id: emotion-record-route
uri: lb://emotion-record
uri: http://localhost:19003
predicates:
- Path=/record/**
filters:
- StripPrefix=0
# 成长服务路由
- id: emotion-growth-route
uri: lb://emotion-growth
uri: http://localhost:19004
predicates:
- Path=/growth/**
filters:
- StripPrefix=0
# 探索服务路由
- id: emotion-explore-route
uri: lb://emotion-explore
uri: http://localhost:19005
predicates:
- Path=/explore/**
filters:
- StripPrefix=0
# 奖励服务路由
- id: emotion-reward-route
uri: lb://emotion-reward
uri: http://localhost:19006
predicates:
- Path=/reward/**
filters:
- StripPrefix=0
# 统计服务路由
- id: emotion-stats-route
uri: lb://emotion-stats
uri: http://localhost:19007
predicates:
- Path=/stats/**
filters:
@@ -30,55 +30,71 @@ spring:
routes:
# 用户服务路由
- id: emotion-user-route
uri: lb://emotion-user
uri: http://localhost:19001
predicates:
- Path=/user/**
filters:
- StripPrefix=0
# 验证码服务路由
- id: emotion-captcha-route
uri: http://localhost:19001
predicates:
- Path=/captcha/**
filters:
- StripPrefix=0
# OAuth服务路由
- id: emotion-oauth-route
uri: http://localhost:19001
predicates:
- Path=/oauth/**
filters:
- StripPrefix=0
# AI服务路由
- id: emotion-ai-route
uri: lb://emotion-ai
uri: http://localhost:19002
predicates:
- Path=/ai/**
filters:
- StripPrefix=0
# 记录服务路由
- id: emotion-record-route
uri: lb://emotion-record
uri: http://localhost:19003
predicates:
- Path=/record/**
filters:
- StripPrefix=0
# 成长服务路由
- id: emotion-growth-route
uri: lb://emotion-growth
uri: http://localhost:19004
predicates:
- Path=/growth/**
filters:
- StripPrefix=0
# 探索服务路由
- id: emotion-explore-route
uri: lb://emotion-explore
uri: http://localhost:19005
predicates:
- Path=/explore/**
filters:
- StripPrefix=0
# 奖励服务路由
- id: emotion-reward-route
uri: lb://emotion-reward
uri: http://localhost:19006
predicates:
- Path=/reward/**
filters:
- StripPrefix=0
# 统计服务路由
- id: emotion-stats-route
uri: lb://emotion-stats
uri: http://localhost:19007
predicates:
- Path=/stats/**
filters:
+97
View File
@@ -0,0 +1,97 @@
#!/bin/bash
echo "🚀 启动情感博物馆服务..."
# 检查基础服务
echo "📊 检查基础服务..."
if ! nc -z localhost 3306; then
echo "❌ MySQL服务未启动,请先启动MySQL服务"
exit 1
fi
if ! nc -z localhost 6379; then
echo "❌ Redis服务未启动,请先启动Redis服务"
exit 1
fi
echo "✅ 基础服务检查通过"
# 创建日志目录
mkdir -p logs
# 启动用户服务
echo "🔄 启动用户服务..."
cd emotion-user
mvn clean package -DskipTests -q
if [ $? -eq 0 ]; then
nohup java -jar -Dspring.profiles.active=local -Dspring.cloud.nacos.discovery.enabled=false -Dspring.cloud.nacos.config.enabled=false target/emotion-user-1.0.0.jar > ../logs/user.log 2>&1 &
echo $! > ../logs/user.pid
echo "✅ 用户服务启动完成 (PID: $!)"
sleep 5
else
echo "❌ 用户服务编译失败"
exit 1
fi
cd ..
# 启动AI服务
echo "🔄 启动AI服务..."
cd emotion-ai
mvn clean package -DskipTests -q
if [ $? -eq 0 ]; then
nohup java -jar -Dspring.profiles.active=local -Dspring.cloud.nacos.discovery.enabled=false -Dspring.cloud.nacos.config.enabled=false target/emotion-ai-1.0.0.jar > ../logs/ai.log 2>&1 &
echo $! > ../logs/ai.pid
echo "✅ AI服务启动完成 (PID: $!)"
sleep 5
else
echo "❌ AI服务编译失败"
fi
cd ..
# 启动网关服务
echo "🔄 启动网关服务..."
cd emotion-gateway
mvn clean package -DskipTests -q
if [ $? -eq 0 ]; then
nohup java -jar -Dspring.profiles.active=local -Dspring.cloud.nacos.discovery.enabled=false -Dspring.cloud.nacos.config.enabled=false target/emotion-gateway-1.0.0.jar > ../logs/gateway.log 2>&1 &
echo $! > ../logs/gateway.pid
echo "✅ 网关服务启动完成 (PID: $!)"
sleep 5
else
echo "❌ 网关服务编译失败"
fi
cd ..
echo ""
echo "🎉 服务启动完成!"
echo ""
echo "📋 服务列表:"
echo " 用户服务: http://localhost:19001"
echo " AI服务: http://localhost:19002"
echo " 网关服务: http://localhost:19000"
echo ""
echo "📝 日志文件位置: logs/"
echo "📝 停止服务: ./stop-services.sh"
# 检查服务状态
echo ""
echo "📊 检查服务状态..."
sleep 10
if curl -s http://localhost:19001/actuator/health >/dev/null 2>&1; then
echo "✅ 用户服务运行正常"
else
echo "⚠️ 用户服务可能未完全启动,请查看日志: tail -f logs/user.log"
fi
if curl -s http://localhost:19002/actuator/health >/dev/null 2>&1; then
echo "✅ AI服务运行正常"
else
echo "⚠️ AI服务可能未完全启动,请查看日志: tail -f logs/ai.log"
fi
if curl -s http://localhost:19000/actuator/health >/dev/null 2>&1; then
echo "✅ 网关服务运行正常"
else
echo "⚠️ 网关服务可能未完全启动,请查看日志: tail -f logs/gateway.log"
fi