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