fix(extensions): IP 归属地管理端测试可绕过启用开关

后台测试此前受 ip_geo_enabled 短路,未启用时结果恒为空;强制 live lookup 并返回可读失败原因。
This commit is contained in:
2026-07-12 14:35:19 +08:00
parent 5c84d259e7
commit 3675b7dcef
4 changed files with 78 additions and 21 deletions
+2 -2
View File
@@ -3,8 +3,8 @@ export const extensionsApiMethods = {
* 扩展&增强 (Extensions)
* ================================================================ */
testIpGeo(ip) { return this.request('/extensions/ip-test', { method: 'POST', body: JSON.stringify({ ip }) }) },
testContentAudit(text) { return this.request('/extensions/audit-test', { method: 'POST', body: JSON.stringify({ text }) }) },
testIpGeo(ip) { return this.request('/extensions/ip-test', { method: 'POST', data: { ip } }) },
testContentAudit(text) { return this.request('/extensions/audit-test', { method: 'POST', data: { text } }) },
/* AI 辅助(兼容页) */
getAiStatus() { return this.request('/ai/status') },
@@ -216,10 +216,16 @@ async function handleSaveRisk() {
async function handleTestIp() {
ipTest.value.loading = true
ipTest.value.result = ''
try {
const res = await api.testIpGeo(ipTest.value.ip)
ipTest.value.result = JSON.stringify(res?.data || {}, null, 2)
message.success('IP 接口测试完成')
const res = await api.testIpGeo(String(ipTest.value.ip || '').trim())
const data = res?.data || {}
ipTest.value.result = JSON.stringify(data, null, 2)
if (data.ok) {
message.success(data.display ? `IP 测试成功:${data.display}` : 'IP 接口测试完成')
} else {
message.warning(data.message || '未查询到归属地信息')
}
} catch (err) {
message.error(err?.message || 'IP 测试失败')
} finally {