feat: homepage add message count datas
This commit is contained in:
@@ -119,9 +119,10 @@ func DeleteOutDateLogs(keepNum int) (int, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type StatisticData struct {
|
type StatisticData struct {
|
||||||
TodaySuccNum int `json:"today_succ_num"`
|
TodaySuccNum int `json:"today_succ_num"`
|
||||||
TodayFailedNum int `json:"today_failed_num"`
|
TodayFailedNum int `json:"today_failed_num"`
|
||||||
TodayTotalNum int `json:"today_total_num"`
|
TodayTotalNum int `json:"today_total_num"`
|
||||||
|
MessageTotalNum int `json:"message_total_num"`
|
||||||
|
|
||||||
LatestSendData []LatestSendData `json:"latest_send_data" gorm:"many2many:latest_send_data;"`
|
LatestSendData []LatestSendData `json:"latest_send_data" gorm:"many2many:latest_send_data;"`
|
||||||
WayCateData []WayCateData `json:"way_cate_data" gorm:"many2many:way_cate_data;"`
|
WayCateData []WayCateData `json:"way_cate_data" gorm:"many2many:way_cate_data;"`
|
||||||
@@ -161,6 +162,10 @@ func GetStatisticData() (StatisticData, error) {
|
|||||||
|
|
||||||
query.Take(&statistic)
|
query.Take(&statistic)
|
||||||
|
|
||||||
|
// 全部消息统计数据
|
||||||
|
totalQuery := db.Table(logt).Select(`COUNT(*) AS message_total_num`)
|
||||||
|
totalQuery.Take(&statistic)
|
||||||
|
|
||||||
// 最近30天数据
|
// 最近30天数据
|
||||||
days := 30
|
days := 30
|
||||||
now := util.GetNowTime()
|
now := util.GetNowTime()
|
||||||
|
|||||||
@@ -2,7 +2,18 @@
|
|||||||
<div class="main-center-body">
|
<div class="main-center-body">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<el-row :gutter="16">
|
<el-row :gutter="16">
|
||||||
<el-col :span="8">
|
<el-col :span="6">
|
||||||
|
<div class="statistic-card">
|
||||||
|
<el-statistic :value="data.message_total_num">
|
||||||
|
<template #title>
|
||||||
|
<div style="display: inline-flex; align-items: center">
|
||||||
|
当前消息留存数
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</el-statistic>
|
||||||
|
</div>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="6">
|
||||||
<div class="statistic-card">
|
<div class="statistic-card">
|
||||||
<el-statistic :value="data.today_total_num">
|
<el-statistic :value="data.today_total_num">
|
||||||
<template #title>
|
<template #title>
|
||||||
@@ -13,7 +24,7 @@
|
|||||||
</el-statistic>
|
</el-statistic>
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="6">
|
||||||
<div class="statistic-card">
|
<div class="statistic-card">
|
||||||
<el-statistic :value="data.today_succ_num">
|
<el-statistic :value="data.today_succ_num">
|
||||||
<template #title>
|
<template #title>
|
||||||
@@ -24,7 +35,7 @@
|
|||||||
</el-statistic>
|
</el-statistic>
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="8">
|
<el-col :span="6">
|
||||||
<div class="statistic-card">
|
<div class="statistic-card">
|
||||||
<el-statistic :value="data.today_failed_num" :value-style="formatFailedNumStyle()">
|
<el-statistic :value="data.today_failed_num" :value-style="formatFailedNumStyle()">
|
||||||
<template #title>
|
<template #title>
|
||||||
@@ -38,7 +49,6 @@
|
|||||||
</el-icon>
|
</el-icon>
|
||||||
</template>
|
</template>
|
||||||
</el-statistic>
|
</el-statistic>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
@@ -53,8 +63,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script >
|
<script>
|
||||||
import {
|
import {
|
||||||
ArrowRight,
|
ArrowRight,
|
||||||
CaretBottom,
|
CaretBottom,
|
||||||
@@ -228,7 +238,7 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.container {
|
.container {
|
||||||
max-width: 1000px;
|
max-width: 1000px;
|
||||||
@@ -259,5 +269,4 @@ export default {
|
|||||||
.red {
|
.red {
|
||||||
color: var(--el-color-error);
|
color: var(--el-color-error);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
Reference in New Issue
Block a user