This commit is contained in:
2025-11-06 00:13:06 +08:00
parent c6fa3d0018
commit 9ed12b9248
3 changed files with 53 additions and 16 deletions

View File

@@ -50,7 +50,7 @@ server {
# ========== 重要后端API代理配置 ==========
# 将所有API请求代理到后端服务器解决混合内容问题
# 注意:这里的路径需要与前端 VUE_APP_BASE_API 配置一致
location /dev-api/ {
location /jarvis-api/ {
proxy_pass http://127.0.0.1:30313/; # 后端服务地址
# 请求头设置
@@ -81,36 +81,36 @@ server {
client_max_body_size 100M;
}
# 腾讯文档OAuth回调接口必须放在 /dev-api/ 之后location / 之前)
# 腾讯文档OAuth回调接口必须放在 /jarvis-api/ 之后location / 之前)
location /tendoc-callback {
proxy_pass http://127.0.0.1:30313/tendoc-callback;
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_set_header X-Forwarded-Host $server_name;
}
# jarvis相关API代理包括腾讯文档的其他接口
location /jarvis/ {
proxy_pass http://127.0.0.1:30313/jarvis/;
# 请求头设置
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_set_header X-Forwarded-Host $server_name;
# HTTP版本和WebSocket支持
# POST请求支持
proxy_set_header Content-Type $content_type;
proxy_set_header Content-Length $content_length;
proxy_pass_request_headers on;
proxy_pass_request_body on;
# HTTP版本
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
# 超时设置
proxy_connect_timeout 600s;
proxy_send_timeout 600s;
proxy_read_timeout 600s;
# 请求体大小限制
client_max_body_size 100M;
}
# 注意jarvis相关API已通过 /jarvis-api/ 代理,不再需要单独的 /jarvis/ location
# Druid监控代理如果需要
location /druid/ {

View File

@@ -97,3 +97,11 @@ export function getSheetList(params) {
})
}
// 测试获取用户信息
export function testUserInfo() {
return request({
url: '/jarvis/tendoc/testUserInfo',
method: 'get'
})
}

View File

@@ -44,6 +44,7 @@
<el-button type="primary" size="small" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button size="small" icon="el-icon-refresh" @click="resetQuery">重置</el-button>
<el-button type="warning" size="small" icon="el-icon-download" @click="handleExport" v-hasPermi="['system:jdorder:export']">导出</el-button>
<el-button type="info" size="small" icon="el-icon-user" @click="handleTestUserInfo" title="测试腾讯文档用户信息接口">测试用户信息</el-button>
</el-form-item>
</el-form>
</template>
@@ -351,7 +352,7 @@
<script>
import { listJDOrders, updateJDOrder, delJDOrder, fetchLogisticsManually } from '@/api/system/jdorder'
import { fillLogisticsByOrderNo, getTokenStatus, getTencentDocAuthUrl } from '@/api/jarvis/tendoc'
import { fillLogisticsByOrderNo, getTokenStatus, getTencentDocAuthUrl, testUserInfo } from '@/api/jarvis/tendoc'
import ListLayout from '@/components/ListLayout'
export default {
@@ -755,6 +756,34 @@ export default {
}
},
/** 测试获取用户信息接口 */
async handleTestUserInfo() {
try {
this.$message.info('正在测试用户信息接口...')
const res = await testUserInfo()
if (res.code === 200) {
this.$message.success('测试成功!用户信息:' + JSON.stringify(res.data, null, 2))
// 显示详细信息
this.$alert(
'<pre style="text-align: left; max-height: 400px; overflow: auto;">' +
JSON.stringify(res.data, null, 2) +
'</pre>',
'用户信息测试结果',
{
dangerouslyUseHTMLString: true,
confirmButtonText: '确定',
type: 'success'
}
)
} else {
this.$message.error('测试失败:' + (res.msg || '未知错误'))
}
} catch (e) {
this.$message.error('测试失败:' + (e.message || '未知错误'))
console.error('测试用户信息失败', e)
}
},
/** 同步物流链接 */
async handleSyncLogisticsSubmit() {
if (!this.syncLogisticsForm.fileId || !this.syncLogisticsForm.sheetId) {