1
This commit is contained in:
@@ -14,4 +14,20 @@ export function getHealth() {
|
|||||||
url: '/monitor/server/health',
|
url: '/monitor/server/health',
|
||||||
method: 'get'
|
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'
|
||||||
|
})
|
||||||
}
|
}
|
||||||
@@ -214,8 +214,17 @@
|
|||||||
|
|
||||||
<el-col :span="12" class="card-box">
|
<el-col :span="12" class="card-box">
|
||||||
<el-card>
|
<el-card>
|
||||||
<div slot="header">
|
<div slot="header" class="clearfix">
|
||||||
<span><i class="el-icon-message"></i> 微信推送服务健康度</span>
|
<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>
|
||||||
<div class="el-table el-table--enable-row-hover el-table--medium">
|
<div class="el-table el-table--enable-row-hover el-table--medium">
|
||||||
<table cellspacing="0" style="width: 100%;">
|
<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">服务状态</div></td>
|
||||||
<td class="el-table__cell is-leaf">
|
<td class="el-table__cell is-leaf">
|
||||||
<div class="cell">
|
<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 : '未知' }}
|
{{ health.wxSend && health.wxSend.status ? health.wxSend.status : '未知' }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</div>
|
</div>
|
||||||
@@ -241,7 +250,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td class="el-table__cell is-leaf"><div class="cell">状态信息</div></td>
|
<td class="el-table__cell is-leaf"><div class="cell">状态信息</div></td>
|
||||||
<td class="el-table__cell is-leaf">
|
<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 : '-' }}
|
{{ health.wxSend && health.wxSend.message ? health.wxSend.message : '-' }}
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@@ -252,6 +261,55 @@
|
|||||||
</el-card>
|
</el-card>
|
||||||
</el-col>
|
</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 服务健康度(调试用) -->
|
<!-- Ollama 服务健康度(调试用) -->
|
||||||
<el-col :span="12" class="card-box">
|
<el-col :span="12" class="card-box">
|
||||||
<el-card>
|
<el-card>
|
||||||
@@ -306,7 +364,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getServer, getHealth } from "@/api/monitor/server"
|
import { getServer, getHealth, triggerWxSendHealthTest, triggerGoofishNotifyTest } from "@/api/monitor/server"
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Server",
|
name: "Server",
|
||||||
@@ -318,9 +376,24 @@ export default {
|
|||||||
health: {
|
health: {
|
||||||
logistics: null,
|
logistics: null,
|
||||||
wxSend: null,
|
wxSend: null,
|
||||||
|
goofishNotify: null,
|
||||||
ollama: 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() {
|
created() {
|
||||||
@@ -352,7 +425,15 @@ export default {
|
|||||||
getHealth()
|
getHealth()
|
||||||
.then(response => {
|
.then(response => {
|
||||||
if (response.data) {
|
if (response.data) {
|
||||||
|
const prevWx = this.health.wxSend
|
||||||
|
const prevGf = this.health.goofishNotify
|
||||||
this.health = response.data
|
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
|
const ollama = response.data.ollama
|
||||||
if (ollama && ollama.healthy) {
|
if (ollama && ollama.healthy) {
|
||||||
this.$message.success('Ollama 服务正常')
|
this.$message.success('Ollama 服务正常')
|
||||||
@@ -369,6 +450,50 @@ export default {
|
|||||||
this.ollamaTesting = false
|
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() {
|
openLoading() {
|
||||||
this.$modal.loading("正在加载服务监控数据,请稍候!")
|
this.$modal.loading("正在加载服务监控数据,请稍候!")
|
||||||
|
|||||||
@@ -521,7 +521,9 @@ export default {
|
|||||||
'RUNNING': '执行中',
|
'RUNNING': '执行中',
|
||||||
'SUCCESS': '成功',
|
'SUCCESS': '成功',
|
||||||
'PARTIAL': '部分成功',
|
'PARTIAL': '部分成功',
|
||||||
'FAILED': '失败'
|
'PARTIAL_SUCCESS': '部分成功',
|
||||||
|
'FAILED': '失败',
|
||||||
|
'INTERRUPTED': '已中断'
|
||||||
}
|
}
|
||||||
return statusMap[status] || status
|
return statusMap[status] || status
|
||||||
},
|
},
|
||||||
@@ -531,7 +533,9 @@ export default {
|
|||||||
'RUNNING': 'warning',
|
'RUNNING': 'warning',
|
||||||
'SUCCESS': 'success',
|
'SUCCESS': 'success',
|
||||||
'PARTIAL': 'warning',
|
'PARTIAL': 'warning',
|
||||||
'FAILED': 'danger'
|
'PARTIAL_SUCCESS': 'warning',
|
||||||
|
'FAILED': 'danger',
|
||||||
|
'INTERRUPTED': 'info'
|
||||||
}
|
}
|
||||||
return typeMap[status] || 'info'
|
return typeMap[status] || 'info'
|
||||||
},
|
},
|
||||||
@@ -540,8 +544,10 @@ export default {
|
|||||||
const typeMap = {
|
const typeMap = {
|
||||||
'SUCCESS': 'success',
|
'SUCCESS': 'success',
|
||||||
'PARTIAL': 'warning',
|
'PARTIAL': 'warning',
|
||||||
|
'PARTIAL_SUCCESS': 'warning',
|
||||||
'FAILED': 'danger',
|
'FAILED': 'danger',
|
||||||
'RUNNING': 'primary'
|
'RUNNING': 'primary',
|
||||||
|
'INTERRUPTED': 'info'
|
||||||
}
|
}
|
||||||
return typeMap[status] || 'info'
|
return typeMap[status] || 'info'
|
||||||
},
|
},
|
||||||
@@ -550,8 +556,10 @@ export default {
|
|||||||
const iconMap = {
|
const iconMap = {
|
||||||
'SUCCESS': 'el-icon-success',
|
'SUCCESS': 'el-icon-success',
|
||||||
'PARTIAL': 'el-icon-warning',
|
'PARTIAL': 'el-icon-warning',
|
||||||
|
'PARTIAL_SUCCESS': 'el-icon-warning',
|
||||||
'FAILED': 'el-icon-error',
|
'FAILED': 'el-icon-error',
|
||||||
'RUNNING': 'el-icon-loading'
|
'RUNNING': 'el-icon-loading',
|
||||||
|
'INTERRUPTED': 'el-icon-remove-outline'
|
||||||
}
|
}
|
||||||
return iconMap[status] || 'el-icon-info'
|
return iconMap[status] || 'el-icon-info'
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user