feat: fund-gateway增加/fund context path

修改内容:
1. fund-gateway/application.yml:
   - 所有路由Path添加/fund前缀
   - StripPrefix从1改为2(剥离/fund和模块名两级)
   - 例:/fund/sys/... -> 转发到 /api/v1/sys/...

2. 前端API配置:
   - fund-admin/src/api/request.ts: baseURL改为'/fund'
   - fund-mobile/src/api/request.ts: baseURL改为'/fund'

3. Nginx部署脚本:
   - 添加/fund/路径代理配置
   - 保留/api/代理兼容旧版

API调用示例:
- 旧版:/sys/auth/login
- 新版:/fund/sys/auth/login

网关路由:
- /fund/sys/** -> lb://fund-sys/api/v1/sys/**
- /fund/cust/** -> lb://fund-cust/api/v1/cust/**
- ...
This commit is contained in:
zhangjf 2026-02-22 22:24:20 +08:00
parent 961b669b16
commit 797feff8c2
5 changed files with 38 additions and 21 deletions

View File

@ -3,7 +3,7 @@ import { ElMessage } from 'element-plus'
// 创建axios实例
const service: AxiosInstance = axios.create({
baseURL: '',
baseURL: '/fund',
timeout: 15000,
headers: {
'Content-Type': 'application/json'

View File

@ -63,65 +63,65 @@ spring:
- id: fund-sys
uri: lb://fund-sys
predicates:
- Path=/sys/**
- Path=/fund/sys/**
filters:
- StripPrefix=1
- StripPrefix=2
# 客户管理服务
- id: fund-cust
uri: lb://fund-cust
predicates:
- Path=/cust/**
- Path=/fund/cust/**
filters:
- StripPrefix=1
- StripPrefix=2
# 项目管理服务
- id: fund-proj
uri: lb://fund-proj
predicates:
- Path=/proj/**
- Path=/fund/proj/**
filters:
- StripPrefix=1
- StripPrefix=2
# 用款申请服务
- id: fund-req
uri: lb://fund-req
predicates:
- Path=/req/**
- Path=/fund/req/**
filters:
- StripPrefix=1
- StripPrefix=2
# 支出管理服务
- id: fund-exp
uri: lb://fund-exp
predicates:
- Path=/exp/**
- Path=/fund/exp/**
filters:
- StripPrefix=1
- StripPrefix=2
# 收款管理服务
- id: fund-receipt
uri: lb://fund-receipt
predicates:
- Path=/receipt/**
- Path=/fund/receipt/**
filters:
- StripPrefix=1
- StripPrefix=2
# 报表服务
- id: fund-report
uri: lb://fund-report
predicates:
- Path=/report/**
- Path=/fund/report/**
filters:
- StripPrefix=1
- StripPrefix=2
# 文件服务
- id: fund-file
uri: lb://fund-file
predicates:
- Path=/file/**
- Path=/fund/file/**
filters:
- StripPrefix=1
- StripPrefix=2
# 多租户路由配置
tenant:

View File

@ -1,7 +1,7 @@
import axios from 'axios'
const request = axios.create({
baseURL: '',
baseURL: '/fund',
timeout: 15000,
headers: {
'Content-Type': 'application/json'

View File

@ -96,7 +96,24 @@ server {
add_header Cache-Control "public, immutable";
}
# API代理到网关
# API代理到网关/fund前缀
location /fund/ {
proxy_pass http://${gateway_host}/fund/;
proxy_set_header Host \$host;
proxy_set_header X-Real-IP \$remote_addr;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto \$scheme;
# 超时配置
proxy_connect_timeout 60s;
proxy_send_timeout 60s;
proxy_read_timeout 60s;
# 文件上传大小限制
client_max_body_size 100m;
}
# 兼容旧版/api代理可选逐步迁移后可删除
location /api/ {
proxy_pass http://${gateway_host}/;
proxy_set_header Host \$host;

View File

@ -57,8 +57,8 @@ COS_BUCKET_HOST=https://test-1308258046.cos.ap-beijing.myqcloud.com
# --------------------------------------------
# 文件上传配置
# --------------------------------------------
FILE_UPLOAD_MAX_SIZE=50MB
FILE_UPLOAD_MAX_REQUEST_SIZE=100MB
FILE_UPLOAD_MAX_SIZE=52428800
FILE_UPLOAD_MAX_REQUEST_SIZE=52428800
FILE_STORAGE_PATH=./uploads
FILE_STORAGE_MAX_BYTES=52428800