This commit is contained in:
van
2026-04-11 22:35:42 +08:00
parent 124af53209
commit cd5c49762a
3 changed files with 158 additions and 9 deletions

View File

@@ -15,3 +15,19 @@ export function getHealth() {
method: 'get'
})
}
// 手动测试微信推送(会真实下发一条消息)
export function triggerWxSendHealthTest() {
return request({
url: '/monitor/server/health/wx-send-test',
method: 'post'
})
}
// 手动测试企微闲鱼通知(经 wxSend goofish-active-push
export function triggerGoofishNotifyTest() {
return request({
url: '/monitor/server/health/goofish-notify-test',
method: 'post'
})
}

View File

@@ -214,8 +214,17 @@
<el-col :span="12" class="card-box">
<el-card>
<div slot="header">
<div slot="header" class="clearfix">
<span><i class="el-icon-message"></i> 微信推送服务健康度</span>
<el-button
style="float: right; padding: 3px 10px;"
type="primary"
size="mini"
:loading="wxSendTesting"
@click="testWxSendHealth"
>
{{ wxSendTesting ? '检测中...' : '测试' }}
</el-button>
</div>
<div class="el-table el-table--enable-row-hover el-table--medium">
<table cellspacing="0" style="width: 100%;">
@@ -224,7 +233,7 @@
<td class="el-table__cell is-leaf"><div class="cell">服务状态</div></td>
<td class="el-table__cell is-leaf">
<div class="cell">
<el-tag :type="health.wxSend && health.wxSend.healthy ? 'success' : 'danger'">
<el-tag :type="wxSendTagType">
{{ health.wxSend && health.wxSend.status ? health.wxSend.status : '未知' }}
</el-tag>
</div>
@@ -241,7 +250,7 @@
<tr>
<td class="el-table__cell is-leaf"><div class="cell">状态信息</div></td>
<td class="el-table__cell is-leaf">
<div class="cell" :class="{'text-danger': health.wxSend && !health.wxSend.healthy}">
<div class="cell" :class="{'text-danger': health.wxSend && health.wxSend.healthy === false}">
{{ health.wxSend && health.wxSend.message ? health.wxSend.message : '-' }}
</div>
</td>
@@ -252,6 +261,55 @@
</el-card>
</el-col>
<el-col :span="12" class="card-box">
<el-card>
<div slot="header" class="clearfix">
<span><i class="el-icon-bell"></i> 企微闲鱼通知wxSend</span>
<el-button
style="float: right; padding: 3px 10px;"
type="primary"
size="mini"
:loading="goofishTesting"
@click="testGoofishNotify"
>
{{ goofishTesting ? '检测中...' : '测试' }}
</el-button>
</div>
<div class="el-table el-table--enable-row-hover el-table--medium">
<table cellspacing="0" style="width: 100%;">
<tbody>
<tr>
<td class="el-table__cell is-leaf"><div class="cell">服务状态</div></td>
<td class="el-table__cell is-leaf">
<div class="cell">
<el-tag :type="goofishTagType">
{{ health.goofishNotify && health.goofishNotify.status ? health.goofishNotify.status : '未知' }}
</el-tag>
</div>
</td>
</tr>
<tr>
<td class="el-table__cell is-leaf"><div class="cell">推送接口</div></td>
<td class="el-table__cell is-leaf">
<div class="cell" style="word-break: break-all;">
{{ health.goofishNotify && health.goofishNotify.serviceUrl ? health.goofishNotify.serviceUrl : '-' }}
</div>
</td>
</tr>
<tr>
<td class="el-table__cell is-leaf"><div class="cell">状态信息</div></td>
<td class="el-table__cell is-leaf">
<div class="cell" :class="{'text-danger': health.goofishNotify && health.goofishNotify.healthy === false}">
{{ health.goofishNotify && health.goofishNotify.message ? health.goofishNotify.message : '-' }}
</div>
</td>
</tr>
</tbody>
</table>
</div>
</el-card>
</el-col>
<!-- Ollama 服务健康度调试用 -->
<el-col :span="12" class="card-box">
<el-card>
@@ -306,7 +364,7 @@
</template>
<script>
import { getServer, getHealth } from "@/api/monitor/server"
import { getServer, getHealth, triggerWxSendHealthTest, triggerGoofishNotifyTest } from "@/api/monitor/server"
export default {
name: "Server",
@@ -318,9 +376,24 @@ export default {
health: {
logistics: null,
wxSend: null,
goofishNotify: null,
ollama: null
},
ollamaTesting: false
ollamaTesting: false,
wxSendTesting: false,
goofishTesting: false
}
},
computed: {
wxSendTagType() {
const w = this.health.wxSend
if (!w || w.healthy === null || w.healthy === undefined) return 'info'
return w.healthy ? 'success' : 'danger'
},
goofishTagType() {
const g = this.health.goofishNotify
if (!g || g.healthy === null || g.healthy === undefined) return 'info'
return g.healthy ? 'success' : 'danger'
}
},
created() {
@@ -352,7 +425,15 @@ export default {
getHealth()
.then(response => {
if (response.data) {
const prevWx = this.health.wxSend
const prevGf = this.health.goofishNotify
this.health = response.data
if (prevWx && prevWx.healthy !== null && prevWx.healthy !== undefined) {
this.$set(this.health, 'wxSend', prevWx)
}
if (prevGf && prevGf.healthy !== null && prevGf.healthy !== undefined) {
this.$set(this.health, 'goofishNotify', prevGf)
}
const ollama = response.data.ollama
if (ollama && ollama.healthy) {
this.$message.success('Ollama 服务正常')
@@ -369,6 +450,50 @@ export default {
this.ollamaTesting = false
})
},
/** 手动测试微信推送(会真实下发一条消息) */
testWxSendHealth() {
this.wxSendTesting = true
triggerWxSendHealthTest()
.then(response => {
if (response.data) {
this.$set(this.health, 'wxSend', response.data)
if (response.data.healthy) {
this.$message.success('微信推送测试成功')
} else {
this.$message.warning(response.data.message || '微信推送测试未通过')
}
}
})
.catch(error => {
console.error('微信推送测试失败', error)
this.$message.error('检测失败: ' + (error.message || '网络异常'))
})
.finally(() => {
this.wxSendTesting = false
})
},
/** 手动测试企微闲鱼通知 */
testGoofishNotify() {
this.goofishTesting = true
triggerGoofishNotifyTest()
.then(response => {
if (response.data) {
this.$set(this.health, 'goofishNotify', response.data)
if (response.data.healthy) {
this.$message.success('闲鱼通知测试成功')
} else {
this.$message.warning(response.data.message || '闲鱼通知测试未通过')
}
}
})
.catch(error => {
console.error('闲鱼通知测试失败', error)
this.$message.error('检测失败: ' + (error.message || '网络异常'))
})
.finally(() => {
this.goofishTesting = false
})
},
// 打开加载层
openLoading() {
this.$modal.loading("正在加载服务监控数据,请稍候!")

View File

@@ -521,7 +521,9 @@ export default {
'RUNNING': '执行中',
'SUCCESS': '成功',
'PARTIAL': '部分成功',
'FAILED': '失败'
'PARTIAL_SUCCESS': '部分成功',
'FAILED': '失败',
'INTERRUPTED': '已中断'
}
return statusMap[status] || status
},
@@ -531,7 +533,9 @@ export default {
'RUNNING': 'warning',
'SUCCESS': 'success',
'PARTIAL': 'warning',
'FAILED': 'danger'
'PARTIAL_SUCCESS': 'warning',
'FAILED': 'danger',
'INTERRUPTED': 'info'
}
return typeMap[status] || 'info'
},
@@ -540,8 +544,10 @@ export default {
const typeMap = {
'SUCCESS': 'success',
'PARTIAL': 'warning',
'PARTIAL_SUCCESS': 'warning',
'FAILED': 'danger',
'RUNNING': 'primary'
'RUNNING': 'primary',
'INTERRUPTED': 'info'
}
return typeMap[status] || 'info'
},
@@ -550,8 +556,10 @@ export default {
const iconMap = {
'SUCCESS': 'el-icon-success',
'PARTIAL': 'el-icon-warning',
'PARTIAL_SUCCESS': 'el-icon-warning',
'FAILED': 'el-icon-error',
'RUNNING': 'el-icon-loading'
'RUNNING': 'el-icon-loading',
'INTERRUPTED': 'el-icon-remove-outline'
}
return iconMap[status] || 'el-icon-info'
},